#7 Identity needs to be supported

closed
nobody
None
5
2004-07-07
2004-07-03
No

SELECT @@IDENTITY needs to be supported.

My kludge for now:

//=========================================

int SQLiteCommand::GetIdentity()
{
return sqlite_last_insert_rowid(mpConn->mhConn);
}

//=========================================

Object* SQLiteCommand::ExecuteScalar ()
{
// ExecuteReader and get value of first column of first
row
Object* pObj;
if (CommandText->Equals("SELECT @@IDENTITY"))
{
pObj=__box(GetIdentity());
}
else
{
IDataReader* pReader = ExecuteReader();
if (pReader->Read() && pReader->FieldCount > 0)
pObj = pReader->GetValue (0);
pReader->Close();
}
return pObj;
}

Discussion

  • Alexander Gavrilov

    Logged In: YES
    user_id=1000441

    The equivalent for this is SELECT last_insert_rowid();

     
  • Alexander Gavrilov

    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks