Thank you, I solved getting oid from a table.... -sandhya ----- Original Message ----- From: "sandhya" <[EMAIL PROTECTED]> To: <sqlite-users@sqlite.org> Sent: Sunday, September 17, 2006 1:21 PM Subject: [sqlite] Which API to use to get resultant of query
> > Just i modified the query and tested ....With the steps i used it is working > fine..... > Like the otherway round i went, > select filename from sample where oid = '455'; > Now it is working fine and showing the corresponding file name. > Where as when i am giving like select oid from sample where filename = > "sample.txt";(Nothing i am getting) > Onemorething i want to say here is, > I have created a table(sample) with only two cloumns... > filename text,data blob; > > But i want to get the oid which is internally there in the database.Whether > i can able to get the oid through the same API's or i need to do in some > other way. > The following are the API's i used, > sprintf(szQuery,"select oid from sample where filename = "sample.txt" "); > sqlite3_prepare(db,szQuery, -1 , &pStmt, 0); > errcode = sqlite3_step(pStmt); //As i got error i included this to > check the error code ie 101(SQLITE_DONE) > if( errcode==SQLITE_ERROR ){ > errcode = sqlite3_reset(pStmt); > } > if( errcode == SQLITE_ROW ){ > oid = (int)sqlite3_column_int(pStmt, 0); > } > > Why it is showing the filename when i gave OID and the same when i am giving > filename and asking for OID it is throwing error. > Is it bcoz it is not present in the table or something else? > Please tell me how can i do this? > I need you help very much as i have very short time to complete this.. > > Thanks a lot > Sandhya > > > > ----- Original Message ----- > From: "Igor Tandetnik" <[EMAIL PROTECTED]> > To: "SQLite" <sqlite-users@sqlite.org> > Sent: Friday, September 15, 2006 8:56 PM > Subject: [sqlite] Re: Re: Re: Which API to use to get resultant of query > > > > sandhya <[EMAIL PROTECTED]> wrote: > > > But where as when i am executing the same from command prompt it is > > > showing > > > the OID alone. > > > Why it is showing DONE when i am doing it through program?Anything > > > wrong? > > > > Check your condition. Make sure it's the same as the one you use in > > console. Most likely, you've simply misspelled the string in the sprintf > > call and it cannot be found in the table. > > > > As a sanity check, drop the condition and see if you can get anything at > > all with a simple query like "select oid from tablename;" > > > > Igor Tandetnik > > > > > > -------------------------------------------------------------------------- > --- > > To unsubscribe, send email to [EMAIL PROTECTED] > > -------------------------------------------------------------------------- > --- > > > > > > -------------------------------------------------------------------------- --- > To unsubscribe, send email to [EMAIL PROTECTED] > -------------------------------------------------------------------------- --- > ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------