Re: [sqlite] DATABASE SCHEMA HAS CHANGED

2004-11-21 Thread P. Morandi
That's true, I didn't mention the version, sorry ...
It's 2.8. I need to execute again the statement to solve the problem.
Thanks to everybody

Paolo

- Original Message - 
From: "Randall Fox" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 21, 2004 6:21 AM
Subject: Re: [sqlite] DATABASE SCHEMA HAS CHANGED


On Sat, 20 Nov 2004 08:08:48 -0500, you wrote:
>So to answer your questions:
>
>   No, this is not a serious bug.  You just need to be prepared to
>   reissue any SQL statement that returns SQLITE_SCHEMA.
>
>   Yes, this issue is fixed in version 3.0.

Thank you.. 

It seems the original poster didn't say what version, and a follow up
mentioned the sqlite3 structure, so I assumed it was v3.

Good to know it is not a problem.

Randall Fox









Re: [sqlite] Struggling with VisualStudio.NET

2004-11-21 Thread Cory Nelson
sqlite is not .net - you can not load it as an assembly.


On Sun, 21 Nov 2004 20:50:15 -0800, Carlin Wiegner <[EMAIL PROTECTED]> wrote:
> Hi.
> 
> I've tried both downloading the precompilied libraries (2.8 and 3.0)
> for Windows as well as building the 3.0 library myself (which works
> fine). But when I go to add it as a reference to my project I get the
> message:
> 
> "A reference to 'C:\Documents and Settings\dev\My Documents\Visual
> Studio Projects\sqlite\Release\sqlite.dll' could not be added. This is
> not a valid assembly or COM component. Only assemblies with extension
> 'dll' and COM components can be referenced. Please make sure that the
> file is accessible, and that it is a valid assembly or COM component."
> 
> Any ideas would be appreciated. :)
> 
> Thanks,
> cw
> 


-- 
Cory Nelson
http://www.int64.org


RE: [sqlite] Struggling with VisualStudio.NET

2004-11-21 Thread Dennis Volodomanov
Why do you need it as a reference? Just include the source code and
you'll be fine.

   Dennis 

-Original Message-
From: Carlin Wiegner [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 22, 2004 3:50 PM
To: [EMAIL PROTECTED]
Subject: [sqlite] Struggling with VisualStudio.NET

Hi.

I've tried both downloading the precompilied libraries (2.8 and 3.0) for
Windows as well as building the 3.0 library myself (which works fine).
But when I go to add it as a reference to my project I get the
message:

"A reference to 'C:\Documents and Settings\dev\My Documents\Visual
Studio Projects\sqlite\Release\sqlite.dll' could not be added. This is
not a valid assembly or COM component. Only assemblies with extension
'dll' and COM components can be referenced. Please make sure that the
file is accessible, and that it is a valid assembly or COM component."

Any ideas would be appreciated. :)

Thanks,
cw






[sqlite] Struggling with VisualStudio.NET

2004-11-21 Thread Carlin Wiegner
Hi.

I've tried both downloading the precompilied libraries (2.8 and 3.0)
for Windows as well as building the 3.0 library myself (which works
fine). But when I go to add it as a reference to my project I get the
message:

"A reference to 'C:\Documents and Settings\dev\My Documents\Visual
Studio Projects\sqlite\Release\sqlite.dll' could not be added. This is
not a valid assembly or COM component. Only assemblies with extension
'dll' and COM components can be referenced. Please make sure that the
file is accessible, and that it is a valid assembly or COM component."

Any ideas would be appreciated. :)

Thanks,
cw


Re: [sqlite] Suppressing column (field) headers?

2004-11-21 Thread mswarm
>
>Subject: Re: [sqlite] Suppressing column (field) headers?
>   From: [EMAIL PROTECTED]
>   Date: Mon, 22 Nov 2004 10:23:37 +1000
> To: [EMAIL PROTECTED]

>[EMAIL PROTECTED]
>21/11/2004 04:56 PM
>Please respond to sqlite-users
>
> 
>To: [EMAIL PROTECTED]
>cc: 
>Subject:[sqlite] Suppressing column (field) headers?
>
>
>
>> 1. How can I get the dll to return JUST the desired data? 
>>When I send the following SQL, for example,
>>   select colEntry from tblEntry where colNum = 3
>>   the textbox shows 
>>  colEntry
>>  "The text in the column."
>>  
>

>This is being done by your delphi wrapper. 

I beat around doing traces until I began to get that picture. The 
code is doing things with TStrings and TSringlists. 


>Please consult its documentation. 

I wish. Heh. 

>The "C" interface of sqlite (for both 2.8 series and 3.0 
>series) returns the column names and column values separately, and doesn't 
>return any extra "quote" characters.

Makes sense.


>Clay Dowling wrote:
>> You can get just the data that you want by using the prepared statements
>> feature of the 3.0.x dll.  It sounds like you're using the table output
>> method for getting your results.  This is fine, but it means that you 
>need
>> it ignore the first row of data, which in the table interface is the
>> column labels.
>
>This statement makes you sound like you're taking crazy pills, Clay 
>(prepared statements and non-prepared statements aren't functionally 
>different in sqlite)... but I'm interested to know if you have a grain of 
>truth hidden in there. Are you familiar with the delphi wrapper Mswarm is 
>using? Which delphi wrapper are you using, Mswarm? 

It says: "Simple class interface for SQLite. Hacked in by Ben Hochstrasser 
([EMAIL PROTECTED]) Thanks to Roger Reghin ([EMAIL PROTECTED]) for his 
idea to ValueList." 

>What does the code that issues your query look like?

Benjamin, so far as I can tell, the relevant code is as follows:


fTable: TStrings;
fLstName: TStringList;
fLstVal: TStringList;


SQLite_Exec: function(db: Pointer; SQLStatement: PChar; CallbackPtr: Pointer; 
Sender: TObject; var ErrMsg: PChar): integer; cdecl;



function ExecCallback(Sender: TObject; Columns: Integer; ColumnValues: Pointer; 
ColumnNames: Pointer): integer; cdecl;
var
  PVal, PName: ^PChar;
  n: integer;
  sVal, sName: String;
begin
  Result := 0;
  with Sender as TSQLite do
  begin
if (Assigned(fOnData) or Assigned(fTable)) then
begin
  fLstName.Clear;
  fLstVal.Clear;
  if Columns > 0 then
  begin
PName := ColumnNames;
PVal := ColumnValues;
for n := 0 to Columns - 1 do
begin
  fLstName.Append(PName^);
  fLstVal.Append(PVal^);
  inc(PName);
  inc(PVal);
end;
  end;
  sVal := fLstVal.CommaText;
  sName := fLstName.CommaText;
  if Assigned(fOnData) then
fOnData(Sender, Columns, sName, sVal);
  if Assigned(fTable) then
  begin
if fTable.Count = 0 then
  fTable.Append(sName);
fTable.Append(sVal);
  end;
end;
  end;
end;


function TSQLite.Query(Sql: String; Table: TStrings = nil): boolean;
begin
  fError := SQLITE_ERROR;
  if fIsOpen then
  begin
fPMsg := nil;
fBusy := True;
fTable := Table;
if fTable <> nil then
  fTable.Clear;
fError := SQLite_Exec(fSQLite, PChar(Sql), @ExecCallback, Self, fPMsg);
SQLite_FreeMem(fPMsg);
fChangeCount := SQLite_Changes(fSQLite);
fTable := nil;
fBusy := False;
if Assigned(fOnQueryComplete) then
  fOnQueryComplete(Self);
  end;
  fMsg := ErrorMessage(fError);
  Result := (fError <> SQLITE_OK);
end;


I haven't used TStrings much, but I'm guessing that appending to 
TStrings creates the newlines, and that the .commatext method creates
the commas in the TStringlists. I still can't figure out which code
would add the "double quote" marks around returned text, though, if the 
DLL doesn't return a string that way. I've search the code for the " 
mark and the #value, but nothing turns up. 

Thanks



Re: [sqlite] Suppressing column (field) headers?

2004-11-21 Thread mswarm
>
>Subject: Re: [sqlite] Suppressing column (field) headers?
>   From: Clay Dowling <[EMAIL PROTECTED]>
>   Date: Sun, 21 Nov 2004 19:19:11 -0500
> To: [EMAIL PROTECTED]
>
>[EMAIL PROTECTED] wrote:
>
>>I'm using the 2.8 dll. You seem to be suggesting that I have to 
>>move up to the 3.0 dll to get just the data without the headers. 
>>
>>Will I still have to strip quotes off text, and an appended newline?
>>
>>I'm not sure what "prepared statements" means. Googling the subject
>>gets me lots of 'xxSQLxxx will do prepared statements' but little
>>explanation of what that is. 
>>  
>>
>Prepared statements let you write your SQL like this: SELECT name, qty, 
>location FROM inventory WHERE id=?
>You then get to substitute any value for ? that you want.  It's great 
>for avoiding data escaping problems, and speeds up your SQL processing.

OK. As I said in my original post, I send such through a Delphi
procedure. Quoting:

---
1. How can I get the dll to return JUST the desired data? 
   When I send the following SQL, for example,

  select colEntry from tblEntry where colNum = 3

   the textbox shows 

  colEntry
  "The text in the column."
  

   What I really want is just: 

  The text in the column.
---

>The part that's relevant for you is that you get your result set back 
>one row of data at a time, getting one field for each function call.  
>What you get is the raw data without any quotes or trailing newlines or 
>labels, in the data type that you asked for.
>
>>some insight, especially the comments. I'm forced to rely on someone 
>>else's Delphi wrapper, not all of which I understand. 
>>
>>Was this last comment your way of answering my "Can I drop in the 
>>3.0x dll and change the 'sqlite.dll' line to 'sqlite3.dll' and expect 
>>it to work the same?" question? 
>>  
>>
>Well, it was a pretty second rate answer in response to your question. 
>If you look in the Delphi documentation about external libraries you'll 
>see that Delphi can call them directly without really needing a 
>wrapper.  The sqlite3 dll won't be a drop in replacement, but it will 
>let you get the data back in a way that's likely to be more useful to 
>you. 

I tried. It didn't work right. Don't know enough yet about calling DLLs to
know why. It claims the library isn't loaded.


>All you need is a single pascal unit that imports the functions 
>defined in the DLL (or at least the functions you need).  The Delphi 
>documentation will have examples of how to write that module.  Then you 
>make Delphi calls to access the data in exactly the same way that you 
>would access it from a C program. This means that the C documentation 
>now also works for you writing in Delphi.

I presume you mean the structure in the TSQLite code I'm using, which begins:

  SQLite_Open: function(dbname: PChar; mode: Integer; var ErrMsg: PChar): 
Pointer; cdecl;
  SQLite_Close: procedure(db: Pointer); cdecl;
  SQLite_Exec: function(db: Pointer; SQLStatement: PChar; CallbackPtr: Pointer; 
Sender: TObject; var ErrMsg: PChar): integer; cdecl;
etc.


>If you can wait a little while, I actually need to write a Delphi 
>interface to SQLite myself, and I can send you the Pascal unit and a 
>short example off list.

All info a welcome part of the puzzle, I'm sure. Off list is fine, 
but please use the [sqlite] thingie in the header, if you can think
of it, as I get 100 pieces of spam a day to this account. 

Thanks


Re: [sqlite] Suppressing column (field) headers?

2004-11-21 Thread ben . carlyle
Hello,





[EMAIL PROTECTED]
21/11/2004 04:56 PM
Please respond to sqlite-users

 
To: [EMAIL PROTECTED]
cc: 
Subject:[sqlite] Suppressing column (field) headers?



> 1. How can I get the dll to return JUST the desired data? 
>When I send the following SQL, for example,
>   select colEntry from tblEntry where colNum = 3
>   the textbox shows 
>  colEntry
>  "The text in the column."
>  

This is being done by your delphi wrapper. Please consult its 
documentation. The "C" interface of sqlite (for both 2.8 series and 3.0 
series) returns the column names and column values separately, and doesn't 
return any extra "quote" characters.

Clay Dowling wrote:
> You can get just the data that you want by using the prepared statements
> feature of the 3.0.x dll.  It sounds like you're using the table output
> method for getting your results.  This is fine, but it means that you 
need
> it ignore the first row of data, which in the table interface is the
> column labels.

This statement makes you sound like you're taking crazy pills, Clay 
(prepared statements and non-prepared statements aren't functionally 
different in sqlite)... but I'm interested to know if you have a grain of 
truth hidden in there. Are you familiar with the delphi wrapper Mswarm is 
using? Which delphi wrapper are you using, Mswarm? What does the code that 
issues your query look like?

Benjamin.




Re: [sqlite] Suppressing column (field) headers?

2004-11-21 Thread Clay Dowling
[EMAIL PROTECTED] wrote:
I'm using the 2.8 dll. You seem to be suggesting that I have to 
move up to the 3.0 dll to get just the data without the headers. 

Will I still have to strip quotes off text, and an appended newline?
I'm not sure what "prepared statements" means. Googling the subject
gets me lots of 'xxSQLxxx will do prepared statements' but little
explanation of what that is. 
 

Prepared statements let you write your SQL like this: SELECT name, qty, 
location FROM inventory WHERE id=?
You then get to substitute any value for ? that you want.  It's great 
for avoiding data escaping problems, and speeds up your SQL processing.

The part that's relevant for you is that you get your result set back 
one row of data at a time, getting one field for each function call.  
What you get is the raw data without any quotes or trailing newlines or 
labels, in the data type that you asked for.

some insight, especially the comments. I'm forced to rely on someone 
else's Delphi wrapper, not all of which I understand. 

Was this last comment your way of answering my "Can I drop in the 
3.0x dll and change the 'sqlite.dll' line to 'sqlite3.dll' and expect 
it to work the same?" question? 
 

Well, it was a pretty second rate answer in response to your question. 
If you look in the Delphi documentation about external libraries you'll 
see that Delphi can call them directly without really needing a 
wrapper.  The sqlite3 dll won't be a drop in replacement, but it will 
let you get the data back in a way that's likely to be more useful to 
you. All you need is a single pascal unit that imports the functions 
defined in the DLL (or at least the functions you need).  The Delphi 
documentation will have examples of how to write that module.  Then you 
make Delphi calls to access the data in exactly the same way that you 
would access it from a C program. This means that the C documentation 
now also works for you writing in Delphi.

If you can wait a little while, I actually need to write a Delphi 
interface to SQLite myself, and I can send you the Pascal unit and a 
short example off list.

Clay Dowling


RE: [sqlite] [ANN] SQLcrypt 1.0

2004-11-21 Thread Dennis Volodomanov
Yes, unfortunately that's above my budget level :-( I doubt that I
really need the source code, I just want a quick "plug-in" sort of
thing.

   Dennis 

-Original Message-
From: Ulrik Petersen [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 22, 2004 10:11 AM
To: [EMAIL PROTECTED]
Subject: Re: [sqlite] [ANN] SQLcrypt 1.0

Dennis Volodomanov wrote:

>Hi all,
>
>Is anyone using the mentioned library? Is it stable and fast?
>
>Are there any other similar products for SQLite v3?
>  
>
Can't answer the first question, but Dr. Hipp, the author and designer
of SQLite, offers a version of SQLite (both 2.8 and 3.0) that does
encryption:

http://www.hwaci.com/sw/sqlite/prosupport.html#crypto

HTH

Ulrik P.







Re: [sqlite] [ANN] SQLcrypt 1.0

2004-11-21 Thread Ulrik Petersen
Dennis Volodomanov wrote:
Hi all,
Is anyone using the mentioned library? Is it stable and fast?
Are there any other similar products for SQLite v3?
 

Can't answer the first question, but Dr. Hipp, the author and designer 
of SQLite, offers a version of SQLite (both 2.8 and 3.0) that does 
encryption:

http://www.hwaci.com/sw/sqlite/prosupport.html#crypto
HTH
Ulrik P.


RE: [sqlite] [ANN] SQLcrypt 1.0

2004-11-21 Thread Dennis Volodomanov
Hi all,

Is anyone using the mentioned library? Is it stable and fast?

Are there any other similar products for SQLite v3?

Thanks,

   Dennis 

-Original Message-
From: Ng Pheng Siong [mailto:[EMAIL PROTECTED] 
Sent: Saturday, November 13, 2004 5:33 PM
To: [EMAIL PROTECTED]
Subject: [sqlite] [ANN] SQLcrypt 1.0

Hi all,

I'm pleased to announce the release of SQLcrypt.

http://www.sqlcrypt.com

SQLcrypt is SQLite 3 + transparent AES encryption. Try before you buy.
Please take a look.

Thanks. Cheers.

--
Ng Pheng Siong <[EMAIL PROTECTED]> 

http://sandbox.rulemaker.net/ngps -+- M2Crypto, ZServerSSL for Zope,
Blog
http://www.sqlcrypt.com   -+- Transparent AES Encryption For
SQLite






Re: [sqlite] Suppressing column (field) headers?

2004-11-21 Thread mswarm
>
>Subject: Re: [sqlite] Suppressing column (field) headers?
>   From: "Clay Dowling" <[EMAIL PROTECTED]>
>   Date: Sat, 20 Nov 2004 13:03:33 -0500 (EST)
> To: [EMAIL PROTECTED]
>
>
>[EMAIL PROTECTED] said:
>
>> 1. How can I get the dll to return JUST the desired data?
>>When I send the following SQL, for example,
>
>You can get just the data that you want by using the prepared statements
>feature of the 3.0.x dll.  It sounds like you're using the table output
>method for getting your results.  This is fine, but it means that you need
>it ignore the first row of data, which in the table interface is the
>column labels.

I'm using the 2.8 dll. You seem to be suggesting that I have to 
move up to the 3.0 dll to get just the data without the headers. 

Will I still have to strip quotes off text, and an appended newline?

I'm not sure what "prepared statements" means. Googling the subject
gets me lots of 'xxSQLxxx will do prepared statements' but little
explanation of what that is. 


>Because sqlite is implemented as a C library, you can use it pretty much
>directly from Delphi in exactly the way you would use the C interface.  It
>might be worth your while to do that, since you'd have a lot more control
>over your interaction.

I'm not a C person, but though going through the C code has given me
some insight, especially the comments. I'm forced to rely on someone 
else's Delphi wrapper, not all of which I understand. 

Was this last comment your way of answering my "Can I drop in the 
3.0x dll and change the 'sqlite.dll' line to 'sqlite3.dll' and expect 
it to work the same?" question? 

 




Re: [sqlite] pendant to .tables

2004-11-21 Thread Tomas Franzén
On 2004-11-21, at 14.15, Antonio Coralles wrote:
how can i get the output which will be produced by sqlite>.tables from 
a
sqlite_exec call inside my programm ?
(i'm using sqlite 2.8.14)
SELECT name FROM sqlite_master WHERE type='table' UNION ALL SELECT name 
FROM sqlite_temp_master WHERE type='table' ORDER BY name;

Is that what you need? :-)
Tomas Franzén
Lighthead Software
http://www.lightheadsw.com/


Re: [sqlite] Primary Key doenst work

2004-11-21 Thread Christian Kienle
Thanks a lot!
It really helped!


Christian Kienle
http://www.QtForum.org



On Nov 21, 2004, at 6:52 PM, [EMAIL PROTECTED] wrote:
Christian Kienle <[EMAIL PROTECTED]> writes:
I am using SQLite 2.8.5
Firstly, 2.8.5 is ancient.  Numerous bugs have been fixed between 
2.8.5 and
the current version in the 2.8 branch: 2.8.15.  You really should 
upgrade.

and I wanna use a primary key field in one of my tables.
~$ sqlite :memory:
SQLite version 2.8.5
Enter ".help" for instructions
sqlite> create table testing(title text, id AUTOINCREMENT);
sqlite> insert into testing(title) VALUES('this is just a test');
sqlite> select * from testing;
this is just a test|
sqlite>
Although you state that you want to use a primary key field, you're not
specifying anything to be a primary key.  I *think* you're looking for 
'id' to
be your primary key.  A couple of points here:

 - you need to specify that id is a primary key
 - the attribute AUTOINCREMENT is not implemented in 2.8.5.  I think 
that's
   only in the 3.0 tree.  You can get the behavior you probably want, 
though.

CREATE TABLE testing(id INTEGER PRIMARY KEY, title TEXT);
By creating your table this way, with 'id' being an INTEGER PRIMARY 
KEY, 'id'
will always be assigned an integer value one greater than the 
previously
highest value of 'id' in the table (starting at 1), if you either don't
provide an 'id' value, or if you provide it as NULL:

This one doesn't provide 'id' at all:
INSERT INTO testing(title) VALUES ('this is test 1');
This one provides 'id' explicitly as NULL:
INSERT INTO testing(id, title) VALUES (null, 'this test 2');
If you specify a value for 'id', it will take on that value:
INSERT INTO testing(id, title) VALUES (23, 'this is test 23');
A primary key must be unique, so if you try to insert a record with an 
'id'
value that already exists in the table, you'll get an error:

INSERT INTO testing(id, title) VALUES (23, 'this is another test 23');
If you really want to replace the row with an existing 'id' value, use
INSERT OR REPLACE instead of INSERT:
INSERT OR REPLACE INTO testing(id, title)
  VALUES (23, 'this is yet another test 23');
Here's a transcript of the above so you can see what's happening:
sqlite> .mode line
sqlite> CREATE TABLE testing(id INTEGER PRIMARY KEY, title TEXT);
sqlite> .schema
CREATE TABLE testing(id INTEGER PRIMARY KEY, title TEXT);
sqlite> INSERT INTO testing(title) VALUES ('this is test 1');
sqlite> INSERT INTO testing(id, title) VALUES (null, 'this test 2');
sqlite> INSERT INTO testing(id, title) VALUES (23, 'this is test 23');
sqlite> select * from testing;
   id = 1
title = this is test 1
   id = 2
title = this test 2
   id = 23
title = this is test 23
sqlite> INSERT INTO testing(id, title) VALUES (23, 'this is another 
test 23');
SQL error: constraint failed
sqlite> INSERT OR REPLACE INTO testing(id, title)
   ...>   VALUES (23, 'this is yet another test 23');
sqlite> select * from testing;
   id = 1
title = this is test 1

   id = 2
title = this test 2
   id = 23
title = this is yet another test 23
sqlite>



Re: [sqlite] Primary Key doenst work

2004-11-21 Thread Derrell . Lipman
Christian Kienle <[EMAIL PROTECTED]> writes:

> I am using SQLite 2.8.5

Firstly, 2.8.5 is ancient.  Numerous bugs have been fixed between 2.8.5 and
the current version in the 2.8 branch: 2.8.15.  You really should upgrade.

> and I wanna use a primary key field in one of my tables.
>
> ~$ sqlite :memory:
> SQLite version 2.8.5
> Enter ".help" for instructions
> sqlite> create table testing(title text, id AUTOINCREMENT);
> sqlite> insert into testing(title) VALUES('this is just a test');
> sqlite> select * from testing;
> this is just a test|
> sqlite>

Although you state that you want to use a primary key field, you're not
specifying anything to be a primary key.  I *think* you're looking for 'id' to
be your primary key.  A couple of points here:

 - you need to specify that id is a primary key
 - the attribute AUTOINCREMENT is not implemented in 2.8.5.  I think that's
   only in the 3.0 tree.  You can get the behavior you probably want, though.

CREATE TABLE testing(id INTEGER PRIMARY KEY, title TEXT);

By creating your table this way, with 'id' being an INTEGER PRIMARY KEY, 'id'
will always be assigned an integer value one greater than the previously
highest value of 'id' in the table (starting at 1), if you either don't
provide an 'id' value, or if you provide it as NULL:

This one doesn't provide 'id' at all:

INSERT INTO testing(title) VALUES ('this is test 1');

This one provides 'id' explicitly as NULL:

INSERT INTO testing(id, title) VALUES (null, 'this test 2');

If you specify a value for 'id', it will take on that value:

INSERT INTO testing(id, title) VALUES (23, 'this is test 23');

A primary key must be unique, so if you try to insert a record with an 'id'
value that already exists in the table, you'll get an error:

INSERT INTO testing(id, title) VALUES (23, 'this is another test 23');

If you really want to replace the row with an existing 'id' value, use
INSERT OR REPLACE instead of INSERT:

INSERT OR REPLACE INTO testing(id, title)
  VALUES (23, 'this is yet another test 23');

Here's a transcript of the above so you can see what's happening:

sqlite> .mode line
sqlite> CREATE TABLE testing(id INTEGER PRIMARY KEY, title TEXT);
sqlite> .schema
CREATE TABLE testing(id INTEGER PRIMARY KEY, title TEXT);
sqlite> INSERT INTO testing(title) VALUES ('this is test 1');
sqlite> INSERT INTO testing(id, title) VALUES (null, 'this test 2');
sqlite> INSERT INTO testing(id, title) VALUES (23, 'this is test 23');
sqlite> select * from testing;
   id = 1
title = this is test 1

   id = 2
title = this test 2

   id = 23
title = this is test 23
sqlite> INSERT INTO testing(id, title) VALUES (23, 'this is another test 23');
SQL error: constraint failed
sqlite> INSERT OR REPLACE INTO testing(id, title)
   ...>   VALUES (23, 'this is yet another test 23');
sqlite> select * from testing;
   id = 1
title = this is test 1

   id = 2
title = this test 2

   id = 23
title = this is yet another test 23
sqlite> 


Re: [sqlite] Suppressing column (field) headers?

2004-11-21 Thread Clay Dowling

[EMAIL PROTECTED] said:

> 1. How can I get the dll to return JUST the desired data?
>When I send the following SQL, for example,

You can get just the data that you want by using the prepared statements
feature of the 3.0.x dll.  It sounds like you're using the table output
method for getting your results.  This is fine, but it means that you need
it ignore the first row of data, which in the table interface is the
column labels.

Because sqlite is implemented as a C library, you can use it pretty much
directly from Delphi in exactly the way you would use the C interface.  It
might be worth your while to do that, since you'd have a lot more control
over your interaction.

Clay Dowling
-- 
Lazarus Notes from Lazarus Internet Development
http://www.lazarusid.com/notes/
Articles, Reviews and Commentary on web development


Re: [sqlite] pendant to .tables

2004-11-21 Thread Clay Dowling

Antonio Coralles said:
> how can i get the output which will be produced by sqlite>.tables from a
> sqlite_exec call inside my programm ?
> (i'm using sqlite 2.8.14)

It won't get you the same output as .tables, but take a look at the pragma
commands, which will get you all the metadata that you could need.

Clay

-- 
Lazarus Notes from Lazarus Internet Development
http://www.lazarusid.com/notes/
Articles, Reviews and Commentary on web development


Re: [sqlite] in memory databases

2004-11-21 Thread Christian Kienle
Howdy,
I wrote a C++ wrapper for SQLite.
http://www.qtforum.org/members/christian/flib/doc/ 
classflib_1_1FSqlite.html

And it's downloadable from here:
http://www.qtforum.org/members/christian/flib/hp
And with my wrapper it works like this:
flib::FSqlite sql();
sql.sqliteConnect(":memory:");
sql.setTable("myTable");
sql.select("id > 50");
while(sql.next() {
cout << sql.value("row");
}

Christian Kienle
http://www.QtForum.org



On Aug 3, 2004, at 2:49 PM, Rajesh Nagarajan wrote:
Hi
I am trying to move to memory database from file based sqlite db, I  
want my memory database to be
shared across various threads in my process.

How do I do it?
From the Wiki documentation, I found the following
  * (defvar db2 (sql:connect '(":memory:")
 :database-type :sqlite
 :make-default nil
 :if-exists :old))
+ Will this "if-this:old" help me do this?
+ Is it supported in V3.x?
+ I read in the documentation that "Copy" command will no longer be  
supported (V3.0 onwards), then
how do we get to prepare the memory db, any ideas/suggestions for  
doing that?
+ Is it possible to have multiple processes running on the same  
machine with separate memory
database, while the threads inside a process share the same memory  
database?

Can somebody give me a c++ syntax for doing this...or point me to a  
document that explains more on
this?

Thanks & Regards
Rajesh



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail



[sqlite] Primary Key doenst work

2004-11-21 Thread Christian Kienle
Hi,
I am using SQLite 2.8.5 and I wanna use a primary key field in one of 
my tables.

~$ sqlite :memory:
SQLite version 2.8.5
Enter ".help" for instructions
sqlite> create table testing(title text, id AUTOINCREMENT);
sqlite> insert into testing(title) VALUES('this is just a test');
sqlite> select * from testing;
this is just a test|
sqlite>
I already read the doc... wondering whats 'wrong' there.
Greets and thanks

Christian Kienle
http://www.QtForum.org





[sqlite] pendant to .tables

2004-11-21 Thread Antonio Coralles
how can i get the output which will be produced by sqlite>.tables from a
sqlite_exec call inside my programm ?
(i'm using sqlite 2.8.14)


[sqlite] pendant to .tables

2004-11-21 Thread Antonio Coralles
how can i get the output which will be produced by sqlite>.tables from a 
sqlite_exec call inside my programm ?
(i'm using sqlite 2.8.14)