[sqlite] How to read data from mem?

2016-03-16 Thread Sairam Gaddam
I want to read the mem when the program is inside the sqlite3VdbeExec()
function and in case OP_Insert.


Here the mem consists of entire row to be inserted. When I read the mem
*pData, I found from the member pData->flags that it contains a BLOB. But
when I tried to print BLOB in pData->z, I didnt get correct results. How to
print a BLOB?

I tried to print the contents in it by performing a deep copy of that mem
and converting it to real value using sqlite3VdbeRealValue(). But no
satisfactory result.
Can someone kindly help me how to get data from mem?


[sqlite] sqlite3_update_hook() clarification

2016-03-09 Thread Sairam Gaddam
Thank you very much!!
It helped a lot.

On Wed, Mar 9, 2016 at 9:26 PM, Clemens Ladisch  wrote:

> Sairam Gaddam wrote:
> > The documentation says that the function sqlite3_update_hook() is called
> > whenever a row is updated, deleted or inserted
>
> No.  It says that this function is called to register a callback
> function that is called for these updates.
>
> > And I don't find any definition for this callback routine.
>
> void my_little_callback(void *stuff, int op, const char *db, const char
> *table, sqlite_int64 rowid)
> {
> printf("something was updated\n");
> }
>
> int main()
> {
> ...
> sqlite3_update_hook(db, my_little_callback, NULL);
> ...
> }
>
>
> Regards,
> Clemens
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] sqlite3_update_hook() clarification

2016-03-09 Thread Sairam Gaddam
http://www.sqlite.org/c3ref/update_hook.html

The documentation says that the function sqlite3_update_hook() is called
whenever a row is updated, deleted or inserted for a rowid table. But I
don't find this function to be invoked in my program. When will this
function be invoked??
And I am interested in its second parameter which gives the details of
table and the rowid of row which is updated. It is a callback function.

SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
  sqlite3 *db,  /* Attach the hook to this database */
  void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),
  void *pArg/* Argument to the function */
)

And I don't find any definition for this callback routine.

Can anyone kindly give information on this?


[sqlite] How to read data from WAL?

2016-03-07 Thread Sairam Gaddam
> I have done some manual WAL decoding for my forensic software that can
> identifiy a previous DB state - its fun :)...
>
> (From memory)
>
> To determine which pages belong to the last transaction, you need to :
>
> Read the WAL header to obtain the current salt, then read each wal
> frame to determine which frames belong to the current transaction and
> then you can get the page number from the frame.
>
> To determine which table/index the page belongs to you will need to
> check each b-tree (making sure that you take account of pages that are
> in the current WAL checkpoint - i.e. exist in the WAL prior to the
> page you are looking for).
>
> You will then need to manually decode each page you have identified in
> the WAL to get the rows within the page and then you need to determine
> what rows have been added/deleted or altered.
>
> The issues here are that a small change to a table (one row
> added/edited) can result in many changes to the pages for that table,
> e.g. if a string is appended to then the row may no longer fit in the
> page that it currently occupies so the row will be moved. Depending on
> the key structure for the table this may also result in other rows
> being moved to maintain the structure of the B-Tree. So if you read a
> page from the WAL and then find the* previous version of that page
> (which may be earlier in the WAL or in the DB) and a row is not
> present you will need to parse all the changed pages in that tree to
> determine whether it has been deleted or just moved.
>
> (* I say THE previous page because you can and very often do have
> multiple copies of a page in the WAL.)
>
> All of the information you need is in the DB file format at the link
> provided earlier. It is however not as simple as just reading the
> format spec though, it took me a lot of experimentation (including
> writing some DB/WAL page level visualisation tools) to work out what
> is actually going on.


Thanks for the info. I think this is what I need. Can you comment on time
complexity in this method?


[sqlite] How to read data from WAL?

2016-03-07 Thread Sairam Gaddam
>
> Sounds to me you want to implement logical decoding, that is to
> extract an SQL form from the binary WAL format.
> I don't believe SQLite provides such a feature, that is something
> other databases use for bidirectional replication.


I just want to know which tables and rows are changed from WAL, not
necessarily forming a SQL query. If that feature is not present in SQLite.
Can you suggest me a good way to achieve that goal?

Wal shipping is a good way if you don't need to get bidirectional.


Do you mean copying WAL file and placing someplace else when you say WAL
shipping? or something else?


[sqlite] How to read data from WAL?

2016-03-07 Thread Sairam Gaddam
>
> To achieve what goal?
>
> In any case, perhaps https://www.sqlite.org/rbu.html is of interest to
> you.
>

I want to make note of those changes and replicate in another DB. And I
found that WAL is the correct place where changes to the database are
present. So my main aim is to get those changes and replicate after further
processing.


[sqlite] How to read data from WAL?

2016-03-07 Thread Sairam Gaddam
>
> If you're really sure that the database files are identical, the easiest
> way to do the replication would be to copy the WAL file.
>
> What processing do you want to do?
>

I want to take note of changes and depending on data, I might replicate in
some other DB. The database files are not necessarily identical. So mere
copying wont help me. I should get the data from WAL and based on which
table(can I get these info from WAL?) the data was changed, I should act
accordingly. So the only way is to read page and extract information from
it or any other way??

> Is there any other better way other than WAL?
>
> Record the SQL statements that are executed.


This is one another case, where some optimization could happen, like for
example if I run a update query and nothing gets updated in a particular
table which is similar in 2 different databases, then WAL doesn't have any
changes on that particular table and no need to execute the same query
again in different DB!
And I have some other use cases like those.
So I would like to see the changes from WAL and based on changes and the
query, I will proceed.
So i need a better way to read the contents from the WAL.
One of them is analyzing the pages from WAL, any others??. In PostgreSQL,
for WAL, they have a module which will give summary of which row in a
particular table was changed by reading the contents from WAL. Any module
like that?? because my work will be easy if I get the info of changes that
way!!


[sqlite] How to read data from WAL?

2016-03-07 Thread Sairam Gaddam
>
> This requires detailed knowledge of how SQLite works.  If the file format
> page I referred you to does not help you may have to study the SQLite
> source code to find out what you need.
>

Yeah I read the source file wal.c and based on what I read, SQLite syncs
the frames which have page data in WAL with the main database to update it.
But I couldn't find a way to get those changes because they deal with
frames and pages. So if I get those WAL frames where page data is stored
and read them will I be able to get the changes which are made?

And the decryption here I mean is to get information from those pages(like
on which table, which column a change is made etc.,) which involves reading
the page to get the changes which are presently made.



> What are you trying to do ?  Are you trying to monitor a program which is
> running  or recover a corrupt database with some data in the WAL file ?
> There are good ways to do these things but they do not involve reading raw
> data from the WAL file.
>

I want to make note of those changes and replicate someplace else. And I
found that WAL is the correct place where changes to the database are
present. So my main aim is to get those changes and replicate after further
processing.
Is there any other better way other than WAL?


[sqlite] How to read data from WAL?

2016-03-07 Thread Sairam Gaddam
My main aim is to find the fresh changes which are to be made to database
through WAL module.


How is data stored in WAL?
If the data is stored in pages inside WAL then how to see the changes which
are presently made to the database?
Should I decrypt the information from WAL to know the changes which are to
be made to the database or any other way?
I found some decryption tools which are available for WAL. Will they give
changes to be made?
Or is there any module readily present inside SQLite which will decrpt the
information from WAL?

Any information on WAL decryption would be appreciated.
Thank you.


[sqlite] WAL checkpoint

2016-02-24 Thread Sairam Gaddam
Before checkpointing the data from WAL, if the DB is queried, will the
result include updated data from WAL or not?
Will this situation arise? because writing to WAL and checkpoint occur very
fast but if a query comes in between, will the result be updated or not
before checkpoint.


[sqlite] Closure.c extension

2015-09-09 Thread Sairam Gaddam
Is it necessary to have AVL tree in closure tables method and does it
result in speed improvements?

On Wed, Sep 9, 2015 at 4:59 PM, Richard Hipp  wrote:

> On 9/9/15, Sairam Gaddam  wrote:
> > I know that one of the method to compute transitive closure is closure
> > tables method. But I didn't understand why AVL tree implementation is
> > present in the closure.c extension in order to compute transitive closure
> > because the result can be directly queried from the Virtual table(closure
> > table).
> >
> > Can anyone kindly explain what is the significance of AVL tree to compute
> > transitive closure ???
>
> It is used to implement a priority queue.
> --
> D. Richard Hipp
> drh at sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Closure.c extension

2015-09-09 Thread Sairam Gaddam
I know that one of the method to compute transitive closure is closure
tables method. But I didn't understand why AVL tree implementation is
present in the closure.c extension in order to compute transitive closure
because the result can be directly queried from the Virtual table(closure
table).

Can anyone kindly explain what is the significance of AVL tree to compute
transitive closure ???


[sqlite] AVL tree implementation in closure module

2015-09-01 Thread Sairam Gaddam
Deep inside SQLite source files, there is a module called closure.c for
computing transitive closure and it is provided as an extension.

Inside, it uses an AVL tree implementation, so why to use that kind of
implementation(or importance) for computing transitive closure in this case?

And when is the AVL tree populated?
because I found that closureInsertNode() function call, which is used to
populate the tree are present inside the "xFilter Method" but the purpose
of "xFilter Method" method is to search the virtual table.

And one more query is that, when(or in which function) the Virtual table(or
closure table) is populated so that the "xFilter Method" will begin search
of the virtual table.

What is the relation between the virtual table and the AVL tree?

Can anyone kindly explain my queries???


[sqlite] Regarding root in transitive closure extension of SQLite

2015-08-11 Thread Sairam Gaddam
> Hello !
>
> Look this comment on ext/misc/closure.c:
>
> --
>
> ** When it is created, the new transitive_closure table may be supplied
> ** with default values for the name of a table T and columns T.X and T.P.
> ** *The T.X and T.P columns must contain integers*.  The ideal case is
> for
> ** T.X to be the INTEGER PRIMARY KEY.  The T.P column should reference
> ** the T.X column. The row referenced by T.P is the parent of the current
> row
>

Can anyone kindly tell how to extent the support to other data types like
Text?


[sqlite] Regarding root in transitive closure extension of SQLite

2015-08-11 Thread Sairam Gaddam
>
> Given that SQLite supports CTE's now, why use that extension?
>
> AFAIK, it was to add hierarchical query capability to SQLite, which CTE
> does builtin now. --DD


But will that solve my problem of having the data type of groupId other
than Integer primary key like Text???


[sqlite] Regarding root in transitive closure extension of SQLite

2015-08-06 Thread Sairam Gaddam
I have enabled the transitive closure extension and I followed the steps
regarding querying the virtual table mentioned in closure.c file as follows

CREATE VIRTUAL TABLE ct1 USING transitive_closure(
   tablename='group1',
   idcolumn='groupId',
   parentcolumn='parentId'
   );

CREATE TABLE group1(
 groupId INTEGER PRIMARY KEY,
 parentId INTEGER REFERENCES group1
  );

CREATE INDEX group_idx1 ON group(parentId);

SELECT group1.* FROM group1, ct1
WHERE element.groupid=ct1.id
 AND ct1.root=?1
 AND ct1.depth<=2;

In the above query, can the root be assigned a text data type?

I tried with INTEGER data type for both groupId and parentId, it worked
fine but when they are TEXT or INT data type and if I query like
ct1.root='SQLITE' there was no output.

Can anyone kindly tell help me regarding this ?


[sqlite] How to use gdb for .test files in SQLite?

2015-07-28 Thread Sairam Gaddam
I was testing a custom SQLite with the test files and one of the
file(tclsqlite.test) gave a segmentation fault, when I used Valgrind, it
didn't give any stack trace but instead gave the following error.

==5697==
==5697== Process terminating with default action of signal 11 (SIGSEGV):
dumping core
==5697==  Access not within mapped region at address 0xFFE767F58
==5697==at 0x4A1CDC: sqlite3VdbeExec (stdio2.h:104)
==5697==  If you believe this happened as a result of a stack
==5697==  overflow in your program's main thread (unlikely but
==5697==  possible), you can try to increase the size of the
==5697==  main thread stack using the --main-stacksize= flag.
==5697==  The main thread stack size used in this run was 8388608.

Can anyone kindly tell what does above error mean?

I was not able to find the position of the segmentation fault, will gdb
help in this case?
Can anyone kindly tell how to use gdb for .test files in order to find
origin of the error?


[sqlite] Unable to find the file 'memleak.txt'

2015-07-17 Thread Sairam Gaddam
> Try "locate memleak" if the file is not present in the working directory
> of the process running the test.
>
>
I tried that but there is no file named memleak.txt in the whole system !!!


[sqlite] Unable to find the file 'memleak.txt'

2015-07-17 Thread Sairam Gaddam
I ran the test files which are present in SQLite for my custom build and I
got some memory leaks.
I got a message like,

Writing unfreed memory log to "./memleak.txt"

But I couldn't able to locate that file.
Can anyone kindly tell where to find that file or where the unfreed memory
log is written ???


[sqlite] How to correctly a add string to a Mem?

2015-07-13 Thread Sairam Gaddam
I want to make some changes to the result set and I need to add an extra
column.

On Mon, Jul 13, 2015 at 12:33 PM, Clemens Ladisch 
wrote:

> Sairam Gaddam wrote:
> > I have tried a method to create a Mem and add a string to it, which is as
> > below
> >
> >  sqlite3VdbeMemSetStr(&(p->custom_aMem[0]), zColumn ,
> strlen(zColumn)*sizeof(char), SQLITE_UTF8, SQLITE_STATIC);
>
> This is an internal function that applications are not supposed to know
> about.  There is no right way to use it because the interface can change
> at any time.
>
> Why are you trying to do this?
>
>
> Regards,
> Clemens
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] How to correctly a add string to a Mem?

2015-07-13 Thread Sairam Gaddam
I have tried a method to create a Mem and add a string to it, which is as
below

 sqlite3VdbeMemInit(&(p->custom_aMem[0]), p->db, MEM_Null);

 memAboutToChange(p,&(p->custom_aMem[0]));

 sqlite3VdbeMemSetStr(&(p->custom_aMem[0]), zColumn ,
strlen(zColumn)*sizeof(char), SQLITE_UTF8, SQLITE_STATIC);

First I allocated space to Mem and initialized it using sqlite3VdbeMemInit(
) function.
Then I changed the Mem and set the value of the string to the Mem
using memAboutToChange(
) and sqlite3VdbeMemSetStr( ) respectively. Where zColumn is the string to
be added.

Is this the correct way to add data to Mem ???

Because when I add data using this method I experienced a memory leak when
executing large number of queries.

Can anyone kindly tell what is the correct way to add data to Mem ?


[sqlite] Regarding Result Set

2015-07-10 Thread Sairam Gaddam
Sir,
  I created a custom Result set in Resultrow case in sqlite3VdbeExec
function as below

custom_pResultSet = (Mem*) malloc(sizeof (Mem) * (custom_numElements));

and I initialized it using sqlite3VdbeMemInit function.

  for( i = 0 ; i < custom_numElements ; i++ )
  {
  sqlite3VdbeMemInit(_pResultSet[i], p->db,
MEM_Null);
  }

Then I copied the first element of custom_pResultSet i.e custom_pResultSet[0]
to

custom_pResultSet[0].z = zColumnSelector;
custom_pResultSet[0].flags = MEM_Str;
custom_pResultSet[0].n = strlen(zColumnSelector);
custom_pResultSet[0].zMalloc = zColumnSelector;
custom_pResultSet[0].enc = SQLITE_UTF8;

I modified the result Custom Result set for select statements and then made
pMem to point to it.

pMem = p->pResultSet = custom_pResultSet;

and then NULL terminated pMem.


I included the code in paste bin * http://pastebin.com/vZuUwXzR
*


The program executed fine when executing less number of queries(less than
60) but when large number of queries(more than 60) are executed then I
found some memory leak form sqlite3VdbeMemNulTerminate function but the
result is found to be correct.

==16096== 160 bytes in 2 blocks are definitely lost in loss record 1 of 1
==16096==at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16096==by 0x46DACE: sqlite3MemMalloc (sqlite3.c:17131)
==16096==by 0x46E52B: mallocWithAlarm (sqlite3.c:20794)
==16096==by 0x46E5C5: sqlite3Malloc (sqlite3.c:20825)
==16096==by 0x46EE7E: sqlite3DbMallocRaw (sqlite3.c:21191)
==16096==by 0x497721: sqlite3VdbeMemGrow (sqlite3.c:63167)
==16096==by 0x497A50: vdbeMemAddTerminator (sqlite3.c:63278)
==16096==by 0x497ADD: sqlite3VdbeMemNulTerminate (sqlite3.c:63298)
==16096==by 0x4A756D: sqlite3VdbeExec (sqlite3.c:73113)
==16096==by 0x4A00CA: sqlite3Step (sqlite3.c:69462)
==16096==by 0x4A02EC: sqlite3_step (sqlite3.c:69528)

The memory leak is increased while increasing the number of rows in the
tables.

Can anyone kindly explain why there is memory leak when executing large
number of queries ???

Or what should be done to correctly create and NULL terminate Custom result
set ??


[sqlite] Result set creation

2015-07-09 Thread Sairam Gaddam
I created a custom Result set in Resultrow case in sqlite3VdbeExec function
as below

custom_pResultSet = (Mem*) malloc(sizeof (Mem) * (custom_numElements));

and I initialized it using sqlite3VdbeMemInit function.

  for( i = 0 ; i < custom_numElements ; i++ )
  {
  sqlite3VdbeMemInit(_pResultSet[i], p->db,
MEM_Null);
  }

I modified the result Custom Result set for select statements and then made
pMem to point to it.

pMem = p->pResultSet = custom_pResultSet;

and then NULL terminated pMem.

The program executed fine when executing less number of queries(less than
60) but when large number of queries(more than 60) are executed then I
found some memory leak form sqlite3VdbeMemNulTerminate function but the
result is found to be correct.

==16096== 160 bytes in 2 blocks are definitely lost in loss record 1 of 1
==16096==at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16096==by 0x46DACE: sqlite3MemMalloc (sqlite3.c:17131)
==16096==by 0x46E52B: mallocWithAlarm (sqlite3.c:20794)
==16096==by 0x46E5C5: sqlite3Malloc (sqlite3.c:20825)
==16096==by 0x46EE7E: sqlite3DbMallocRaw (sqlite3.c:21191)
==16096==by 0x497721: sqlite3VdbeMemGrow (sqlite3.c:63167)
==16096==by 0x497A50: vdbeMemAddTerminator (sqlite3.c:63278)
==16096==by 0x497ADD: sqlite3VdbeMemNulTerminate (sqlite3.c:63298)
==16096==by 0x4A756D: sqlite3VdbeExec (sqlite3.c:73113)
==16096==by 0x4A00CA: sqlite3Step (sqlite3.c:69462)
==16096==by 0x4A02EC: sqlite3_step (sqlite3.c:69528)

The memory leak is increased while increasing the number of rows in the
tables.

Can anyone kindly explain why there is memory leak when executing large
number of queries ???

Or what should be done to correctly create and NULL terminate Custom result
set ??


[sqlite] Regarding TCL tests on SQLite

2015-07-01 Thread Sairam Gaddam
I was testing a custom build of SQLite by TCL test scripts which are
present in test folder of SQLite, some of the test scripts like
multiplex.test result in an error from the line number 536 which is below

536.faultsim_restore_and_reopen

I included the file multiplex.test for further details.

Can anyone kindly tell what is the function of "faultsim_restore_and_reopen"
and why the error might have occurred?




pfa.


[sqlite] faultsim_restore_and_reopen

2015-06-26 Thread Sairam Gaddam
I was testing a custom build of SQLite by the test scripts which are
present in test folder of SQLite, some of the test scripts like
multiplex.test, wal4.test etc., have this line
faultsim_restore_and_reopen
which results in error.

Can anyone kindly tell what is the function of "faultsim_restore_and_reopen"
and why the error might have occurred?


[sqlite] Will SQLite break a join query?

2015-06-26 Thread Sairam Gaddam
I know that SQLite will perform some internal select statements when
executing a join query but will it break a join query and execute in parts
???

For example if I join 10 tables, will it perform join of 8 and 2 tables at
once and in turn join the result of those two joins?


[sqlite] Error while copying the contents of VdbeOp object

2015-05-29 Thread Sairam Gaddam
How to correctly copy the contents of original VdbeOp aOp which is created
by SQlite for some query into another custom VdbeOp object.

I tried by normally copying the contents one by one but it resulted in
errors.

And how to correctly allocate memory to the custom VdbeOp object and how to
free the original aOp.

So can anyone suggest me the correct way of doing those ?




Thanks in advance.


[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Sairam Gaddam
On Fri, May 15, 2015 at 4:46 PM, Hick Gunter  wrote:

> The keyword "static" before a function name limits its visibility to the
> current source file.
>
> But many of the PRIVATE functions are not declared static like the 
> "sqlite3VdbePrintOp"
function.
If they do declare, can i know where they did that?


[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Sairam Gaddam
On Fri, May 15, 2015 at 4:42 PM, Simon Slavin  wrote:
>
>
> By not declaring them in the header file you're meant to be using ?
>

But I think they are declared in the header.

>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Sairam Gaddam
On Fri, May 15, 2015 at 3:53 PM, Hick Gunter  wrote:

> SQLITE_PRIVATE means that the function is PRIVATE.


How they achieved PRIVATE functions in C?

You are not allowed to call this function, it is not supported as part of
> the SQLite API. Because you are not allowed to call the function directly,
> it is not made available to the linker.
>

How those functions are made invisible to the linker?


[sqlite] Tests regarding custom build of SQLite

2015-05-13 Thread Sairam Gaddam
In order to run .test files(sqlite test codes) in SQLite, I used

 ./testfixture NAMEOFFILE.test

Can anyone kindly tell which build of sqlite will TESTFIXTURE access?

Because even when I make modifications to sqlite3.c source code, the output
of the test file under test has no effect.


And one more question is that, In order to test my custom build of
sqlite3.c,
I installed both TCL and SQLite, and gave the command ./configure
After that the source file sqlite3.c file is formed and I replaced the
original sqlite3.c file with my customized sqlite3.c with the same name.
But when I ran make test command, the program again replaces my customized
sqlite3.c with the original sqlite3.c source file and tests it. So I am not
able to run tests on my modified file. So can anyone tell why it replaces
with original file and what to do in order to test my custom build.


[sqlite] TCL tests

2015-05-12 Thread Sairam Gaddam
On Tue, May 12, 2015 at 5:14 PM, Richard Hipp  wrote:
>
>
> ./testfixture NAMEOFFILE.test
> testfixture.exe NAMEOFFILE.test
>
> Respectively for unix and windows.
>
> Thanks! That helped a lot.


[sqlite] TCL tests

2015-05-12 Thread Sairam Gaddam
On Tue, May 12, 2015 at 5:05 PM, Richard Hipp  wrote:
>
>
> Did you try the commands provided above?
>
>
> yeah I tried those commands and installed both tcl and sqlite but i need
help in executing the .test file which requires tcl like the one I attached
in this mail.

pfa.


[sqlite] TCL tests

2015-05-12 Thread Sairam Gaddam
On Tue, May 12, 2015 at 4:36 PM, Richard Hipp  wrote:

>
> Unix:   ./configure; make test
>
> Windows:   nmake /f makefile.msc test
>

I installed both tcl and sqlite but i need help to run .test files which
are present in test folder for sqlite!


[sqlite] TCL tests

2015-05-12 Thread Sairam Gaddam
But when I tried to run the following message/error pops up :


invalid command name "sqlite3_test_control_pending_byte"
while executing
"sqlite3_test_control_pending_byte 0x001"
(file "./tester.tcl" line 92)
invoked from within
"source $testdir/tester.tcl"
(file "attach.test" line 19)

How to overcome this ?

On Tue, May 12, 2015 at 12:25 PM, Arjen Markus 
wrote:

> Hi Sairam,
>
>
>
> That ought to be easy:
>
>
>
> tclsh name-of-test-file.test
>
>
>
> You will need an installation of Tcl, but these are easy to find. One
> place is at ActiveState's site, www.activestate.com/activetcl<
> http://www.activestate.com/activetcl>, but it may be that you already
> have it on your system.
>
>
>
> Regards,
>
>
>
> Arjen
>
>
>
> > -Original Message-----
> > From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-
> > bounces at mailinglists.sqlite.org] On Behalf Of Sairam Gaddam
> > Sent: Tuesday, May 12, 2015 8:47 AM
> > To: General Discussion of SQLite Database
> > Subject: [sqlite] TCL tests
> >
> > Can anyone kindly help me how to compile and run TCL test scripts ?
> > All the test scripts are .test files and I need help in executing them.
> > ___
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
>
> DISCLAIMER: This message is intended exclusively for the addressee(s) and
> may contain confidential and privileged information. If you are not the
> intended recipient please notify the sender immediately and destroy this
> message. Unauthorized use, disclosure or copying of this message is
> strictly prohibited. The foundation 'Stichting Deltares', which has its
> seat at Delft, The Netherlands, Commercial Registration Number 41146461, is
> not liable in any way whatsoever for consequences and/or damages resulting
> from the improper, incomplete and untimely dispatch, receipt and/or content
> of this e-mail.
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] TCL tests

2015-05-12 Thread Sairam Gaddam
Can anyone kindly help me how to compile and run TCL test scripts ?
All the test scripts are .test files and I need help in executing them.


[sqlite] Testing problem

2015-05-08 Thread Sairam Gaddam
I installed TCL and then unpacked the SQLite archive, then typed
"./configure; make test"
what to do next?

On Fri, May 8, 2015 at 6:13 PM, Richard Hipp  wrote:

> On 5/8/15, Sairam Gaddam  wrote:
> > Is sqllogictest a program which can be downloaded and installed?
>
> https://www.sqlite.org/sqllogictest/doc/trunk/about.wiki
>
>
> >
> > On Fri, May 8, 2015 at 5:21 PM, Richard Hipp  wrote:
> >
> >> On 5/8/15, Sairam Gaddam  wrote:
> >> > I have custom SQLite and in order to test it I downl
> >> > oaded sqlite-src-3081000.zip
> >> > (7.29 MiB) as advised, which contains some test files but most of them
> >> are
> >> > .test files and how to execute them? should I use sqllogictest
> program?
> >> If
> >> > it should be used where is it available?
> >>
> >> The main public SQLite test suite makes extensive use of TCL.
> >> (http://tcl.tk/).  On unix or Windows workstations, you simply install
> >> TCL then unpack the SQLite archive, then type "./configure; make test"
> >> on unix or Windows with MinGW/Msys or "nmake /f Makefile.msc test"
> >> under Windows with MSVC.
> >>
> >> If you are on an embedded system that does not have the infrastructure
> >> to support TCL, then you could (as you observe) try to run
> >> sqllogictest, which is written in C.  But that test suite is really
> >> only designed to show that SQLite generates the same results as other
> >> database engines for given SQL statements.  So it does not test things
> >> like file I/O or transactions or non-universal features such as
> >> partial indexes, common table expression, virtual tables, etc.
> >>
> >> The TH3 test suite is plain C code that provides 100% MC/DC is
> >> designed to run on embedded systems with minimal support
> >> infrastructure.  But TH3 is proprietary and is used under license
> >> only.  See https://sqlite.org/th3.html for additional information.
> >>
> >> >
> >> > And regarding .c test files some of them require tcl.h file which i
> >> > could
> >> > not find ! I followed the steps given at the starting of each file but
> >> > i
> >> > dont find them useful.
> >> > can anyone help me regarding this?
> >> > ___
> >> > sqlite-users mailing list
> >> > sqlite-users at mailinglists.sqlite.org
> >> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >> >
> >>
> >>
> >> --
> >> D. Richard Hipp
> >> drh at sqlite.org
> >> ___
> >> sqlite-users mailing list
> >> sqlite-users at mailinglists.sqlite.org
> >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >>
> > ___
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
> --
> D. Richard Hipp
> drh at sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Testing problem

2015-05-08 Thread Sairam Gaddam
Is sqllogictest a program which can be downloaded and installed?

On Fri, May 8, 2015 at 5:21 PM, Richard Hipp  wrote:

> On 5/8/15, Sairam Gaddam  wrote:
> > I have custom SQLite and in order to test it I downl
> > oaded sqlite-src-3081000.zip
> > (7.29 MiB) as advised, which contains some test files but most of them
> are
> > .test files and how to execute them? should I use sqllogictest program?
> If
> > it should be used where is it available?
>
> The main public SQLite test suite makes extensive use of TCL.
> (http://tcl.tk/).  On unix or Windows workstations, you simply install
> TCL then unpack the SQLite archive, then type "./configure; make test"
> on unix or Windows with MinGW/Msys or "nmake /f Makefile.msc test"
> under Windows with MSVC.
>
> If you are on an embedded system that does not have the infrastructure
> to support TCL, then you could (as you observe) try to run
> sqllogictest, which is written in C.  But that test suite is really
> only designed to show that SQLite generates the same results as other
> database engines for given SQL statements.  So it does not test things
> like file I/O or transactions or non-universal features such as
> partial indexes, common table expression, virtual tables, etc.
>
> The TH3 test suite is plain C code that provides 100% MC/DC is
> designed to run on embedded systems with minimal support
> infrastructure.  But TH3 is proprietary and is used under license
> only.  See https://sqlite.org/th3.html for additional information.
>
> >
> > And regarding .c test files some of them require tcl.h file which i could
> > not find ! I followed the steps given at the starting of each file but i
> > dont find them useful.
> > can anyone help me regarding this?
> > ___
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
> --
> D. Richard Hipp
> drh at sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Testing problem

2015-05-08 Thread Sairam Gaddam
I have custom SQLite and in order to test it I downl
oaded sqlite-src-3081000.zip
(7.29 MiB) as advised, which contains some test files but most of them are
.test files and how to execute them? should I use sqllogictest program? If
it should be used where is it available?

And regarding .c test files some of them require tcl.h file which i could
not find ! I followed the steps given at the starting of each file but i
dont find them useful.
can anyone help me regarding this?


[sqlite] Regarding testing

2015-04-27 Thread Sairam Gaddam
Yeah I read that link previously but how do i get all those test cases?

On Mon, Apr 27, 2015 at 5:27 PM, Simon Slavin  wrote:

>
> On 27 Apr 2015, at 12:54pm, Sairam Gaddam  wrote:
>
> > How SQLite is tested and can I get those test cases?
>
> <
> http://lmgtfy.com/?q=How+SQLite+is+tested+and+can+I+get+those+test+cases%3F
> >
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Regarding testing

2015-04-27 Thread Sairam Gaddam
How SQLite is tested and can I get those test cases?


[sqlite] Comments in VDBE program

2015-04-16 Thread Sairam Gaddam
Thanks! Comments are enabled now.

On Thu, Apr 16, 2015 at 4:41 PM, Richard Hipp  wrote:

> On 4/16/15, Sairam Gaddam  wrote:
> > I am using C SQLite interface. How to enable comments in the VDBE program
> > here?
> > because they are not enabled by default.
> > gcc -DSQLITE -DEBUG filename.c ../sqlite3.c -ldl -lpthread
> > I tried with the above line in the terminal but could not succeed in
> > enabling the comments. Can any one help me with this?
> > I am using Linux 64 bit machine.
>
> Add -DSQLITE_ENABLE_EXPLAIN_COMMENTS to the compiler command-line.
>
> > ___
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
> --
> D. Richard Hipp
> drh at sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Comments in VDBE program

2015-04-16 Thread Sairam Gaddam
I am using C SQLite interface. How to enable comments in the VDBE program
here?
because they are not enabled by default.
gcc -DSQLITE -DEBUG filename.c ../sqlite3.c -ldl -lpthread
I tried with the above line in the terminal but could not succeed in
enabling the comments. Can any one help me with this?
I am using Linux 64 bit machine.


[sqlite] Regarding SeekGe and Next opcodes in VDBE

2015-04-10 Thread Sairam Gaddam
Yes sir, I know about " .explain ". Next time I would try that @ Richard
Hipp.
And thanks Clemens.

On Fri, Apr 10, 2015 at 3:57 PM, Clemens Ladisch  wrote:

> Sairam Gaddam wrote:
> > On Thu, Apr 9, 2015 at 1:04 PM, Clemens Ladisch 
> wrote:
> >> Sairam Gaddam wrote:
> >>> sql="create table em(name text primary key,age text,pts text);"\
> >>> "create table l(name text primary key,fame text);";
> >>>
> >>> sql = "select * from em,l where l.fame=em.age";
> >>>
> >>>4 Once 0   130   00
> >>>5 OpenAutoindex230 k(3,nil,nil,nil) 00
> >>>6 Rewind   1   130   00
> >>>7 Column   112   00
> >>>8 Column   103   00
> >>>9 Rowid140   00
> >>>   10 MakeRecord   231   00
> >>>   11 IdxInsert210   10
> >>>   12 Next 170   03
> >>>   13 Column   015   00
> >>>   14 IsNull   5   240   00
> >>>   15 SeekGE   2   245 1 00
> >>>   16 IdxGT2   245 1 00
> >>>   17 Column   006   00
> >>>   18 Copy 570   00
> >>>   19 Column   028   00
> >>>   20 Column   219   00
> >>>   21 Column   20   10   00
> >>>   22 ResultRow650   00
> >>>   23 Next 2   160   00
> >>>   24 Next 040   01
> >>>   ...
> >>>
> >>> whenever the condition in the where clause is false, the program jumps
> to
> >>> the instruction pointed by p2 of SeekGe
> >>
> >> Yes.
> >>
> >>> but if the condition proves to be false for the row 1 of both the
> >>> tables, then the program jumps to line 24(in this case) which
> >>> corresponds to outer table and takes the second row of outer table
> >>> for next iteration, then when will the program fetch 1st row
> >>> of table-1 and remaining rows of table-2 ???
> >>
> >> In the join loop, this VDBE program does not fetch any rows from the
> >> second table:
> >>
> >>   explain query plan select * from em,l where l.fame=em.age;
> >>   0|0|0|SCAN TABLE em
> >>   0|1|1|SEARCH TABLE l USING AUTOMATIC COVERING INDEX (fame=?)
> >>
> >> All accesses to "l" are actually handled by the temporary index (which
> >> is created by instructions 5..12).  One index search is enough to
> >> determine whether a fame value exists.
> >
> > Then why there is a loop (Next opcode at 23rd instruction) over second
> > table when it created an index ?
>
> Because there might be multiple index entries with the same fame value.
>
>
> Regards,
> Clemens
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Regarding SeekGe and Next opcodes in VDBE

2015-04-10 Thread Sairam Gaddam
Then why there is a loop (Next opcode at 23rd instruction) over second
table when it created an index ?

On Thu, Apr 9, 2015 at 1:04 PM, Clemens Ladisch  wrote:

> Sairam Gaddam wrote:
> > sql="create table em(name text primary key,age text,pts text);"\
> > "create table l(name text primary key,fame text);";
> >
> > sql = "select * from em,l where l.fame=em.age";
> >
> >4 Once 0   130   00
> >5 OpenAutoindex230 k(3,nil,nil,nil) 00
> >6 Rewind   1   130   00
> >7 Column   112   00
> >8 Column   103   00
> >9 Rowid140   00
> >   10 MakeRecord   231   00
> >   11 IdxInsert210   10
> >   12 Next 170   03
> >   13 Column   015   00
> >   14 IsNull   5   240   00
> >   15 SeekGE   2   245 1 00
> >   16 IdxGT2   245 1 00
> >   17 Column   006   00
> >   18 Copy 570   00
> >   19 Column   028   00
> >   20 Column   219   00
> >   21 Column   20   10   00
> >   22 ResultRow650   00
> >   23 Next 2   160   00
> >   24 Next 040   01
> >   ...
> >
> > whenever the condition in the where clause is false, the program jumps to
> > the instruction pointed by p2 of SeekGe
>
> Yes.
>
> > but if the condition proves to be false for the row 1 of both the
> > tables, then the program jumps to line 24(in this case) which
> > corresponds to outer table and takes the second row of outer table
> > for next iteration, then when will the program fetch 1st row
> > of table-1 and remaining rows of table-2 ???
>
> In the join loop, this VDBE program does not fetch any rows from the
> second table:
>
>   explain query plan select * from em,l where l.fame=em.age;
>   0|0|0|SCAN TABLE em
>   0|1|1|SEARCH TABLE l USING AUTOMATIC COVERING INDEX (fame=?)
>
> All accesses to "l" are actually handled by the temporary index (which
> is created by instructions 5..12).  One index search is enough to
> determine whether a fame value exists.
>
>
> Regards,
> Clemens
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Regarding SeekGe and Next opcodes in VDBE

2015-04-09 Thread Sairam Gaddam
//create table
sql="create table em(name text primary key,age text,pts text);"\
"create table l(name text primary key,fame text);";

//insert values
sql="insert into em values(44,20,1);"\
"insert into em values(11,20,2);"\
"insert into em values(5,21,3);"\
"insert into l values(11,11);"\
"insert into l values(12,20);"\
 "insert into l values(1,20);";

//query
sql = "select * from em,l where l.fame=em.age";

Below is a sample VDBE program:

   0 Init 0   270   00
   1 OpenRead 020 3 00
   2 OpenRead 1   150 2 00
   3 Rewind   0   250   00
   4 Once 0   130   00
   5 OpenAutoindex230 k(3,nil,nil,nil) 00
   6 Rewind   1   130   00
   7 Column   112   00
   8 Column   103   00
   9 Rowid140   00
  10 MakeRecord   231   00
  11 IdxInsert210   10
  12 Next 170   03
  13 Column   015   00
  14 IsNull   5   240   00
  15 SeekGE   2   245 1 00
  16 IdxGT2   245 1 00
  17 Column   006   00
  18 Copy 570   00
  19 Column   028   00
  20 Column   219   00
  21 Column   20   10   00
  22 ResultRow650   00
  23 Next 2   160   00
  24 Next 040   01
  25 Close000   00
  26 Halt 000   00
  27 Transaction  00 48833 0 01
  28 TableLock020 em00
  29 TableLock0   150 l 00
  30 Goto 010   00

Question:
whenever the condition in the where clause is false, the program jumps to
the instruction pointed by p2 of SeekGe but if the condition proves to be
false for the row 1 of both the tables, then the program jumps to line
24(in this case) which corresponds to outer table and takes the second row
of outer table for next iteration, then when will the program fetch 1st row
of table-1 and remaining rows of table-2 ???


[sqlite] Clarification regarding Next opcode !

2015-03-20 Thread Sairam Gaddam
What Next opcode does is advance cursor P1 so that it points to the next
key/data pair in its table or index. If there are no more key/value pairs
then fall through to the following instruction.

But i have a program where i need clarification regarding its operation
(I inserted printf statement in Next opcode which will print next followed
by program counter value - printf("in next %d\n",pc);)


//create table
sql="create table em(name int primary key,age int);"\
"create table idv(id int primary key,name text);"\
"create table l(name int primary key,fame int);";

sql="insert into em values(44,21);"\
"insert into em values(11,20);"\
"insert into em values(5,21);"\
"insert into idv values(11,44);"\
"insert into idv values(44,11);"\
"insert into idv values(5,180);"\
"insert into l values(11,11);"\
"insert into l values(12,20);"\
"insert into l values(1,20);";

sql="select * from l,em,idv where l.fame=em.age";

vdbe:

   0 Init 0   330   00
   1 OpenRead 0   110 2 00
   2 OpenRead 250 2 00
   3 OpenRead 120 2 00
   4 Rewind   0   300   00
   5 Rewind   2   290   00
   6 Once 0   150   00
   7 OpenAutoindex330 k(3,nil,nil,nil) 00
   8 Rewind   1   150   00
   9 Column   112   00
  10 Column   103   00
  11 Rowid140   00
  12 MakeRecord   231   00
  13 IdxInsert310   10
  14 Next 190   03
  15 Column   015   00
  16 IsNull   5   280   00
  17 Affinity 510 D 00
  18 SeekGE   3   285 1 00
  19 IdxGT3   285 1 00
  20 Column   006   00
  21 Column   017   00
  22 Column   318   00
  23 Column   309   00
  24 Column   20   10   00
  25 Column   21   11   00
  26 ResultRow660   00
  27 Next 3   190   00
  28 Next 260   01
  29 Next 050   01
  30 Close000   00
  31 Close200   00
  32 Halt 000   00
  33 Transaction  00 45819 0 01
  34 TableLock0   110 l 00
  35 TableLock050 idv   00
  36 TableLock020 em00
  37 Goto 010   00

result:

in next 14
in next 14
in next 14
in next 28
in next 28
in next 28
in next 29
12,20,11,20,11,44.
in next 27
in next 28
12,20,11,20,44,11.
in next 27
in next 28
12,20,11,20,5,180.
in next 27
in next 28
in next 29
1,20,11,20,11,44.
in next 27
in next 28
1,20,11,20,44,11.
in next 27
in next 28
1,20,11,20,5,180.
in next 27
in next 28
in next 29

Here i dont know the behaviour of Next opcode at 27 because whenever it
comes to that opcode it goes to Next opcode at 28.


[sqlite] regarding loops in vdbe code

2015-03-17 Thread Sairam Gaddam
  0 000  NULL
> 10Transaction1 0 000  NULL
> 11VerifyCookie   1 1 000  NULL
> 12TableLock  1 2 0 a  00  NULL
> 13Goto   0 3 000  NULL
>
> explain select * from a join b on a.rowid=b.a_rowid where b.f2 = 1;
> addr  opcode p1p2p3p4 p5  comment
>   -        -  --  -
> 0 Trace  0 0 000  NULL
> 1 Integer1 1 000  NULL
> 2 Goto   0 19000  NULL
> 3 OpenRead   1 3 1 2  00  b
> 4 OpenRead   0 2 1 1  00  a
> 5 Rewind 1 16000  NULL
> 6 Column 1 1 200  b.f2
> 7 Ne 1 152 collseq(BINARY)  6c  NULL
> 8 Column 1 0 300  b.a_rowid
> 9 MustBeInt  3 15000  NULL
> 10NotExists  0 15300  pk
> 11Column 0 0 400  a.f1
> 12Column 1 0 500  b.a_rowid
> 13Column 1 1 600  b.f2
> 14ResultRow  4 3 000  NULL
> 15Next   1 6 001  NULL
> 16Close  1 0 000  NULL
> 17Close  0 0 000  NULL
> 18Halt   0 0 000  NULL
> 19Transaction1 0 0        00  NULL
> 20VerifyCookie   1 2 000  NULL
> 21TableLock  1 3 0 b  00  NULL
> 22TableLock  1 2 0 a  00  NULL
> 23Goto   0 3 000  NULL
>
> -Urspr?ngliche Nachricht-
> Von: Sairam Gaddam [mailto:gaddamsairam at gmail.com]
> Gesendet: Dienstag, 17. M?rz 2015 12:26
> An: General Discussion of SQLite Database
> Betreff: [sqlite] regarding loops in vdbe code
>
> When joining a table in sqlite with some condition using where clause,
> sqlite sometimes generate less number of loops(Next opcodes) than the
> number of tables.
> Can anyone explain how sqlite iterates through all the tables when it has
> less number of loops.
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___
>  Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0
> E-Mail: hick at scigames.at
>
> This communication (including any attachments) is intended for the use of
> the intended recipient(s) only and may contain information that is
> confidential, privileged or legally protected. Any unauthorized use or
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please immediately notify the sender
> by return e-mail message and delete all copies of the original
> communication. Thank you for your cooperation.
>
>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] regarding loops in vdbe code

2015-03-17 Thread Sairam Gaddam
When joining a table in sqlite with some condition using where clause,
sqlite sometimes generate less number of loops(Next opcodes) than the
number of tables.
Can anyone explain how sqlite iterates through all the tables when it has
less number of loops.


[sqlite] regarding loops in joins(VDBE)

2015-03-09 Thread Sairam Gaddam
I am trying to understand how sqlite joins execute and this is just a
simple example.

Can you please elaborate a bit on the index look up part ?
How is sqlite navigating the cursor to point to the rows of other table
with out a loop ?
How does index look up work without looping  as indexes are also
represented by cursor ?

On Mon, Mar 9, 2015 at 4:37 PM, Hick Gunter  wrote:

> Are you trying to create tables with INTEGER PRIMARY KEY? You have to
> write EXACTLY "integer primary key" (not case specific) to achieve this.
> The em <=> lo join would probably profit from this.
>
> Your join specifies to compare em.name (a column with numeric affinity)
> to idv.name (a column with text affinity); this will force SQLite to
> convert one of the fields for the conversion. Is this what you intended?
>
> Maybe you should try to "EXPLAIN QUERY PLAN" to find out what SQLite plans
> to do.
>
> From a quick look at the VDBE code it is clearly choosing to scan your em
> table and access the lo and idv tables via index lookup. If either of the
> index lookups were not UNIQUE, there would be an inner loop to resolve the
> join.
>
> Since em.name and lo.name are matching primary keys, why the two tables?
> Which other entity has a lo(cation)? And how are you going to keep that
> other entity from assigning conflicting keys (i.e. those already used for
> em entries)?
>
> Are you sure the em(ployee)'s name is an integer?
>
> -Urspr?ngliche Nachricht-
> Von: Sairam Gaddam [mailto:gaddamsairam at gmail.com]
> Gesendet: Montag, 09. M?rz 2015 11:40
> An: General Discussion of SQLite Database
> Betreff: [sqlite] regarding loops in joins(VDBE)
>
> sir,
> I have a join query with 3 tables and 2 conditions in the where
> clause.But the program executes by opening single loop.Can any one know how
> is executes?
>
> I have included the query and the vdbe program in the link below:
> http://pastebin.com/aA3QSJ7w
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___
>  Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0
> E-Mail: hick at scigames.at
>
> This communication (including any attachments) is intended for the use of
> the intended recipient(s) only and may contain information that is
> confidential, privileged or legally protected. Any unauthorized use or
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please immediately notify the sender
> by return e-mail message and delete all copies of the original
> communication. Thank you for your cooperation.
>
>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] regarding loops in joins(VDBE)

2015-03-09 Thread Sairam Gaddam
sir,
I have a join query with 3 tables and 2 conditions in the where
clause.But the program executes by opening single loop.Can any one know how
is executes?

I have included the query and the vdbe program in the link below:
http://pastebin.com/aA3QSJ7w


[sqlite] Regarding creating a mem object and copying contents to it in SQLite

2015-02-25 Thread Sairam Gaddam
Yaa we work together and we need some assistance regarding that.

On Wed, Feb 25, 2015 at 1:18 PM, Hick Gunter  wrote:

> Maybe you would like to exchange experiences with Prakash Premkumar <
> prakash.prax at gmail.com> about hacking SQLite internals.
>
> -Urspr?ngliche Nachricht-----
> Von: Sairam Gaddam [mailto:gaddamsairam at gmail.com]
> Gesendet: Mittwoch, 25. Februar 2015 08:23
> An: General Discussion of SQLite Database
> Betreff: Re: [sqlite] Regarding creating a mem object and copying contents
> to it in SQLite
>
> I am trying to optimize certain operations of SQLite internally, so i
> created mem object.
>
> On Wed, Feb 25, 2015 at 12:36 PM, Hick Gunter  wrote:
>
> > The mem object is internal to sqlite, it is not intended to be
> > created/changed by user code.
> >
> > What are you trying to do that makes you think you need to manipulate
> > internal structures?
> >
> > -Urspr?ngliche Nachricht-
> > Von: Sairam Gaddam [mailto:gaddamsairam at gmail.com]
> > Gesendet: Mittwoch, 25. Februar 2015 07:41
> > An: sqlite-users at sqlite.org
> > Betreff: [sqlite] Regarding creating a mem object and copying contents
> > to it in SQLite
> >
> > hello,
> >  I created a mem object in SQLite and copied a string value to
> > its member and i initialized some other members to default values
> > manually, it worked well but some times it shows realloc() error.
> >  I also found a function sqlite3VdbeMemSetStr() which will
> > copy the string value into new mem but even it fails sometimes.
> > So what is the correct way of creating a mem object and
> > copying a string to its member so that SQLite will work
> fruitfully.Anyone know???
> > ___
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
> > ___
> >  Gunter Hick
> > Software Engineer
> > Scientific Games International GmbH
> > FN 157284 a, HG Wien
> > Klitschgasse 2-4, A-1130 Vienna, Austria
> > Tel: +43 1 80100 0
> > E-Mail: hick at scigames.at
> >
> > This communication (including any attachments) is intended for the use
> > of the intended recipient(s) only and may contain information that is
> > confidential, privileged or legally protected. Any unauthorized use or
> > dissemination of this communication is strictly prohibited. If you
> > have received this communication in error, please immediately notify
> > the sender by return e-mail message and delete all copies of the
> > original communication. Thank you for your cooperation.
> >
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___
>  Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0
> E-Mail: hick at scigames.at
>
> This communication (including any attachments) is intended for the use of
> the intended recipient(s) only and may contain information that is
> confidential, privileged or legally protected. Any unauthorized use or
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please immediately notify the sender
> by return e-mail message and delete all copies of the original
> communication. Thank you for your cooperation.
>
>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Regarding creating a mem object and copying contents to it in SQLite

2015-02-25 Thread Sairam Gaddam
I am trying to optimize certain operations of SQLite internally, so i
created mem object.

On Wed, Feb 25, 2015 at 12:36 PM, Hick Gunter  wrote:

> The mem object is internal to sqlite, it is not intended to be
> created/changed by user code.
>
> What are you trying to do that makes you think you need to manipulate
> internal structures?
>
> -Urspr?ngliche Nachricht-
> Von: Sairam Gaddam [mailto:gaddamsairam at gmail.com]
> Gesendet: Mittwoch, 25. Februar 2015 07:41
> An: sqlite-users at sqlite.org
> Betreff: [sqlite] Regarding creating a mem object and copying contents to
> it in SQLite
>
> hello,
>  I created a mem object in SQLite and copied a string value to its
> member and i initialized some other members to default values manually, it
> worked well but some times it shows realloc() error.
>  I also found a function sqlite3VdbeMemSetStr() which will copy
> the string value into new mem but even it fails sometimes.
> So what is the correct way of creating a mem object and copying a
> string to its member so that SQLite will work fruitfully.Anyone know???
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___
>  Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0
> E-Mail: hick at scigames.at
>
> This communication (including any attachments) is intended for the use of
> the intended recipient(s) only and may contain information that is
> confidential, privileged or legally protected. Any unauthorized use or
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please immediately notify the sender
> by return e-mail message and delete all copies of the original
> communication. Thank you for your cooperation.
>
>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Regarding creating a mem object and copying contents to it in SQLite

2015-02-25 Thread Sairam Gaddam
hello,
 I created a mem object in SQLite and copied a string value to its
member and i initialized some other members to default values manually, it
worked well but some times it shows realloc() error.
 I also found a function sqlite3VdbeMemSetStr() which will copy the
string value into new mem but even it fails sometimes.
So what is the correct way of creating a mem object and copying a
string to its member so that SQLite will work fruitfully.Anyone know???


[sqlite] regarding looping in vdbe for sqlite table joins!

2015-02-02 Thread Sairam Gaddam
Normally for executing joins in sqlite,the vdbe program opens 1 loop for
each and every table but in my code(attached that file via pastebin) ,i am
facing an issue because it is opening only 2 loops even if i use 4 tables
 in joining operation.

can anyone explain why it happened like that and loops for which tables got
opened?


code : http://pastebin.com/PHV4K4Hh
___
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.

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


[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