Re: [sqlite] Segfault on second invalid command

2006-10-06 Thread Jim Dodgen

I do see you problem has gone aways on further emails.

the two versions do not interact. SQLite is mostly backward compatible 
that is you can use newer versions of the software on older versions of 
the database. But not the reverse.



Stephan Brunner wrote:

Hi Jim,

  

[description and sample perl script for segfault-problem]
  


  

This might be related to  DBD::SQLite 1.13 defaulting to SQLite 3.3.7?
I tend to try and keep my PERL and SQLite Command line at the same
version.



How do the two (commandline-version and DBD::SQLite) interact?
The only interaction that comes in my mind is that I created the database 
(test.db in the example) with the commandline-tool. If that causes the error 
(which I will check tonight), then 3.3.7 wouldn't be completely backwards 
compatible (not even for that simple DB)?

Or does DBD::SQLite link to the system-wide sqlite-libraries (I thought it 
brings its own libs) or interact in other ways?

Thanks for the hint, I will definitly check that! But I'm only partially 
hopeful...

Regards,
Stephan

  



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Segfault on second invalid command

2006-10-06 Thread Stephan Brunner
Am Donnerstag 05 Oktober 2006 22:25 schrieb Stephan Brunner:
> [description and sample perl script for segfault-problem]

I've been able to track the issue further down. I moved DBD::SQLite 1.13 away 
(it has been installed via the cpan shell as a dependency of DBIx::Class) and 
instead installed the standard ubuntu package libdbd-sqlite3-perl, which 
comes as version 1.11.
This version works fine for me - no more segfaults. The issue can be regarded 
as "solved" for this list, but I'll send the author of DBD::SQLite the link 
to this discussion.

Thanks for the great piece of software sqlite is!

Stephan

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Primay key trait is lost when copying across tables

2006-10-06 Thread Carradine


Dennis Cote wrote:
> 
> Carradine wrote:
>> Hello, I am attempting to simply copy a table with data from one database
>> to
>> abother database with the command:
>>
>> attach database 'DB.db3' AS V1
>>
>> CREATE TABLE Table1 AS SELECT * FROM V1.Table1
>>
>> The creation of the table, and the copying of the data works great. 
>> However, my ID field from the original database is an INTEGER PRIMARY
>> KEY,
>> but when the table gets copied over, it only becomes an INTEGER.
>>
>> Am I defining my SQL statements wrong?  Or am I going to have to use a
>> CREATE INDEX call when coying over my table?
>>
>>
>>   
> Carradine,
> 
> The types of the columns in a CREATE ... AS SELECT ... statement are 
> inferred from the result of the SELECT. You will need to create your new 
> table using the same  create statement used in the V1 database (i.e. the 
> one with the INTEGER PRIMARY KEY), and then do an INSERT ... SELECT  
> instead.
> 
> create table table1 as ();
> 
> attach database 'DB.db3' as V1;
> 
> begin;
> insert into table1 select * from V1.table1;
> commit;
> 
> HTH
> Dennis Cote
> 
> 

-
Thanks, that worked.  I wanted to get around doing the extra step of
re-defining the table, but I can live with it for now.
 

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



-- 
View this message in context: 
http://www.nabble.com/Primay-key-trait-is-lost-when-copying-across-tables-tf2397051.html#a6684691
Sent from the SQLite mailing list archive at Nabble.com.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Primay key trait is lost when copying across tables

2006-10-06 Thread Dennis Cote

Carradine wrote:

Hello, I am attempting to simply copy a table with data from one database to
abother database with the command:

attach database 'DB.db3' AS V1

CREATE TABLE Table1 AS SELECT * FROM V1.Table1

The creation of the table, and the copying of the data works great. 
However, my ID field from the original database is an INTEGER PRIMARY KEY,

but when the table gets copied over, it only becomes an INTEGER.

Am I defining my SQL statements wrong?  Or am I going to have to use a
CREATE INDEX call when coying over my table?


  

Carradine,

The types of the columns in a CREATE ... AS SELECT ... statement are 
inferred from the result of the SELECT. You will need to create your new 
table using the same  create statement used in the V1 database (i.e. the 
one with the INTEGER PRIMARY KEY), and then do an INSERT ... SELECT  
instead.


   create table table1 as ();

   attach database 'DB.db3' as V1;

   begin;
   insert into table1 select * from V1.table1;
   commit;

HTH
Dennis Cote




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Primay key trait is lost when copying across tables

2006-10-06 Thread Carradine

Hello, I am attempting to simply copy a table with data from one database to
abother database with the command:

attach database 'DB.db3' AS V1

CREATE TABLE Table1 AS SELECT * FROM V1.Table1

The creation of the table, and the copying of the data works great. 
However, my ID field from the original database is an INTEGER PRIMARY KEY,
but when the table gets copied over, it only becomes an INTEGER.

Am I defining my SQL statements wrong?  Or am I going to have to use a
CREATE INDEX call when coying over my table?


-- 
View this message in context: 
http://www.nabble.com/Primay-key-trait-is-lost-when-copying-across-tables-tf2397051.html#a6684143
Sent from the SQLite mailing list archive at Nabble.com.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Regarding sqlite3_exec

2006-10-06 Thread He Shiming

Hi List,
 If I use sqlite3_exec to query a database,
How can I know that the results in the data base got over. For example If
I am expecting a 10 results in some for loop and actually there are only
five results , How can I get a notification or return value that the
results completed or Is there any way I can get SQLITE_DONE through
sqlite3_Exec.  What return value I will get If I query an empty table.


Thanks and Regards,
 Vivek R



SQLite didn't provide a "get number of rows" function for the result set. It 
is mentioned in the document that sqlite3_exec is actually a wrapper for 
sqlite3_prepare and sqlite3_step. It is in my opinion that sqlite3_exec 
should only be used when the result of the query isn't that important. For 
instance, a pragma query. For the record, sqlite3_exec did provide a 
callback function in which you can count and get the number of rows in a 
resultset. The optimal way is that you prepare the statement, fetch and 
count the results with sqlite3_step.


Another thing I noticed from your question is that you might not want to 
"expect 10 results". It's not very wise to design a hard loop such as 
for(i=0;i<10;i++) when comes to a database query resultset. A better way 
would be to use an array to store the result set they way you could 
understand, and process them later. Then you'll have 
for(i=0;i

Best regards,
He Shiming 



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: Re: [sqlite] database corrouption during power failure

2006-10-06 Thread jayanth KP
Hi Richard,

   Sorry, i gave a wrong version number of sqlite . We are using sqlite 2.8.13.

OBSERVATIONS:
-

1) If i call sync() system call after database update, the database is not 
getting corrupted.

2) In one scenario of corruption sqlite_open() returned an error message "file 
is encrypted or is not a database".

3) In another scenario sqlite_open() did not detect the corruption. But any 
subsequent calls is not successful. For example if we start sqlite application 
and run .tables , nothing is returned.


Thanks and regards
Jayanth






  


On Fri, 06 Oct 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >I have a question regarding power failure handling in sqlite 2.8.3.
> >
> > When the power is switched off during  a database write like 
> > (insert/update), in next reboot database is getting corroupted.
> >
> > The database is in a ext3 partition on the harddisk (linux 2.6).
> >
> >
> > Also i tried the following in my c code after sqlite_open() was success.
> >
> > sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, &pErrMsg);
> >
> > This did not seem to work.
> >
> > Please help me in solving this issue
> >
>
>See http://www.sqlite.org/cvstrac/tktview?tn=599
>
>This problem was fixed in SQLite version 2.8.12, over two
>and a half years ago.
>
>--
>D. Richard Hipp  <[EMAIL PROTECTED]>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: [sqlite] Regarding removing create view and some other components in SQLite

2006-10-06 Thread G. Roderick Singleton
On Fri, 2006-10-06 at 12:10 +0530, Vivek R wrote:
>  Hi List,
>we have ported SQLite to one of our consumer products. We require some
> minimal applications only like creating and deleting table and Inserting ,
> Querying, deleting rows in a table. We want to reduce the code size So, We
> are planning to remove some of the features like create view and etc , as we
> are facing some memory problems Could you please suggest me what are the
> things to be done to remove the features like views and others ( which we
> usually not required) .
> 
> 

Hmm, after the work to put this in, you want it gone :-)  May I suggest
you check out http://sqlite.org/support.html particularly the
professional support section. All this assumes you do not have staff to
do the programming.
-- 
G. Roderick Singleton <[EMAIL PROTECTED]>
PATH tech


smime.p7s
Description: S/MIME cryptographic signature


Re: [sqlite] BEGIN TRANSACTION / COMMIT errors

2006-10-06 Thread Jay Sprenkle

On 10/5/06, Levi Wilson <[EMAIL PROTECTED]> wrote:

I have a process that opens up a connection to my database when it starts up
with sqlite3_open.  This connection is kept for the life of the process.  In
one of my functions, it inserts a row into one table, and also into another
table that is related.  Therefore, I wrap both statements within a "BEGIN
TRANSACTION" and finally a "COMMIT" if all is well.  However, if the second


do you have two BEGINs or just one? It should be only one.


statement fails, I roll it back.  This seems to work fine, althouth the
statements have not failed.  The problem that I'm having is if I open up the
database from "SQLite Database Browser.exe" (or even the command line
program, if I delete all of the items out of the first table, when I call my
function again to populate the two tables, the "BEGIN TRANSACTION" succeeds,
but after the call the "COMMIT" happens, I get an error from the resultset
that the database is missing or corrupt.  Does it have to do with my process
keeping the connection alive and the autocommit being on?  Any help would be
greatly appreciated, and please let me know if I have not been clear.
Thanks in advance!


Is your database version the same on both the generated code and the
browser tool? Sounds like it might be a version mis match. If you're using
a DLL or loaded library be sure you don't have two on your system and you;re
loading the wrong one.

Good luck


--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Turn on Pragma.

2006-10-06 Thread Andreas Weise

http://www.sqlite.org/pragma.html

Doesn't say it all?


2006/10/6, Vivek R <[EMAIL PROTECTED]>:


Hi List,
  can anybody explain me how to turn on the pragma for increasing the
performance.

Regardsm
Vivek R




Re: [sqlite] Regarding sqlite3_exec

2006-10-06 Thread Lloyd
I think you are asking for this... This is the case when we use
wxSQLite3.


wxSQLite3ResultSet result = samp.ExecuteQuery(wxT("select name,age from
test"));

  while (result.NextRow())
  {
   cout << (const char*)(result.GetString(0).mb_str()) << result.GetInt
(1)<< endl;
  }

On Fri, 2006-10-06 at 17:07 +0530, Vivek R wrote:
> Hi List,
>   If I use sqlite3_exec to query a database,
> How can I know that the results in the data base got over. For example If
> I am expecting a 10 results in some for loop and actually there are only
> five results , How can I get a notification or return value that the
> results completed or Is there any way I can get SQLITE_DONE through
> sqlite3_Exec.  What return value I will get If I query an empty table.
> 
> 
> Thanks and Regards,
>   Vivek R


__
Scanned and protected by Email scanner

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Regarding removing create view and some other components in SQLite

2006-10-06 Thread drh
"Vivek R" <[EMAIL PROTECTED]> wrote:
> Hi List,
>we have ported SQLite to one of our consumer products.

What consumer product?  Who do you work for?


> We require some
> minimal applications only like creating and deleting table and Inserting ,
> Querying, deleting rows in a table. We want to reduce the code size So, We
> are planning to remove some of the features like create view and etc , as we
> are facing some memory problems Could you please suggest me what are the
> things to be done to remove the features like views and others ( which we
> usually not required) .
> 

Compile with -DSQLITE_OMIT_VIEW=1

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Turn on Pragma.

2006-10-06 Thread Vivek R

Hi List,
  can anybody explain me how to turn on the pragma for increasing the
performance.

Regardsm
 Vivek R


[sqlite] Regarding sqlite3_exec

2006-10-06 Thread Vivek R

Hi List,
 If I use sqlite3_exec to query a database,
How can I know that the results in the data base got over. For example If
I am expecting a 10 results in some for loop and actually there are only
five results , How can I get a notification or return value that the
results completed or Is there any way I can get SQLITE_DONE through
sqlite3_Exec.  What return value I will get If I query an empty table.


Thanks and Regards,
 Vivek R


[sqlite] EXISTS subcommand. was: Wiki is locked

2006-10-06 Thread drh
Arjen Markus <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> 
> >
> >
> >Whatever
> >
> >Everything appears to be working now.
> >  
> >
> Yes, I can see the contents now. As we are on the subject of documentation,
> someone on the Tclers' chat mentioned that the subcommand "exists" is
> documented, but not actually implemented. Could you have a look at that too?
> 

I sometimes add new stuff and fail to document it, but it is
very unusual for something to be documented but not added yet.

EXISTS has been in SQLite since version 3.3.0.  Perhaps the
person who says it isn't there is using an older version of
SQLite. 
--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Wiki is locked

2006-10-06 Thread Arjen Markus

[EMAIL PROTECTED] wrote:




Whatever

Everything appears to be working now.
 


Yes, I can see the contents now. As we are on the subject of documentation,
someone on the Tclers' chat mentioned that the subcommand "exists" is
documented, but not actually implemented. Could you have a look at that too?

Regards,

Arjen

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Wiki is locked

2006-10-06 Thread drh
Arjen Markus <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I tried to access the SQLite Wiki this morning (MET 8:30), but all I got 
> was a reply
> that the query failed because the database was locked.
> 
> Can somebody (Richard Hipp most probably) look into this?
> 

This problem appears to have been caused last night when someone
at 200.219.177.193 began downloading sqlite-3_3_7.zip over and over
and over.  They did it 16668 times and burned through 2GiB of
bandwidth before I added a firewall rule that blocks that IP address 
from www.sqlite.org.

Whatever

Everything appears to be working now.

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] database corrouption during power failure

2006-10-06 Thread drh
"jayanth KP" <[EMAIL PROTECTED]> wrote:
> Hi,
>I have a question regarding power failure handling in sqlite 2.8.3. 
> 
> When the power is switched off during  a database write like (insert/update), 
> in next reboot database is getting corroupted. 
> 
> The database is in a ext3 partition on the harddisk (linux 2.6).
> 
> 
> Also i tried the following in my c code after sqlite_open() was success.
> 
> sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, &pErrMsg);
> 
> This did not seem to work. 
> 
> Please help me in solving this issue
> 

See http://www.sqlite.org/cvstrac/tktview?tn=599

This problem was fixed in SQLite version 2.8.12, over two
and a half years ago.

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] database corrouption during power failure

2006-10-06 Thread jayanth KP
  
Hi,
   I have a question regarding power failure handling in sqlite 2.8.3. 

When the power is switched off during  a database write like (insert/update), 
in next reboot database is getting corroupted. 

The database is in a ext3 partition on the harddisk (linux 2.6).


Also i tried the following in my c code after sqlite_open() was success.

sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, &pErrMsg);

This did not seem to work. 

Please help me in solving this issue


Regards
Jayanth





[sqlite] test mail - plz ignore

2006-10-06 Thread jayanth KP
  




Re: [sqlite] Segfault on second invalid command

2006-10-06 Thread Stephan Brunner
Hi Jim,

>> [description and sample perl script for segfault-problem]

> This might be related to  DBD::SQLite 1.13 defaulting to SQLite 3.3.7?
> I tend to try and keep my PERL and SQLite Command line at the same
> version.

How do the two (commandline-version and DBD::SQLite) interact?
The only interaction that comes in my mind is that I created the database 
(test.db in the example) with the commandline-tool. If that causes the error 
(which I will check tonight), then 3.3.7 wouldn't be completely backwards 
compatible (not even for that simple DB)?

Or does DBD::SQLite link to the system-wide sqlite-libraries (I thought it 
brings its own libs) or interact in other ways?

Thanks for the hint, I will definitly check that! But I'm only partially 
hopeful...

Regards,
Stephan

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

-
To unsubscribe, send email to [EMAIL PROTECTED]
-