[sqlite] SQLite - Database disk size difference when tables copied

2012-08-23 Thread Madhur Kashyap
Hello Pavel,

> >* When I implement the same mechanism for saving the*> >* memory database 
> >back to disk, the size of disk file is 4x of the original*> >* disk file 
> >size.*
> What is "original disk file size" here? Is it an empty database,
> database with some data, database with exactly the same data you are
> restoring? If the latter then do you restore right over the existing
> data? If yes how?


The original database on disk was created from scratch in memory and saved
"backup" command in regular "tclsh". Afterwards it was restored using
CREATE TABLE in the EDA tool as mentioned below

dbcmd eval "CREATE TABLE '$tname' AS SELECT * FROM loadfrom.'$tname'"

Once it is restored in the EDA tool memory, it is saved back on disk using
the commands I mentioned in the first email.

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


[sqlite] SQLite - Database disk size difference when tables copied

2012-08-22 Thread Madhur Kashyap
Hello,

I am using Tcl Extension (TEA) of SQLite inside an EDA tool which supports
TCL User Shell. I have a strange problem that SQLite version 3.7.10 is
downgraded to 3.5.9 when I load the necessary .so files. Due to this change
the backup and restore commands are probably causing a core dump in the EDA
tool execution.

I have to implement save and restore capability for the memory database
used in the application. Restore I have implemented using traditional
method to first attach the disk database and then copy all tables listed in
sqlite_master table. When I implement the same mechanism for saving the
memory database back to disk, the size of disk file is 4x of the original
disk file size.

What is the reason for this size increase? What can I do to avoid this file
size increase? A long pending question - Why the version is getting
downgraded to 3.5.9 ? The Tcl version is 8.4.x within the EDA tool. Also I
cannot find any SQLite libraries within the tool installation.

dbcmd eval "ATTACH DATABASE 'test_disk.db' AS copyto"
set tableNames [ dbcmd eval {SELECT name FROM sqlite_master WHERE type
= 'table'} ]
foreach tname $tableNames {
dbcmd eval "CREATE TABLE copyto.$tname AS SELECT * FROM $tname"
}

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


[sqlite] SQLite TEA version downgrades when loaded.

2012-04-15 Thread Madhur Kashyap
Hello,

I had compiled TEA (Tcl Extension) on a standard RHEL5 image with Tcl 8.4
present in it as default. If I load the compiled .so file on a regular
tclsh the version shown is

% dbcmd version
3.7.10

But if I do the same on a commercial EDA tool which uses Tcl has the user
interface, it shows

encounter 8> dbcmd version
3.5.9

Furthermore, when I use "restore" command for a database created on tclsh
(presumably 3.7.10) on regular tclsh, it works well. But when I use the
same database on the commercial EDA tool shell, it causes the a core dump.
So, I have two queries

(1) What is the reason for this downgrading of version when loaded within
EDA tool shell ? And any hints on fixing this behavior ?
(2) Is the core dump issue related to above difference in versions ? Reason
I ask it is because, I tried a different approach to copy all tables
instead and it seems to work well. Though I did not try saving and
restoring from within EDA tool shell yet.

Thanks for your help !

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