[sqlite] not allowing an empty column

2007-02-02 Thread P Kishor
how do I add a constraint to a column so neither null nor empty strings ("") are allowed? -- Puneet Kishor http://punkish.eidesis.org/ Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/ Open Source Geospatial Foundation http://www.osgeo.org/education/

[sqlite] Re: UNIQUE constraint on column

2007-02-02 Thread A. Pagaltzis
* Dennis Cote <[EMAIL PROTECTED]> [2007-02-03 01:30]: > If you wanted to model what the insert or ignore is doing more > directly, you could do something like this. > > rowid = select rowid from Strings where value = 'foo'; > if rowid is null then >insert into Strings values ('foo'); >

Re: [sqlite] Another sybase conversion question

2007-02-02 Thread Joe Wilson
--- "Anderson, James H (IT)" <[EMAIL PROTECTED]> wrote: > The following works fine in sybase, but because in sqlite "update" does > not support "from" it doesn't work. Is there another way of doing this? > > Thanks, > > Jim > > update C1_credDerivEvent >set CDEvent = a.CDEvent || ',' ||

Re: [sqlite] Another sybase conversion question

2007-02-02 Thread Jeff Godfrey
- Original Message - From: "Rich Shepard" <[EMAIL PROTECTED]> But, if you're going to do much with SQLite, I strongly recommend Mike Owens' "The Definitive Guide to SQLite" by Apress. The index is shamefully bad, but the book is a gem and has been a great help to me. Very highly

Re: [sqlite] Re: UNIQUE constraint on column

2007-02-02 Thread Dennis Cote
Shane Harrelson wrote: Yes, I could do that, but the point of this thread was to find someway around doing the subsequent SELECT on a constraint collision during an INSERT into the strings table. I'm using the C API, and looking at the internals of the VBDE, the rowid responsible for the

Re: [sqlite] Another sybase conversion question

2007-02-02 Thread Rich Shepard
On Fri, 2 Feb 2007, Anderson, James H (IT) wrote: The following works fine in sybase, but because in sqlite "update" does not support "from" it doesn't work. Is there another way of doing this? Jim, I'm in the midst of trying to meet a deadline, so I'll let someone more knowledgable

[sqlite] Another sybase conversion question

2007-02-02 Thread Anderson, James H \(IT\)
The following works fine in sybase, but because in sqlite "update" does not support "from" it doesn't work. Is there another way of doing this? Thanks, Jim update C1_credDerivEvent set CDEvent = a.CDEvent || ',' || b.CDEvent from C1_credDerivEvent a, C1_tmp_credDerivEvent b,

Re: [sqlite] Re: UNIQUE constraint on column

2007-02-02 Thread Shane Harrelson
On 2/2/07, Dennis Cote <[EMAIL PROTECTED]> wrote: Shane Harrelson wrote: > On 2/2/07, A. Pagaltzis <[EMAIL PROTECTED]> wrote: >> * Nicolas Williams <[EMAIL PROTECTED]> [2007-02-01 00:10]: >> > Sounds like you should want to use INSERT OR IGNORE ... INTO >> > Strings and then SELECT the rowid of

Re: [sqlite] Re: UNIQUE constraint on column

2007-02-02 Thread Dennis Cote
Shane Harrelson wrote: On 2/2/07, A. Pagaltzis <[EMAIL PROTECTED]> wrote: * Nicolas Williams <[EMAIL PROTECTED]> [2007-02-01 00:10]: > Sounds like you should want to use INSERT OR IGNORE ... INTO > Strings and then SELECT the rowid of the string for use in > INSERTing INTO Object. That was my

Re: [sqlite] "select into" ?

2007-02-02 Thread Dennis Cote
Anderson, James H (IT) wrote: Sybase supports "select into" but sqllite does not seem to. Here's a sybase example: select distinct CDId, CDEvent into credDerivEvent from credDerivOrig This query creates the table credDerivEvent. Is there anythin comparable in sqlite? Thanks, jim

RE: [sqlite] "select into" ?

2007-02-02 Thread Anderson, James H \(IT\)
Perfect! Thanks. -Original Message- From: Gerry Snyder [mailto:[EMAIL PROTECTED] Sent: Friday, February 02, 2007 5:28 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] "select into" ? Anderson, James H (IT) wrote: > Sybase supports "select into" but sqllite does not seem to. Here's

Re: [sqlite] "select into" ?

2007-02-02 Thread Gerry Snyder
Anderson, James H (IT) wrote: Sybase supports "select into" but sqllite does not seem to. Here's a sybase example: select distinct CDId, CDEvent into credDerivEvent from credDerivOrig This query creates the table credDerivEvent. Is there anythin comparable in sqlite? How about CREATE

RE: [sqlite] "select into" ?

2007-02-02 Thread Anderson, James H \(IT\)
"select into" creates the table; "insert into" requires that the table already exist. -Original Message- From: Jeff Godfrey [mailto:[EMAIL PROTECTED] Sent: Friday, February 02, 2007 5:12 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] "select into" ? > - Original Message -

Re: [sqlite] "select into" ?

2007-02-02 Thread Jeff Godfrey
- Original Message - From: "Anderson, James H (IT)" <[EMAIL PROTECTED]> Sybase supports "select into" but sqllite does not seem to. Here's a sybase example: select distinct CDId, CDEvent into credDerivEvent from credDerivOrig This query creates the table credDerivEvent. Is there

[sqlite] "select into" ?

2007-02-02 Thread Anderson, James H \(IT\)
Sybase supports "select into" but sqllite does not seem to. Here's a sybase example: select distinct CDId, CDEvent into credDerivEvent from credDerivOrig This query creates the table credDerivEvent. Is there anythin comparable in sqlite? Thanks, jim

Re: [sqlite] Auto-detection of database change in multi-process environment

2007-02-02 Thread GBanschbach
If you are just looking for a simple detection, a process could "touch" or update a flag file, which might be empty or whatever. I have not seen the C API. I am not sure about the scope or effort. But, there could be other methods. One might be to "mark" records with pending / changed

Re: [sqlite] Where could i find?

2007-02-02 Thread Ulrik Petersen
Hi Cesar, you can find what you are seeking in the CVS repository: 1) log in as anonymous: cvs -d :pserver:[EMAIL PROTECTED]:/sqlite login password: anonymous 2) checkout the current version cvs -d :pserver:[EMAIL PROTECTED]:/sqlite checkout sqlite 3) Enter the sqlite directory: cd sqlite

Re: [sqlite] Re: UNIQUE constraint on column

2007-02-02 Thread Shane Harrelson
On 2/2/07, A. Pagaltzis <[EMAIL PROTECTED]> wrote: * Nicolas Williams <[EMAIL PROTECTED]> [2007-02-01 00:10]: > Sounds like you should want to use INSERT OR IGNORE ... INTO > Strings and then SELECT the rowid of the string for use in > INSERTing INTO Object. That was my first thought as well.

[sqlite] Re: UNIQUE constraint on column

2007-02-02 Thread A. Pagaltzis
* Nicolas Williams <[EMAIL PROTECTED]> [2007-02-01 00:10]: > Sounds like you should want to use INSERT OR IGNORE ... INTO > Strings and then SELECT the rowid of the string for use in > INSERTing INTO Object. That was my first thought as well. Does SQLite return the row’s last_insert_id correctly

Re: [sqlite] Appropriate uses for SQLite

2007-02-02 Thread Alex Roston
Scott Hess wrote: On 2/2/07, Dennis Cote <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: > The problem is, not many network filesystems work correctly. I'm sure someone knows which versions of NFS have working file locking, at least under Linux. I doubt it is this easy. You need to line

RE: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread RB Smissaert
The trouble always starts before I deal with the array, so I am sure that the trouble is not there. There are only 2 places where I have seen the trouble occur: 1. When I call sqlite_get_table 2. When I assign the array produced by sqlite_get_table to the wrapper function. Yes, this is a

Re: [sqlite] Appropriate uses for SQLite

2007-02-02 Thread Scott Hess
On 2/2/07, Dennis Cote <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: > The problem is, not many network filesystems work correctly. I'm sure someone knows which versions of NFS have working file locking, at least under Linux. I doubt it is this easy. You need to line up a bunch of

Re: [sqlite] Where could i find?

2007-02-02 Thread Cesar Rodas
I just try-out on http://www.sqlite.org/sqlite-1.0.18.tar.gz and doesn't work... please if any body have the source.. I really need it.. thanks to all On 02/02/07, Cesar Rodas <[EMAIL PROTECTED]> wrote: I am wondering if there is a place on the net that I could download all the version of

Re: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread Trey Mack
The function ArrayToSheet has nil to do with SQLite and I left that out. Ah, but that's where you access the variant array. That can be tricksy. Do you always access that variant array (arr) in the range (0 To NumRecords, 0 To NumColumns - 1) where the row arr(0, *) holds the column names,

[sqlite] Re: special characters in sqlite3_bind_text

2007-02-02 Thread Igor Tandetnik
Dixon Hutchinson wrote: I am having a problem with single quotes in a C program. Consider a simple table CREATE TABLE t(comp TEXT); Lets say I use sqlite3_prepare to prepare the following string: "SELECT rowid FROM table WHERE comp=?;" Shouldn't that be SELECT rowid FROM t WHERE comp=?;

[sqlite] special characters in sqlite3_bind_text

2007-02-02 Thread Dixon Hutchinson
I am having a problem with single quotes in a C program. Consider a simple table CREATE TABLE t(comp TEXT); Lets say I use sqlite3_prepare to prepare the following string: "SELECT rowid FROM table WHERE comp=?;" And then I call sqlite3_bind_text to bind "abc'def" to the statement. And

Re: [sqlite] Appropriate uses for SQLite

2007-02-02 Thread Clark Christensen
FWIW, I'm not convinced Samba has locking working correctly. Using a very recent Samba version, I managed to corrupt a SQLite database last fall by (I think) doing simultaneous writes from the Linux host box, and my WinXP client box (via a SMB drive map). I'm guessing the XP writes started

[sqlite] Where could i find?

2007-02-02 Thread Cesar Rodas
I am wondering if there is a place on the net that I could download all the version of sqlite? I mean sqlite v1.x.x, sqlite v2.x.x I really want the 1.x.x becouse the code is easier to understand, and is simplest that the sqlite3 -- Cesar Rodas http://www.sf.net/projects/pagerank (The

Re: [sqlite] Appropriate uses for SQLite

2007-02-02 Thread Alex Roston
Dennis Cote wrote: [EMAIL PROTECTED] wrote: The problem is, not many network filesystems work correctly. Hi All, If my understanding of this is correct, SQLite only requires that the network file system has; reliable data transport and working file locking. This has primarily been an issue

Re: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread Trey Mack
- Original Message - From: "Guy Hachlili" <[EMAIL PROTECTED]> To: Sent: Friday, February 02, 2007 10:13 AM Subject: RE: [sqlite] How do I know sqlite_get_table is finished In any case, I've worked a bit on the function, and here's the result: Thanks alot.

Re: [sqlite] Appropriate uses for SQLite

2007-02-02 Thread Dennis Cote
[EMAIL PROTECTED] wrote: The problem is, not many network filesystems work correctly. Hi All, If my understanding of this is correct, SQLite only requires that the network file system has; reliable data transport and working file locking. This has primarily been an issue on older

RE: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread bartsmissaert
Thanks for that, will have a look at the altered C code, but not sure yet if I can compile. Just have never done it yet. As I posted earlier I think I have found the trouble. Due to a simple typo I enclosed the queries in that table SQL in double quotes, where it should have been single quotes.

RE: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread Guy Hachlili
Hello. At 14:32 2/2/2007 +, you wrote: lReturnedRows is one of the function arguments, so that is fine. I have made some progress though and that is that this problem only occurs with this particular table, called SQL. It is a table that logs all the SQL statements that run in my app. When

RE: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread bartsmissaert
Thanks for the offer. I think I just figured what the trouble was. The query in that table should be enclosed in single quotes as it is a TEXT field. Instead though I had enclosed it in double quotes, so I did chr(34) & strQuery & chr(34) instead of: chr(39) & strQuery & chr(39) Had to go to

Re: [sqlite] Sqlite - tcl "trace" method

2007-02-02 Thread drh
"Jeff Godfrey" <[EMAIL PROTECTED]> wrote: > Hi All, > > I'm working on a tcl/sqlite based app. For the first time, I > just registered a callback with the trace method so I could "see" > all of my SQL interactions as they happen. While it does work as > advertised, it seems to output each SQL

Re: [sqlite] Auto-detection of database change in multi-process environment

2007-02-02 Thread Ken
As I see it you have only 3 options. 1. Polling. Polling on a table in sqlite or depending upon your app. You could simply check the file access modifiers to see when the last modifaction time was. 2. Set up an IPC semaphore 3. Set up a socket. David GIGUET <[EMAIL PROTECTED]>

RE: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread epankoke
If you want to email me a copy of the table I'd be more than happy to try running it here and see what happens. You can send it to epankoke @ gmail dot com. -- Eric Pankoke Founder / Lead Developer Point Of Light Software http://www.polsoftware.com/ -- Original message

[sqlite] Sqlite - tcl "trace" method

2007-02-02 Thread Jeff Godfrey
Hi All, I'm working on a tcl/sqlite based app. For the first time, I just registered a callback with the trace method so I could "see" all of my SQL interactions as they happen. While it does work as advertised, it seems to output each SQL statement prior to having resolved any variables

RE: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread RB Smissaert
lReturnedRows is one of the function arguments, so that is fine. I have made some progress though and that is that this problem only occurs with this particular table, called SQL. It is a table that logs all the SQL statements that run in my app. When I instead make this for example sqlite_master

Re: [sqlite] sqlite core function question

2007-02-02 Thread T
Hi Jay, or better yet, I expected this to work, using the modulo operator %: SELECT x - x % 1; Isn't that evaluated left to right? x-x = 0 0 %1 = 0 I don't think so. Well, yes, it is generally evaluated left to right, but mod has precedence of minus, so it gets evaluated first. So even

RE: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread epankoke
I'll admit I'm not much of a C expert, so I'd say Guy has a much better handle on that part than I do. As far as your code goes I only had one thought, and forgive me if this is just my ignorance of VBA. I didn't see a declaration for lReturnedRows anywhere. If you don't declare a variable,

Re: [sqlite] sqlite core function question

2007-02-02 Thread Jay Sprenkle
On 1/31/07, T <[EMAIL PROTECTED]> wrote: or better yet, I expected this to work, using the modulo operator %: SELECT x - x % 1; Isn't that evaluated left to right? x-x = 0 0 %1 = 0 -- -- The PixAddixImage Collector suite: http://groups-beta.google.com/group/pixaddix SqliteImporter and

Re: [sqlite] PayPal Policy Alert

2007-02-02 Thread Martin Jenkins
Jim Dodgen wrote: Ha!! Indeed ;) Firefox warns that the page is a forgery and DNS fails so it's already been zapped. Martin - To unsubscribe, send email to [EMAIL PROTECTED]

RE: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread bartsmissaert
Thanks for looking at that. The crash can happen at the actual call to sqlite_get_table or it can happen when I assign the resulting array to the wrapper function, so when I do: GetFromDB = arr Yes, I would be interested in making a boolean (optional) argument in sqlite_get_table that can leave

[sqlite] Auto-detection of database change in multi-process environment

2007-02-02 Thread David GIGUET
Hi, Iam working on the design of a multi-process architecture accessing a single database. Is there a way for one of the process to detect that another process has modified the database ? I would like to avoid regular polling of the database to check for modifications and I also would like to

RE: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread Guy Hachlili
At 07:44 2/2/2007 +, you wrote: Sure, here it is: Looking at the C code published at http://www.tannertech.net/sqlite3vb/index.htm , it seems very risky - there are a lot of places it can fail to allocate memory (for example), and the use of some variables looks like it could randomly