Re: [sqlite] Which API to use to get resultant of query
Thank you, I solved getting oid from a table -sandhya - Original Message - From: "sandhya" <[EMAIL PROTECTED]> To: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 , , 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" > 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] -
[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 , , 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"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] -
Re: [sqlite] Which API to use to get resultant of query
sandhya a écrit : You mean there is no need for me to take care of this function calls ..Its just enough having definition there. But by doing that i am not getting any kind of output ie my OID. No you should write the callback and do whatever you want with the passed data. You the pass the call_back name to the relevant sqlite function. sqlite will call it for every row selected by your query. - Original Message - From: "Noel Frankinet" <[EMAIL PROTECTED]> To:Sent: Friday, September 15, 2006 8:02 PM Subject: Re: [sqlite] Which API to use to get resultant of query sandhya a écrit : Thanks a lot for your response Actually there is one function call in some sample found like, static int callback(void *NotUsed, int argc, char **argv, char **azColName) { int i; for(i=0; i To: Sent: Friday, September 15, 2006 7:38 PM Subject: Re: [sqlite] Which API to use to get resultant of query On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote: sprintf(szQuery,"select oid from %s where filename = '%s'",sampletbl,test.htm); there's an example program here: http://sqlite.org/quickstart.html and a more involved one here http://www.reddawn.net/~jsprenkl/Sqlite -- -- SqliteImporter and SqliteReplicator: Command line utilities for Sqlite http://www.reddawn.net/~jsprenkl/Sqlite Cthulhu Bucks! http://www.cthulhubucks.com - - --- To unsubscribe, send email to [EMAIL PROTECTED] - - --- -- --- To unsubscribe, send email to [EMAIL PROTECTED] -- --- -- Noël Frankinet Gistek Software SA http://www.gistek.net -- --- To unsubscribe, send email to [EMAIL PROTECTED] -- --- - To unsubscribe, send email to [EMAIL PROTECTED] - -- Noël Frankinet Gistek Software SA http://www.gistek.net - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Which API to use to get resultant of query
I got but the return type of all API's is int..So where the result will get stored and how can i get..Please don't get fed up with the same question again and again i am not getting how to ask this? i used sqlite_exec() i don't know where the result stored and how to get it. I also used the following here also i am getting SQLITE_OK but where the result i am not getting sqlite3_prepare(db,szQuery, -1 , , 0); errcode = sqlite3_step(pStmt); Now where my result will be .Please do needful.I am very thankful to you -Sandhya - Original Message - From: "Jay Sprenkle" <[EMAIL PROTECTED]> To:Sent: Friday, September 15, 2006 8:10 PM Subject: Re: [sqlite] Which API to use to get resultant of query > On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote: > > Actually my query is returing only one data ie OID of the fileIn this > > case what i can do to get that data.Where it will get stored? > > look at the documentation for sqlite_bind(): > http://sqlite.org/capi3ref.html#sqlite3_bind_text > It explains how to send parameters to a query > > to get the results: > http://sqlite.org/capi3ref.html#sqlite3_column_int > > -- --- > To unsubscribe, send email to [EMAIL PROTECTED] > -- --- > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Which API to use to get resultant of query
You mean there is no need for me to take care of this function calls ..Its just enough having definition there. But by doing that i am not getting any kind of output ie my OID. - Original Message - From: "Noel Frankinet" <[EMAIL PROTECTED]> To:Sent: Friday, September 15, 2006 8:02 PM Subject: Re: [sqlite] Which API to use to get resultant of query > sandhya a écrit : > > Thanks a lot for your response > > Actually there is one function call in some sample found like, > > > > static int callback(void *NotUsed, int argc, char **argv, char **azColName) > > { > > int i; > > for(i=0; i > printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL"); > > } > > printf("\n"); > > return 0; > > } > > > > you don't call that callback , its called by sqlite... > In your case argc will be 1, argv[0] will contains the oid and > azColNames[0] will be "oid" > > > I reffered Shell.c also where in they also has the same function,If i am not > > passing my arguments through command prompt... > > What i should pass as 2 and 3 arguments in the above function call ie argc > > and argv.Is there any API which directly gives the result. > > Actually my query is returing only one data ie OID of the fileIn this > > case what i can do to get that data.Where it will get stored? > > Please help me...in doing this > > > > Thank you > > Sandhya > > - Original Message - > > From: "Jay Sprenkle" <[EMAIL PROTECTED]> > > To: > > Sent: Friday, September 15, 2006 7:38 PM > > Subject: Re: [sqlite] Which API to use to get resultant of query > > > > > > > >> On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote: > >> > >>> sprintf(szQuery,"select oid from %s where filename = > >>> > > '%s'",sampletbl,test.htm); > > > >> there's an example program here: > >> http://sqlite.org/quickstart.html > >> and a more involved one here > >> http://www.reddawn.net/~jsprenkl/Sqlite > >> > >> -- > >> -- > >> SqliteImporter and SqliteReplicator: Command line utilities for Sqlite > >> http://www.reddawn.net/~jsprenkl/Sqlite > >> > >> Cthulhu Bucks! > >> http://www.cthulhubucks.com > >> > >> - - > >> > > --- > > > >> To unsubscribe, send email to [EMAIL PROTECTED] > >> - - > >> > > --- > > > > > > > > > > -- --- > > To unsubscribe, send email to [EMAIL PROTECTED] > > -- --- > > > > > > > > > > > -- > Noël Frankinet > Gistek Software SA > http://www.gistek.net > > > -- --- > To unsubscribe, send email to [EMAIL PROTECTED] > -- --- > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Which API to use to get resultant of query
On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote: Actually my query is returing only one data ie OID of the fileIn this case what i can do to get that data.Where it will get stored? look at the documentation for sqlite_bind(): http://sqlite.org/capi3ref.html#sqlite3_bind_text It explains how to send parameters to a query to get the results: http://sqlite.org/capi3ref.html#sqlite3_column_int - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Which API to use to get resultant of query
sandhya a écrit : Thanks a lot for your response Actually there is one function call in some sample found like, static int callback(void *NotUsed, int argc, char **argv, char **azColName) { int i; for(i=0; iTo: Sent: Friday, September 15, 2006 7:38 PM Subject: Re: [sqlite] Which API to use to get resultant of query On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote: sprintf(szQuery,"select oid from %s where filename = '%s'",sampletbl,test.htm); there's an example program here: http://sqlite.org/quickstart.html and a more involved one here http://www.reddawn.net/~jsprenkl/Sqlite -- -- SqliteImporter and SqliteReplicator: Command line utilities for Sqlite http://www.reddawn.net/~jsprenkl/Sqlite Cthulhu Bucks! http://www.cthulhubucks.com -- --- To unsubscribe, send email to [EMAIL PROTECTED] -- --- - To unsubscribe, send email to [EMAIL PROTECTED] - -- Noël Frankinet Gistek Software SA http://www.gistek.net - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Which API to use to get resultant of query
Thanks a lot for your response Actually there is one function call in some sample found like, static int callback(void *NotUsed, int argc, char **argv, char **azColName) { int i; for(i=0; iTo: Sent: Friday, September 15, 2006 7:38 PM Subject: Re: [sqlite] Which API to use to get resultant of query > On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote: > > sprintf(szQuery,"select oid from %s where filename = '%s'",sampletbl,test.htm); > > > > > there's an example program here: > http://sqlite.org/quickstart.html > and a more involved one here > http://www.reddawn.net/~jsprenkl/Sqlite > > -- > -- > SqliteImporter and SqliteReplicator: Command line utilities for Sqlite > http://www.reddawn.net/~jsprenkl/Sqlite > > Cthulhu Bucks! > http://www.cthulhubucks.com > > -- --- > To unsubscribe, send email to [EMAIL PROTECTED] > -- --- > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Which API to use to get resultant of query
On 9/15/06, sandhya <[EMAIL PROTECTED]> wrote: sprintf(szQuery,"select oid from %s where filename = '%s'",sampletbl,test.htm); there's an example program here: http://sqlite.org/quickstart.html and a more involved one here http://www.reddawn.net/~jsprenkl/Sqlite -- -- SqliteImporter and SqliteReplicator: Command line utilities for Sqlite http://www.reddawn.net/~jsprenkl/Sqlite Cthulhu Bucks! http://www.cthulhubucks.com - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Which API to use to get resultant of query
sprintf(szQuery,"select oid from %s where filename = '%s'",sampletbl,test.htm); sqlite3_prepare(db,szQuery, 512 , , 0); errcode = sqlite3_step(pStmt); But the error code i am getting is 21..Somethig when i read in docs it gave misuseCan you please tell me where i did mistake. Is there any documets which shows the usage of these API's please mail me. Please help me where my resultant of the query get stored. I need it badly...Kindly do needful. Thank you, -Sandhya R