[sqlite] regarding sqlite3_prepare_v2() func

2015-01-21 Thread Sairam Gaddam
I have one doubt regarding sqlite code.
I have 2 programs-one with sqlite3_exec() included in the code and in other
it is not included.I included those files which are zmain.c and zmain1.c
respectively.
First i created a database and added a table "em" and added some contents
to it,then i executed and prepared the sqlite select query.
I added "printf("result");" in the "case op_resultrow" of the function
sqlite3vdbeexec().
Here when i executed zmain.c,
sqlite3_prepare_v2(db, sql, strlen(sql) + 1, , NULL);
the above statement didn't print anything.

OUTPUT:
  database opened successfully
  result
  result
  result
  result
  Operation done successfully
  Before
  Afterprep
(clearly there is nothing between before and afterprep)

But when i commented the sqlite3_exec() in zmain1.c
due to sqlite_prepare_v2() function,the program somehow entered
sqlite3vdbeexec() and printed what i gave in my printf statement.
OUTPUT:
database opened successfully
Operation done successfully
Before
result
result
Afterprep
(clearly there are some output between before and afterprep)

My doubt is why the function call sqlite3_prepare_v2() called
sqlite3vdbeexec in second case and why not in first program.

zmain.c :-   http://pastebin.com/ggmw9VTE
zmain1.c :- http://pastebin.com/xbgVLAyL
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] regarding sqlite3_prepare_v2() func

2015-01-21 Thread Dan Kennedy

On 01/22/2015 11:53 AM, Sairam Gaddam wrote:

I have one doubt regarding sqlite code.
I have 2 programs-one with sqlite3_exec() included in the code and in other
it is not included.I included those files which are zmain.c and zmain1.c
respectively.
First i created a database and added a table "em" and added some contents
to it,then i executed and prepared the sqlite select query.
I added "printf("result");" in the "case op_resultrow" of the function
sqlite3vdbeexec().
Here when i executed zmain.c,
sqlite3_prepare_v2(db, sql, strlen(sql) + 1, , NULL);
the above statement didn't print anything.

OUTPUT:
   database opened successfully
   result
   result
   result
   result
   Operation done successfully
   Before
   Afterprep
(clearly there is nothing between before and afterprep)

But when i commented the sqlite3_exec() in zmain1.c
due to sqlite_prepare_v2() function,the program somehow entered
sqlite3vdbeexec() and printed what i gave in my printf statement.
OUTPUT:
 database opened successfully
 Operation done successfully
 Before
 result
 result
 Afterprep
(clearly there are some output between before and afterprep)

My doubt is why the function call sqlite3_prepare_v2() called
sqlite3vdbeexec in second case and why not in first program.


This mailing list strips attachments. So you will need to upload code to 
pastebin or similar or inline it in the mail so that we can see it.


The first call to sqlite3_prepare_v2() needed to load the database 
schema into memory. It does this by executing a regular "SELECT ..." 
statement on the sqlite_master table, which involves calling 
sqlite3VdbeExec(). Via sqlite3_exec(), as it happens.


Dan.







___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] regarding sqlite3_prepare_v2() func

2015-01-21 Thread Sairam Gaddam
I have one doubt regarding sqlite code.
I have 2 programs-one with sqlite3_exec() included in the code and in other
it is not included.I included those files which are zmain.c and zmain1.c
respectively.
First i created a database and added a table "em" and added some contents
to it,then i executed and prepared the sqlite select query.
I added "printf("result");" in the "case op_resultrow" of the function
sqlite3vdbeexec().
Here when i executed zmain.c,
sqlite3_prepare_v2(db, sql, strlen(sql) + 1, , NULL);
the above statement didn't print anything.

OUTPUT:
  database opened successfully
  result
  result
  result
  result
  Operation done successfully
  Before
  Afterprep
(clearly there is nothing between before and afterprep)

But when i commented the sqlite3_exec() in zmain1.c
due to sqlite_prepare_v2() function,the program somehow entered
sqlite3vdbeexec() and printed what i gave in my printf statement.
OUTPUT:
database opened successfully
Operation done successfully
Before
result
result
Afterprep
(clearly there are some output between before and afterprep)

My doubt is why the function call sqlite3_prepare_v2() called
sqlite3vdbeexec in second case and why not in first program.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users