Re: [sqlite] how to get the INTEGER PRIMARY KEY for the row just inserted?

2005-04-05 Thread Kurt Welgehausen
> begin immediate; insert; select max(id) from blah; commit;

Or "select last_insert_rowid() from blah limit 1"

Regards


Re: [sqlite] Access Violations in sqlite3_step when in DLL

2005-04-05 Thread Chris Schirlinger
> Sounds like the calling type is different. Do you know if the EXE is
> calling your stuff using stdcall or cdecl, and does it match your
> functions? If you don't specify, your functions are cdecl. I've seen
> this kind of thing when they don't match. It may work a couple of
> times, but eventually something blows up.

No, I am not actually sure what they are using... though they havn't 
supported delphi DLL's for long... normally they supported C dlls... 
hurm, that's an avenue I hadn't thought of. thanks...  

I made sure OUR call types where correct but never thought about what 
they were using

Someone also mentioned ram. The machine(s) we are using seem stable 
for other processes but won't rule that out

Looks like I am going debugging :) 



Re: Re: [sqlite] How do I efficiently copy tables to another db within dll (sqlite3+)

2005-04-05 Thread de f
Thanks Jay.

Great! This could work...
 
I'm wondering, though if you know whether the limitation below
(from sqlite documentation) could be safely circumvented if
attaching the source db with an alias name.  It seems to work
when i try it but I'm concerned that there might be other
unknown issues.

"You cannot create a new table with the same name as a table in
an attached database, but you can attach a database which
contains tables whose names are duplicates of tables in the main
database. It is also permissible to attach the same database
file multiple times."

First open db1

then execute:
attach database db2 as mydb2
attach datbase db1 as mydb1
create table db2.table1 as select * from db2.table1

eg:

db1
---
table1 
table2

db2
---
(no tables)




Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


 On Tue, 5 Apr 2005, Jay ([EMAIL PROTECTED]) wrote:

> 
> Did you try attach and an insert?
> 
> --- de f <[EMAIL PROTECTED]> wrote:
> > I'd like some guidance on the most efficient way to copy a
large
> > table from one slqite db to another.  I'm using from within
vb
> > with a vc++ sqlite wrapper.
> > 
> > I know that the copy command is no longer available in ver3+
and
> > am unsure of how to proceed.  
> > 
> > do i need to somehow hook into the sqlite.exe command line
util
> > for import functionality?
> > 
> > Any help is appreciated.
> > 
> > Thank You
> > 
> > 
> > Get your own "800" number
> > Voicemail, fax, email, and a lot more
> > http://www.ureach.com/reg/tag
> > 
> 
> 
> -
> 
> You a Gamer? If you're near Kansas City, ask me about the
Recruits and Conquest conventions.
> -
> 
> The Castles of Dereth Calendar: a tour of the art and
architecture of Asheron's Call
> http://www.lulu.com/content/77264
> 
> 
>   
> __ 
> Yahoo! Messenger 
> Show us what our next emoticon should look like. Join the fun.

> http://www.advision.webevents.yahoo.com/emoticontest
> 
> 



Re: [sqlite] How do I efficiently copy tables to another db within dll (sqlite3+)

2005-04-05 Thread Jay

Did you try attach and an insert?

--- de f <[EMAIL PROTECTED]> wrote:
> I'd like some guidance on the most efficient way to copy a large
> table from one slqite db to another.  I'm using from within vb
> with a vc++ sqlite wrapper.
> 
> I know that the copy command is no longer available in ver3+ and
> am unsure of how to proceed.  
> 
> do i need to somehow hook into the sqlite.exe command line util
> for import functionality?
> 
> Any help is appreciated.
> 
> Thank You
> 
> 
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 


-

You a Gamer? If you're near Kansas City, ask me about the Recruits and Conquest 
conventions.
-

The Castles of Dereth Calendar: a tour of the art and architecture of Asheron's 
Call
http://www.lulu.com/content/77264



__ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest


Re: [sqlite] how to get the INTEGER PRIMARY KEY for the row just inserted?

2005-04-05 Thread Jay

The documentation is your friend.

long long int sqlite3_last_insert_rowid(sqlite3*);
http://sqlite.org/capi3ref.html#sqlite3_last_insert_rowid

or

begin immediate; insert; select max(id) from blah; commit;

--- jack wu <[EMAIL PROTECTED]> wrote:
> i have a table which has an ID column defined as
> INTEGER PRIMARY KEY. I'd like to know the value of the
> automatically generated ID right after the insert. is
> there anyway to get the ID without issuing another
> select? does the insert function return the ID in any
> way? if another select is necessary, what is the best
> way to do it?  this is kind of a generic problem so i
> am hoping whoever solved this issue before could share
> some thoughts. Thanks for the help.
> 
> 
> jack.
> 


-

You a Gamer? If you're near Kansas City, ask me about the Recruits and Conquest 
conventions.
-

The Castles of Dereth Calendar: a tour of the art and architecture of Asheron's 
Call
http://www.lulu.com/content/77264

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


[sqlite] How do I efficiently copy tables to another db within dll (sqlite3+)

2005-04-05 Thread de f
I'd like some guidance on the most efficient way to copy a large
table from one slqite db to another.  I'm using from within vb
with a vc++ sqlite wrapper.

I know that the copy command is no longer available in ver3+ and
am unsure of how to proceed.  

do i need to somehow hook into the sqlite.exe command line util
for import functionality?

Any help is appreciated.

Thank You


Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


[sqlite] how to get the INTEGER PRIMARY KEY for the row just inserted?

2005-04-05 Thread jack wu
i have a table which has an ID column defined as
INTEGER PRIMARY KEY. I'd like to know the value of the
automatically generated ID right after the insert. is
there anyway to get the ID without issuing another
select? does the insert function return the ID in any
way? if another select is necessary, what is the best
way to do it?  this is kind of a generic problem so i
am hoping whoever solved this issue before could share
some thoughts. Thanks for the help.


jack.


Re: [sqlite] Reading Database Schema Info. in Perl

2005-04-05 Thread Matt Sergeant
On 30 Mar 2005, at 04:05, [EMAIL PROTECTED] wrote:
I need to be able to read all table names in the database, and further 
all attribute
names in each table. ( am using DBD::SQLite in Perl)
For gathering all the table names I've used the sqlite_master table. 
The problem
is that the information on the attributes of each table is returned as 
a string
:
eg:
Type : table
Name :  names
Table Name :  names
Root Page :  2 CREATE TABLE names (id INTEGER PRIMARY KEY, name)

I plan to use the SQL::Parser library in order to derive all attribute 
information
from this string. Is there a better way to go about it ?
My aim is to find something equivalent to "DESC tablename" (used in 
sqlplus)
There is core DBI support for this (which DBD::SQLite talks to). See 
the table_info section of the DBI man page.

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


Re: [sqlite] Access Violations in sqlite3_step when in DLL

2005-04-05 Thread Joel Lucsy
On Apr 5, 2005 6:54 AM, Chris Schirlinger <[EMAIL PROTECTED]> wrote:
> Recently we tried to tie in with a third party program that calls one
> of our DLL's (which access the SQLite3 DB and returns a data set)
> [Note: We eventually started a fresh project for this DLL, so there
> was less of a chance legacy code was the issue]
> 
> We don't control the EXE that calls our DLL, basically we export a
> couple of functions determined by the third party. The EXE that calls
> our DLL is written in C++
> 
> Now the issue is, randomly, but ALWAYS within a few dozen calls, the
> function sqlite3_step access violates.The first 10 calls
> (sqlite3_prepare -> sqlite3_step -> sqlite3_finalise basically) work
> fine, then maybe the 11th sqlite3_step AV's

Sounds like the calling type is different. Do you know if the EXE is
calling your stuff using stdcall or cdecl, and does it match your
functions? If you don't specify, your functions are cdecl. I've seen
this kind of thing when they don't match. It may work a couple of
times, but eventually something blows up.

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven


[sqlite] Access Violations in sqlite3_step when in DLL

2005-04-05 Thread Chris Schirlinger
We have been using SQLite3 for a while now without issues. We are 
running a EXE calling a DLL (Which calls a DLL which eventually uses 
the SQLite functions)

These two DLL's are both written in Delphi - in Windows (with a 
delphi wrapper that runs the SQLite DLL)

This code has worked fine under fairly nasty conditions for a LONG 
time.

Recently we tried to tie in with a third party program that calls one 
of our DLL's (which access the SQLite3 DB and returns a data set)
[Note: We eventually started a fresh project for this DLL, so there 
was less of a chance legacy code was the issue]

We don't control the EXE that calls our DLL, basically we export a 
couple of functions determined by the third party. The EXE that calls 
our DLL is written in C++

Now the issue is, randomly, but ALWAYS within a few dozen calls, the 
function sqlite3_step access violates.The first 10 calls 
(sqlite3_prepare -> sqlite3_step -> sqlite3_finalise basically) work 
fine, then maybe the 11th sqlite3_step AV's

It can be the first, or the 40th but is guarenteed.

We tried using sqlite3_get_table and it does the same thing, same 
sort of AV

We tore out any SQLite3 code but kept every other line of code, 
returning some made up garbage data. The code worked fine without any 
SQlite3 calls, it seems entirely located in sqlite3_step or any call 
that uses it...

Now having used SQLite3 for a while, I'm not convinced the issue is 
in the SQLite3 dll, but maybe the pointer populated by 
sqlite3_prepare is being trashed by one of the various parties... 

Has anyone had issues like this before? Or any ideas as to what we 
can try next?



[sqlite] assertion failing in pager.c :(

2005-04-05 Thread Vineeth R Pillai
Hi,

Can anybody help me with this problem

I want to know why the assert statement

assert( pPg->nRef==0 || pPg->pgno==1 );

is written in the pager_playback_one_page() function
in the pager.c file(line no:573). That assertion is
failing when the memory is low. To be more explanative
while memory becomes low sqliteOswrite() fails and
tryies to roll back. Rollback inturn calls the above
mentioned function and then it fails at the assertion.
I dont see any need for that assertion. More over if u
can see, the assertion is commented in the latest
version sqlite 3.2.0.

I am using the version 2.8.15

A big thanks in advance :)

regards vineeth



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 


RE: [sqlite] ANN: Sqlite3Explorer

2005-04-05 Thread Cariotoglou Mike
good idea. so, let me see if I understood correctly. you are suggesting
that I rewrite the whole program in C++, plus any additional library
code I might be using, so that I can use the widgets. does not sound as
very practical advice to me.. 

> -Original Message-
> From: Guru Kathiresan [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, April 05, 2005 8:21 AM
> To: sqlite-users@sqlite.org
> Subject: RE: [sqlite] ANN: Sqlite3Explorer
> 
> Hi,
> For designing wxWidgets forms like Delphi, you can use my 
> program IDE wx-devcpp from http://wxdsgn.sf.net . Although it 
> is still in beta stage, you can still able to create a decent 
> application with it.
> 
> -Guru Kathiresan
> 
> > -Original Message-
> > From: Leif Jensen [mailto:[EMAIL PROTECTED]
> > Sent: Monday, April 04, 2005 9:53 PM
> > To: sqlite-users@sqlite.org
> > Subject: Re: [sqlite] ANN: Sqlite3Explorer
> > 
> > Have you heard about wxWidgets (www.wxWidgets.org) ? A 
> great free 
> > GUI library (and much more) that works on Windows, Linux 
> and Mac (at 
> > least). Using that and your app. would do too  ;-). I have 
> just made a 
> > database application with these that runs on both Linux and Windows 
> > using SQLite3.
> > 
> >  Leif
> > 
> > 
> > Cariotoglou Mike wrote:
> > 
> > >[EMAIL PROTECTED] it seems the new controls I used require this function, 
> > >which 
> > >only exists in win2k+. sorry for this, I think I will rebuild 
> > >*without* the devexpress controls, for more genral purpose use..
> > >
> > >
> > >
> > >>-Original Message-
> > >>From: Serge Liber [mailto:[EMAIL PROTECTED]
> > >>Sent: Monday, April 04, 2005 8:30 PM
> > >>To: sqlite-users@sqlite.org
> > >>Subject: Re: [sqlite] ANN: Sqlite3Explorer
> > >>
> > >>Hi,
> > >>
> > >>When starting sqlite3Explorer an error message appears:
> > >>"The procedure entry point GdiGradientFill could not be 
> located in 
> > >>the dll GDI32.dll"
> > >>
> > >>How can I proceed?
> > >>
> > >>I use NT4+sp6
> > >>
> > >>Serge Liber
> > >>
> > >>
> > >>New version is out. Since the problem with size limits was not 
> > >>lifted from contrib, I created a home site for the 
> program. You will 
> > >>now be able to get latest version from
> > >>
> > >>http://www.singular.gr/sqlite
> > >>
> > >>Latest is 1.1 , 24/3/2005 (ignore the typo in the date)
> > >>
> > >>Regards,mike
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> > >
> 
> 
> 
> 



RE: [sqlite] ANN: Sqlite3Explorer

2005-04-05 Thread Cariotoglou Mike
I found the offending call and removed it. it was *not* in the
devExpress code, but the visual query builder code. as a result, table
captions are no longer "nice"... pls download again. 

> -Original Message-
> From: Serge Liber [mailto:[EMAIL PROTECTED] 
> Sent: Monday, April 04, 2005 8:30 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] ANN: Sqlite3Explorer
> 
> Hi,
> 
> When starting sqlite3Explorer an error message appears:
> "The procedure entry point GdiGradientFill could not be 
> located in the dll GDI32.dll"
> 
> How can I proceed?
> 




答复: 4p84: [sqlite] Sqlite causes exit error under symbian!

2005-04-05 Thread StevenLiu
Thanks for your reply
I have changed my code as below:
> > > sqlite *db;
> > > char *zErrMsg = 0;
> > > db = sqlite_open("test.db", 0, );
> > > sqlite_close(db);
> > > db = NULL;

Now I am sure that zErrMsg is NULL after sqlite_open(),and I don't get the
"-DOS_UNIX" in my complier , btw ,I use vc6 +sp5 .

Regards,
 
Steven Liu

-邮件原件-
发件人: Dan Kennedy [mailto:[EMAIL PROTECTED] 
发送时间: 2005年4月5日 14:57
收件人: sqlite-users@sqlite.org
主题: Re: 4p84: [sqlite] Sqlite causes exit error under symbian!


> I do have try your suggestion, but it seems to no effect :( 
> For Symbian OS it is very strict with the memory assignation, u must call
> closeSTDLIB() after using some stdlib functions otherwise u will got the
> exit error. 
> So I guess my issue like that But I have no idea about what to deal with
the
> sqlite_open() such as closeSTDLIB().

> > > here is my code :
> > >
> > > sqlite *db;
> > > char *zErrMsg = 0;
> > > db = sqlite_open("test.db", 0, );
> > > sqlite_close(db);
> > > db = NULL;
> > > delete db;

Call closeSTDLIB() before exiting then. SQLite might be using
some of those functions.

Also, check if zErrMsg is still NULL after the sqlite_open call .
SQLite may have allocated space for an error message. Back in 
version 2 you had to free this yourself. Something like:

if( zErrMsg ){
  sqlite_free(zErrMsg);
}

Question: does "-DOS_UNIX" appear as a compiler option when you
are building it? If so there might be a couple of bytes allocated
for a static hash table that aren't being freed.





__ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest




Re: ´ð¸´: [sqlite] Sqlite causes exit error under symbian!

2005-04-05 Thread Dan Kennedy

> I do have try your suggestion, but it seems to no effect :( 
> For Symbian OS it is very strict with the memory assignation, u must call
> closeSTDLIB() after using some stdlib functions otherwise u will got the
> exit error. 
> So I guess my issue like that But I have no idea about what to deal with the
> sqlite_open() such as closeSTDLIB().

> > > here is my code :
> > >
> > > sqlite *db;
> > > char *zErrMsg = 0;
> > > db = sqlite_open("test.db", 0, );
> > > sqlite_close(db);
> > > db = NULL;
> > > delete db;

Call closeSTDLIB() before exiting then. SQLite might be using
some of those functions.

Also, check if zErrMsg is still NULL after the sqlite_open call .
SQLite may have allocated space for an error message. Back in 
version 2 you had to free this yourself. Something like:

if( zErrMsg ){
  sqlite_free(zErrMsg);
}

Question: does "-DOS_UNIX" appear as a compiler option when you
are building it? If so there might be a couple of bytes allocated
for a static hash table that aren't being freed.





__ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest


答复: [sqlite] Sqlite causes exit error under symbian!

2005-04-05 Thread StevenLiu
Thanks for reply!
I do have try your suggestion, but it seems to no effect :( 
For Symbian OS it is very strict with the memory assignation, u must call
closeSTDLIB() after using some stdlib functions otherwise u will got the
exit error. 
So I guess my issue like that But I have no idea about what to deal with the
sqlite_open() such as closeSTDLIB().


Regards,
 
Steven Liu
-邮件原件-
发件人: Thomas Fjellstrom [mailto:[EMAIL PROTECTED] 
发送时间: 2005年4月5日 14:06
收件人: sqlite-users@sqlite.org
主题: Re: [sqlite] Sqlite causes exit error under symbian!

On April 4, 2005 11:58 pm, Dan Kennedy wrote:
> --- StevenLiu <[EMAIL PROTECTED]> wrote:
> > here is my code :
> >
> > sqlite *db;
> > char *zErrMsg = 0;
> > db = sqlite_open("test.db", 0, );
> > sqlite_close(db);
> > db = NULL;
> > delete db;
>
>   ^
>
> Maybe leave that bit out. That's for deleting objects
> allocated with 'new', not SQLite handles.
>

especially since it was set to NULL just before.

-- 
Thomas Fjellstrom
[EMAIL PROTECTED]




Re: [sqlite] Sqlite causes exit error under symbian!

2005-04-05 Thread Thomas Fjellstrom
On April 4, 2005 11:58 pm, Dan Kennedy wrote:
> --- StevenLiu <[EMAIL PROTECTED]> wrote:
> > here is my code :
> >
> > sqlite *db;
> > char *zErrMsg = 0;
> > db = sqlite_open("test.db", 0, );
> > sqlite_close(db);
> > db = NULL;
> > delete db;
>
>   ^
>
> Maybe leave that bit out. That's for deleting objects
> allocated with 'new', not SQLite handles.
>

especially since it was set to NULL just before.

-- 
Thomas Fjellstrom
[EMAIL PROTECTED]