Hi All,

Can anybody look in to my query below and suggest me something helpful!

With Best Regards
Gaurav Sharma

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Sharma, Gaurav
Sent: Monday, July 20, 2009 11:57 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] Use of attach database

Hi All,

I assume, it's the right place to send this mail regarding some issues that I 
have notice while using sqlite latest version 3.6.16.
I have recently moved from sqlite version 3.6.1 to 3.6.16 and while executing 
the command "attach database ':memory:' as db2"  I experience the crash in my 
application. "db2" is an alias for my in memory database. The crash occures 
inside the function attachFunc( sqlite3_context *context,  int NotUsed,  
sqlite3_value **argv ) in the below code snippet at condition if( 
sqlite3StrICmp(z, zName)==0 ).
for(i=0; i<db->nDb; i++){
    char *z = db->aDb[i].zName;
    assert( z && zName );
    if( sqlite3StrICmp(z, zName)==0 ){
      zErrDyn = sqlite3MPrintf(db, "database %s is already in use", zName);
      goto attach_error;
    }
  }

When i is 0, z = "main" and zName = "db2" so its ok but when i is 1, z = NULL 
and zName = "db2" so sqlite3StrICmp crashes. Same situation occure while I use 
version 3.6.1 code but there the crash has been avoided by applying the 
condition if( z && zName && sqlite3StrICmp(z, zName)==0 ). In the new code 
condition for ( z && zName ) has been removed.

I am not sure, whether I am not using the current code properly or there is a 
bug in sqlite code. If, anyone can help me out of this situation, will be great.

Thanks in advance
Gaurav Sharma

The information contained in this electronic mail transmission 
may be privileged and confidential, and therefore, protected 
from disclosure. If you have received this communication in 
error, please notify us immediately by replying to this 
message and deleting it from your computer without copying 
or disclosing it.


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
The information contained in this electronic mail transmission 
may be privileged and confidential, and therefore, protected 
from disclosure. If you have received this communication in 
error, please notify us immediately by replying to this 
message and deleting it from your computer without copying 
or disclosing it.


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

Reply via email to