Re: [sqlite] TYPEOF in triggers

2005-02-10 Thread Eric Bohlman
Witold Czarnecki wrote: I just tested it on 3.0.8 and - you are right - it works. Is there any reason to use 2.8 instead of 3.0? I use SQLite via python (pysqlite). 3.x uses a different database file format than 2.8, and the APIs are sufficiently different that they'd need different Python bindin

[sqlite] Reset values if insert fails

2005-02-10 Thread Keith Herold
I have a question about how to reset values if an insert fails. Using the following tables, is there any relatively straightforward way to set LastNameIDInserted to -1 if the UNIQUE constraint on tblNames fails? CREATE TABLE tblNames ( NameID INTEGER PRIMARY KEY, First CHAR(10), Last CHA

[sqlite] implementing ALTER TABLE .. ADD COLUMN

2005-02-10 Thread Vladimir Vukicevic
It seems that after ALTER TABLE .. RENAME TO, ADD COLUMN is probably the most common, probably followed by DROP COLUMN. I'd like to take a crack at adding support for ADD COLUMN. It seems that I can do this via VDBE -- it seems similar to doing an UPDATE across the entire table, reading the exist

Re: [sqlite] TYPEOF in triggers

2005-02-10 Thread Witold Czarnecki
2.8.15 I just tested it on 3.0.8 and - you are right - it works. Is there any reason to use 2.8 instead of 3.0? I use SQLite via python (pysqlite). Best regards, Witold - Original Message - From: "D. Richard Hipp" <[EMAIL PROTECTED]> To: Sent: Friday, February 11, 2005 12:16 AM Subject:

Re: [sqlite] TYPEOF in triggers

2005-02-10 Thread D. Richard Hipp
On Thu, 2005-02-10 at 23:59 +0100, Witold Czarnecki wrote: > sqlite> CREATE TABLE test(a NUMERIC); > sqlite> CREATE TRIGGER test1 BEFORE INSERT ON test FOR EACH ROW BEGIN >...> SELECT CASE WHEN (TYPEOF(NEW.a) != 'numeric') THEN RAISE(ABORT, > 'Error!') END; >...> END; > sqlite> INSERT IN

[sqlite] TYPEOF in triggers

2005-02-10 Thread Witold Czarnecki
Can you help?: sqlite> CREATE TABLE test(a NUMERIC); sqlite> CREATE TRIGGER test1 BEFORE INSERT ON test FOR EACH ROW BEGIN ...> SELECT CASE WHEN (TYPEOF(NEW.a) != 'numeric') THEN RAISE(ABORT, 'Error!') END; ...> END; sqlite> INSERT INTO test VALUES('aaa'); sqlite> SELECT TYPEOF(a) FROM te

Re: [sqlite] exact copy of an existing Table

2005-02-10 Thread Chris Schirlinger
> SQLiters: > what would be the most efficient method for creating an exact copy of an > existing table with all the columns and data of the existing table? You could just do this from commandline in SQL like so: CREATE TABLE newTable AS SELECT * FROM oldTable; That makes a new tables, same sch

[sqlite] exact copy of an existing Table

2005-02-10 Thread Uriel_Carrasquilla
SQLiters: what would be the most efficient method for creating an exact copy of an existing table with all the columns and data of the existing table? Regards, Uriel_Carrasquilla

Re: [sqlite] would someone check my SQL..

2005-02-10 Thread Witold Czarnecki
You may try: SELECT NULL FROM sqlite_master WHERE tbl_name = 'table'; - Original Message - From: "Asko Kauppi" <[EMAIL PROTECTED]> To: Sent: Thursday, February 10, 2005 5:08 PM Subject: Re: [sqlite] would someone check my SQL.. Is it true that in SQLite one has no way to check (at CREAT

Re: [sqlite] would someone check my SQL..

2005-02-10 Thread Asko Kauppi
Is it true that in SQLite one has no way to check (at CREATE TABLE statement itself) whether the table already is there? I got this from a person more accustomed to MySQL: >in mysql, the CREATE TABLE command has a 'IF NOT EXISTS' option, but as i >said, it's a non-standard extension. >

Re: [sqlite] Speeding up your SQLite DB (Windows mostly)

2005-02-10 Thread Uriel_Carrasquilla
This is terrific. does anybody have something similar for the perl-dbi/SQLite world? Regards, [EMAIL PROTECTED] NCCI Boca Raton, Florida 561.893.2415 greetings / avec mes meilleures salutations / Cordialmente mit freundlichen Grüßen / Med vänlig hälsning

Re: [sqlite] Speeding up your SQLite DB (Windows mostly)

2005-02-10 Thread Chris Schirlinger
> standard VCL stuff so there's a little overhead. But surely not as dramatic as > suggested. But there's one condition. Use transactions! Without them, you'll > never get a good performance. Perhaps not dramatic no, but I was getting to the point where I am setting DB page sizes to match OS Clu

[sqlite] Does the list in tokenize.c represent the entire set of keywords?

2005-02-10 Thread mswarm
Being a compulsive reinventor of wheels, I've made my SQL code editor smart enough to highlight the offending line of bad SQL--not a major leap in technology, but fun nonetheless. Now I'd like to color-code the SQL. I found this list of keywords in tokenize.c. A little search-and-replace-- replac

Re: [sqlite] Speeding up your SQLite DB (Windows mostly)

2005-02-10 Thread albert drent
Quoting Chris Schirlinger <[EMAIL PROTECTED]>: > > I wouldn't sell the BDE-style components short, as they may be useful > > for some, if well-written and well-documented, but I like simple. The (Borland) BDE is a lot of overhead conceirning database access, but it's a transparent layer allowing