[sqlite] [Fwd: rummage bin of C API questions]

2007-01-25 Thread Lucas (a.k.a T-Bird or bsdfan3)
Please bear with me here, as this list may seem rather long. 1) Which of the C API routines allocate memory that my code must free? 2) Can COMMIT TRANSACTION and ROLLBACK TRANSACTION fail? 3) Which of the C API routines cannot fail? 4) C API routines with pointer return values return NULL

Re: [sqlite] [Fwd: rummage bin of C API questions]

2007-01-25 Thread anis chaaba
2007/1/25, anis chaaba <[EMAIL PROTECTED]>:hello 1-I'm trying to remember and i think that all routines that execute queries need to free the error message variable like sqlite_exec or others. 2- No transactions fail while you're writing clean code 3- While u'r allocationg and freeing all your

Re: [sqlite] lemon issue

2007-01-25 Thread Gunnar Roth
[EMAIL PROTECTED] schrieb: > dear all: > i am a programmer from China, i use sqlite in my project. > from sqlite, i know lemon. > i work on windows, using vc6.0, i am trying to do something using lemon, > but i have some issues. > i write a my_calculator.y file, and generate

Re: [sqlite] SQLite3VB.dll

2007-01-25 Thread Dennis Cote
RB Smissaert wrote: 'these speed up inserts enormously, particulary the first one ' sqlite_get_table lDBHandle, "PRAGMA synchronous=off;", strErrors sqlite_get_table lDBHandle, "PRAGMA encoding='UTF-8';",

Re: [sqlite] Re: Shared Lock Transactions

2007-01-25 Thread Ken
>From os_unix.h:... After reading this, locking makes more sense! Although the Lock may physically be an exclusive lock, the implementation is actually a logcially "SHARED" lock. /* The following describes the implementation of the various locks and ** lock transitions in terms

[sqlite] How to conditionally drop a table?

2007-01-25 Thread Anderson, James H \(IT\)
I need a way to drop a table only if that table exists. How would I do that? Thanks, jim NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread G. Roderick Singleton
On Thu, 2007-01-25 at 10:35 -0500, Anderson, James H (IT) wrote: > I need a way to drop a table only if that table exists. How would I do > that? > > Thanks, Are you asking if http://sqlite.org/lang_droptable.html works or have you had problems? -- G. Roderick Singleton <[EMAIL PROTECTED]> PATH

RE: [sqlite] How to conditionally drop a table?

2007-01-25 Thread Anderson, James H \(IT\)
Sorry, I should have checked the site first. My background is sybase and I didn't expect anything so simple. Thanks very much, jim -Original Message- From: G. Roderick Singleton [mailto:[EMAIL PROTECTED] Sent: Thursday, January 25, 2007 10:49 AM To: sqlite-users@sqlite.org Subject:

[sqlite] Another (possibly dumb) question

2007-01-25 Thread Anderson, James H \(IT\)
For select, update, insert, or delete is there a way to get the number of rows affected? Thanks, jim NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this

Re: [sqlite] Another (possibly dumb) question

2007-01-25 Thread Ralf Junker
>For select, update, insert, or delete is there a way to get the number >of rows affected? http://www.sqlite.org/capi3ref.html#sqlite3_changes Ralf - To unsubscribe, send email to [EMAIL PROTECTED]

RE: [sqlite] Another (possibly dumb) question

2007-01-25 Thread Anderson, James H \(IT\)
Thanks. -Original Message- From: Ralf Junker [mailto:[EMAIL PROTECTED] Sent: Thursday, January 25, 2007 11:37 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Another (possibly dumb) question >For select, update, insert, or delete is there a way to get the number >of rows

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread John Stanton
If you find a way to drop a table which dosn't exist. let us know how you do it. G. Roderick Singleton wrote: On Thu, 2007-01-25 at 10:35 -0500, Anderson, James H (IT) wrote: I need a way to drop a table only if that table exists. How would I do that? Thanks, Are you asking if

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread G. Roderick Singleton
On Thu, 2007-01-25 at 11:13 -0600, John Stanton wrote: > If you find a way to drop a table which dosn't exist. let us know how > you do it. > > G. Roderick Singleton wrote: > > On Thu, 2007-01-25 at 10:35 -0500, Anderson, James H (IT) wrote: > > > >>I need a way to drop a table only if that

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread Martin Jenkins
G. Roderick Singleton wrote: On Thu, 2007-01-25 at 11:13 -0600, John Stanton wrote: If you find a way to drop a table which dosn't exist. let us know how you do it. Thanks for your insight. However what's your point? That the OP didn't check the website, that my reference was incorrect

RE: [sqlite] How to conditionally drop a table?

2007-01-25 Thread Fred Williams
> -Original Message- > From: G. Roderick Singleton [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 25, 2007 12:06 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] How to conditionally drop a table? > > > On Thu, 2007-01-25 at 11:13 -0600, John Stanton wrote: > > If you find a

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread jose isaias cabrera
Fred, I got it right away. And I just don't laugh for the fun of it. :-) It's gotta be funny. Was it a tad harsh? Yeah... But it was funny. - Original Message - From: "Fred Williams" <[EMAIL PROTECTED]> To: Sent: Thursday, January 25, 2007 1:42 PM

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread Nicolas Williams
On Thu, Jan 25, 2007 at 10:35:23AM -0500, Anderson, James H (IT) wrote: > I need a way to drop a table only if that table exists. How would I do > that? You'd think this would work: SELECT CASE WHEN (SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name = 'foo') > 0

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread G. Roderick Singleton
On Thu, 2007-01-25 at 18:40 +, Martin Jenkins wrote: > G. Roderick Singleton wrote: > > On Thu, 2007-01-25 at 11:13 -0600, John Stanton wrote: > > > >> If you find a way to drop a table which dosn't exist. let us know how > >> you do it. > >> > > Thanks for your insight. However

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread P Kishor
DROP TABLE [IF EXISTS] DROP INDEX [IF EXISTS] CREATE TABLE [IF NOT EXISTS] and so on... On 1/25/07, Nicolas Williams <[EMAIL PROTECTED]> wrote: On Thu, Jan 25, 2007 at 10:35:23AM -0500, Anderson, James H (IT) wrote: > I need a way to drop a table only if that table exists. How would I do >

[sqlite] building in fts[12] on OSX

2007-01-25 Thread Jason Jobe
Hello, I just downloaded the latest version (3.3.11). It configures and build fine out-of-the-box on OSX (10.4.8) BUT I can't seem to get the Full Text Search extension working and / or linked into the library / sqlite shell. I tried adding the suggested flags in the Makefile to no

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread John Stanton
Martin Jenkins wrote: G. Roderick Singleton wrote: On Thu, 2007-01-25 at 11:13 -0600, John Stanton wrote: If you find a way to drop a table which dosn't exist. let us know how you do it. Thanks for your insight. However what's your point? That the OP didn't check the website, that

[sqlite] can select but not insert. File is set rw to all (sqlite3)

2007-01-25 Thread DTK
Hello, I am trying to get started with sqlite3. Seams there is still something wrong with my setup. I am stuck and was wondering if someone could give me a hand. I can select but it wont let me insert or update the database. The error is "unable to open database file" however it does open the

RE: [sqlite] Fix for sqlite3.h in version 3.3.10

2007-01-25 Thread James Dennett
> -Original Message- > From: Joe Wilson [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 24, 2007 5:04 PM > To: sqlite-users@sqlite.org > Subject: RE: [sqlite] Fix for sqlite3.h in version 3.3.10 > > --- James Dennett <[EMAIL PROTECTED]> wrote: > > Joe Wilson wrote: > > > The

Re: [sqlite] How to conditionally drop a table?

2007-01-25 Thread Martin Jenkins
jose isaias cabrera wrote: I got it right away. And I just don't laugh for the fun of it. :-) It's gotta be funny. Was it a tad harsh? Yeah... But it was funny. See http://c2.com/cgi/wiki?ZenSlap Martin - To

[sqlite] Dumb Newbie Question - Comparison if sqlite index to STL

2007-01-25 Thread Ben Supnik
Hi Y'all, Please forgive what I think is probably a dumb question, but... I am porting my app's data model from C++/STL to sqlite. My goal is scalability - even if I implement my data model in C++ using data structures that give me good O(N) time (e.g. use trees, hash tables, etc.) the

[sqlite] OS X: "database locked" when trying to use a database on DVD-ROM

2007-01-25 Thread Plissonneau Duquene, Julien
Hi, I get the "Error: database is locked" when trying to do anything (select, pragma, getting file version etc) with a database stored on a DVD-ROM under OS X. This happens with the (fairly old) version 3.1.3 bundled with OS X, and also with the (less old) version 3.3.8 in a custom-built

[sqlite] enforcing Foreign Keys

2007-01-25 Thread Mag Gam
Hi All, I am new to sqlite, and liking it a lot so far. My only problem is there is no native foreign key/data integrity. Are there plans to include FKs in future releases? I have been reading, http://www.rcs-comp.com/site/index.php/view/Utilities-SQLite_foreign_key_trigger_generator But this

Re: [sqlite] Dumb Newbie Question - Comparison if sqlite index to STL

2007-01-25 Thread Jay Sprenkle
On 1/25/07, Ben Supnik <[EMAIL PROTECTED]> wrote: Hi Y'all, Please forgive what I think is probably a dumb question, but... I am porting my app's data model from C++/STL to sqlite. My goal is scalability - even if I implement my data model in C++ using data structures that give me good O(N)

Re: [sqlite] enforcing Foreign Keys

2007-01-25 Thread Dan McDaniel
Can someone tell me how to unsubscribe. I have sent two messages to the link and have had no luck thank you. --- Mag Gam <[EMAIL PROTECTED]> wrote: > Hi All, > > I am new to sqlite, and liking it a lot so far. My > only problem is there is > no native foreign key/data integrity. Are there >

Re: [sqlite] enforcing Foreign Keys

2007-01-25 Thread Martin Jenkins
Dan McDaniel wrote: Can someone tell me how to unsubscribe. I have sent two messages to the link and have had no luck thank you. --- Mag Gam <[EMAIL PROTECTED]> wrote: Send a mail to [EMAIL PROTECTED] - it has directions on how to unsubscribe if the standard method fails. I just tried it

[sqlite] selecting a random record from a table

2007-01-25 Thread P Kishor
1. given a non-sequential id, select all the ids 2. grab a random id 3. select the row with that id. is there a better way of accomplishing this, one that requires a single round-trip to the db? -- Puneet Kishor http://punkish.eidesis.org/ Nelson Inst. for Env. Studies, UW-Madison

[sqlite] Re: selecting a random record from a table

2007-01-25 Thread Igor Tandetnik
P Kishor <[EMAIL PROTECTED]> wrote: 1. given a non-sequential id, select all the ids 2. grab a random id 3. select the row with that id. is there a better way of accomplishing this, one that requires a single round-trip to the db? If you can somehow keep track of the number of rows (N) in the

Re: [sqlite] selecting a random record from a table

2007-01-25 Thread Artem Yankovskiy
select * from table1 order by random(id) limit 1 ? --- P Kishor <[EMAIL PROTECTED]> wrote: > 1. given a non-sequential id, select all the ids > 2. grab a random id > 3. select the row with that id. > > is there a better way of accomplishing this, one > that requires a > single round-trip to the

Re: [sqlite] selecting a random record from a table

2007-01-25 Thread P Kishor
On 1/25/07, Artem Yankovskiy <[EMAIL PROTECTED]> wrote: select * from table1 order by random(id) limit 1 Yes, very nice, thank you. I am not familiar with the "ORDER BY random(col)" idiom. How does this work? (It does work alright). --- P Kishor <[EMAIL PROTECTED]> wrote: > 1. given a

[sqlite] Re: selecting a random record from a table

2007-01-25 Thread Igor Tandetnik
P Kishor <[EMAIL PROTECTED]> wrote: On 1/25/07, Artem Yankovskiy wrote: select * from table1 order by random(id) limit 1 Yes, very nice, thank you. I am not familiar with the "ORDER BY random(col)" idiom. How does this work? (It does work alright). random(anything) produces a random

Re: [sqlite] selecting a random record from a table

2007-01-25 Thread Joe Wilson
> select * from table1 order by random() limit 1 If you're performing a select on a single table (not a view, join or a subquery) and you are selecting many columns (say > 6) and the table has a very large number of rows, then this query will run faster on recent versions of sqlite3: select *

Re: [sqlite] selecting a random record from a table

2007-01-25 Thread Joe Wilson
This is not strictly random, but will select a row in near constant time regardless of the number of rows in the select: -- let's assume you know you only have 65535 rows... select * from table1 where rowid = random() & 65535 union all select * from table1 where rowid = random() &

Re: [sqlite] selecting a random record from a table

2007-01-25 Thread Joe Wilson
(Pardon me if this email is a duplicate, but I think the last copy was interpreted as spam due to the repetition of rows in the SQL.) This is not strictly random, but will select a pseudo-random row in near constant time regardless of the number of rows in the table: -- let's assume you know