Re: [sqlite] Are tclsqlite.dll and tclsqliet3.dll supposed to be usable in the same script?

2005-09-11 Thread D. Richard Hipp
On Sat, 2005-09-10 at 21:37 -0700, Gerry Snyder wrote:
> 2) The behavior is as expected, 
> and there are good reasons why loading 3 then 2 works but loading 2
> then 
> 3 doesn't, and such behavior can be counted on in future releases of 
> version 3.

Two is correct.  You have to load version 3 of the TCL bindings
first, then version 2.
-- 
D. Richard Hipp <[EMAIL PROTECTED]>



[sqlite] Are tclsqlite.dll and tclsqliet3.dll supposed to be usable in the same script?

2005-09-10 Thread Gerry Snyder
I remember reading that the C libraries of both versions can be used in 
the same executable, and I may have drawn the incorrect conclusion that 
the TCL bindings can be used together, too.


Below is a listing that shows the problem, but in a nutshell, it seems 
that loading version 3 after version 2 corrupts the former:


$ tclsh
% load tclsqlite.dll
% sqlite sq mydb.sq2
0x01093E70
% sq eval "select sql from sqlite_master"
{create table a(b,c)}
% load tclsqlite3.dll
conflicting versions provided for package "sqlite": 2.0, then 3.0
% sq eval "select sql from sqlite_master"
{create table a(b,c)}
% sqlite3 sq3 mydb.sq3
0x01096980
% sq3 eval "select sql from sqlite_master"
{CREATE TABLE d(e,f)}
% sqlite sq mydb.sq2
0x0109E178
% sq eval "select sql from sqlite_master"
file is encrypted or is not a database

From the above it appears that the[sq] command created by using 
[sqlite] still works after loading version 3, but [sqlite] gets messed 
up and can no longer create a new sq.


If the .dll files are loaded in the other order, both versions still 
seem to work:


$ tclsh
% load tclsqlite3.dll
% load tclsqlite.dll
conflicting versions provided for package "sqlite": 3.0, then 2.0
% sqlite sq mydb.sq2
0x01093E70
% sq eval "select sql from sqlite_master"
{create table a(b,c)}
% sqlite3 sq3 mydb.sq3
0x01096980
% sq3 eval "select sql from sqlite_master"
{CREATE TABLE d(e,f)}

I can see at least a couple possibilities: 1) There is a fundamental 
incompatibility, and further testing would show that the seeming success 
of the second example is just a fluke. 2) The behavior is as expected, 
and there are good reasons why loading 3 then 2 works but loading 2 then 
3 doesn't, and such behavior can be counted on in future releases of 
version 3. 3) The two should behave properly no matter which order they 
are loaded in, and I have found an error.


I am hoping the answer is not 1), because I am planning to try to add a 
conversion routine (2->3 and 3->2) to my TCL/TK/SQLite utility.


TIA for any help,

Gerry
--
--
Gerry Snyder
American Iris Society Director, Symposium Chair
in warm, winterless Los Angeles -- USDA zone 9b, Sunset 18-19