Re: [sqlite] Concatenation question

2008-09-11 Thread Dennis Cote
Clark Christensen wrote: > > Long setup for a simple question: Is null the expected result when > one column of a concatenation operation is null? > Yes, that is the result required by the SQL standard. The result of a concatenation operator is NULL if either argument is NULL. HTH Dennis Cote

Re: [sqlite] Concatenation question

2008-09-11 Thread Igor Tandetnik
Clark Christensen <[EMAIL PROTECTED]> wrote: > Long setup for a simple question: Is null the expected result when > one column of a concatenation operation is null? Yes. Pretty much any operation where at least one operand is NULL produces a NULL. See also http://sqlite.org/nulls.html Igor Tand

[sqlite] Concatenation question

2008-09-11 Thread Clark Christensen
Hello, Using SQLite v3.3.13, this query: select oid || '|' || email_addr || '|' || residual_value as RD from gl_claims c where --RD is not null and status = 1 and not exists (select 1 from gl_claim_tickets where ticket_type = 'coupon' and claim_id = c.oid); I expect one ro

Re: [sqlite] Backticks in Column Names

2008-09-11 Thread D. Richard Hipp
On Sep 11, 2008, at 1:11 PM, Gavin Kistner wrote: > So I ask again: can the inclusion of backticks in the column name > returned as the result for certain select statements be considered a > bug? In the absence of an AS clause, SQLite makes no promises about column names. If you want a specif

Re: [sqlite] Backticks in Column Names

2008-09-11 Thread Gavin Kistner
On Sep 11, 2008, at 10:49 AM, Igor Tandetnik wrote: > Gavin Kistner <[EMAIL PROTECTED]> wrote: >> The presence of backticks in the column header name is causing the >> ORB >> library I'm working with to think that the name of the column is >> "`bar`" instead of "bar". >> See: >> http://groups.goo

Re: [sqlite] Backticks in Column Names

2008-09-11 Thread Igor Tandetnik
Gavin Kistner <[EMAIL PROTECTED]> wrote: > The presence of backticks in the column header name is causing the ORB > library I'm working with to think that the name of the column is > "`bar`" instead of "bar". > See: > http://groups.google.com/group/sequel-talk/browse_frm/thread/915c6f807f6d61c1 > >

[sqlite] Backticks in Column Names

2008-09-11 Thread Gavin Kistner
> SQLite version 3.5.6 > Enter ".help" for instructions > sqlite> create table 'foo' (bar 'text'); > sqlite> insert into 'foo' values ('a'); > sqlite> .headers on > sqlite> select * from foo; > bar > a > sqlite> select "bar" from foo; > bar > a > sqlite> select `bar` from foo; > bar > a > sqlite> s

Re: [sqlite] Considerations with in-memory SQLite3

2008-09-11 Thread Mohit Sindhwani
Dennis Cote wrote: > That looks right to me. > Thanks for the quick check, Dennis. > There is no need to create an index on the temporary id_list, since you > are going to be doing a full table scan of that table anyway. > >select * >from id_list >join mt.table on mt.table.id = id

Re: [sqlite] Efficient query of 2 related tables

2008-09-11 Thread P Kishor
On 9/11/08, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > P Kishor <[EMAIL PROTECTED]> wrote: > > why? Because INTEGER PRIMARY KEY already provides AUTOINCREMENT > > > There's a difference in using INTEGER PRIMARY KEY with and without > AUTOINCREMENT keyword: http://www.sqlite.org/autoinc.html > >

Re: [sqlite] Efficient query of 2 related tables

2008-09-11 Thread Igor Tandetnik
P Kishor <[EMAIL PROTECTED]> wrote: > why? Because INTEGER PRIMARY KEY already provides AUTOINCREMENT There's a difference in using INTEGER PRIMARY KEY with and without AUTOINCREMENT keyword: http://www.sqlite.org/autoinc.html Igor Tandetnik ___ sq

Re: [sqlite] Efficient query of 2 related tables

2008-09-11 Thread Dennis Cote
Thomas DILIGENT wrote: > I have 2 tables: > > A: _ID autoinc primary key >name text >b integer foreign key to table B > > B: _ID autoinc primary key >name text > > In sql: > CREATE TABLE "A" ("_ID" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "name" > TEXT, "b" INTEGER NOT NULL

Re: [sqlite] Considerations with in-memory SQLite3

2008-09-11 Thread Dennis Cote
Mohit Sindhwani wrote: > > Since the database is to be created and deleted in a thread itself, I > think I may need to do something like: > * Create in-memory database (":memory:") > * Attach the main database (from file) as 'mt' > * Create the temporary table for id_list > * Insert the user ente

Re: [sqlite] Insert statement is ok but after reopening the db data is missing ?

2008-09-11 Thread Dennis Cote
Lothar Behrens wrote: > Am 10.09.2008 um 17:37 schrieb Dennis Cote: > >> Lothar Behrens wrote: >>> What is the function to rollback a transaction or commit ? >>> I want also to break into these functions. If there is no way I try >>> to implement the rollback and commit callbacks. >>> Also the c

Re: [sqlite] dropping constraints

2008-09-11 Thread Mihai Limbasan
Igor Tandetnik wrote: "q10" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Is there a way to drop a constraint from a table, something like this: ALTER TABLE table_name DROP CONSTRAINT constraint_name? Unfortunately, this command is not supported by SQLite3. Are there other pos

Re: [sqlite] Efficient query of 2 related tables

2008-09-11 Thread P Kishor
On 9/11/08, Thomas DILIGENT <[EMAIL PROTECTED]> wrote: > Hi, > > I have 2 tables: > > A: _ID autoinc primary key >name text >b integer foreign key to table B > > B: _ID autoinc primary key >name text > > In sql: > CREATE TABLE "A" ("_ID" INTEGER PRIMARY KEY AUTOINCREMENT NOT NUL

Re: [sqlite] dropping constraints

2008-09-11 Thread Igor Tandetnik
"q10" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there a way to drop a constraint from a table, something like this: > > ALTER TABLE table_name DROP CONSTRAINT constraint_name? > > Unfortunately, this command is not supported by SQLite3. Are there > other possibilities? Renam

Re: [sqlite] Empty column: Set to NULL or leave empty?

2008-09-11 Thread Jay A. Kreibich
On Thu, Sep 11, 2008 at 12:19:44PM +0200, Gilles Ganault scratched on the wall: > So I guess a NULL is different from a column that was never set to > anything when creating the record? There is no such thing as "a column that was never set to anything." You might not explicitly set a value,

[sqlite] dropping constraints

2008-09-11 Thread q10
Hello, Is there a way to drop a constraint from a table, something like this: ALTER TABLE table_name DROP CONSTRAINT constraint_name? Unfortunately, this command is not supported by SQLite3. Are there other possibilities? -- View this message in context: http://www.nabble.com/dropping-constra

[sqlite] getting extension-functions.c to work in SQLITE on WindowsXP

2008-09-11 Thread Paulo
I would like to use the extension-functions.c from Liam Healy (http://sqlite.org/contrib/download//download/extension-functions.c?get=25) with SQLite. I am working on Windows XP and I have no clue how to compile the file into a library. And after that there is the issue that loading extensions

Re: [sqlite] Empty column: Set to NULL or leave empty?

2008-09-11 Thread Igor Tandetnik
"Gilles Ganault" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I didn't pay attention to this until recently, when someone advised > me to never set empty columns to NULL. > > So I guess a NULL is different from a column that was never set to > anything when creating the record? No

Re: [sqlite] Insert statement is ok but after reopening the db data is missing ?

2008-09-11 Thread Lothar Behrens
Am 10.09.2008 um 17:37 schrieb Dennis Cote: > Lothar Behrens wrote: >> What is the function to rollback a transaction or commit ? >> I want also to break into these functions. If there is no way I try >> to implement the rollback and commit callbacks. >> Also the closing of the database would b

[sqlite] Empty column: Set to NULL or leave empty?

2008-09-11 Thread Gilles Ganault
Hello I didn't pay attention to this until recently, when someone advised me to never set empty columns to NULL. So I guess a NULL is different from a column that was never set to anything when creating the record? Here's an example: == //Leave col2 empty instead of NULL $sql = "INSE

[sqlite] Efficient query of 2 related tables

2008-09-11 Thread Thomas DILIGENT
Hi, I have 2 tables: A: _ID autoinc primary key name text b integer foreign key to table B B: _ID autoinc primary key name text In sql: CREATE TABLE "A" ("_ID" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "name" TEXT, "b" INTEGER NOT NULL DEFAULT '0') CREATE TABLE "B" ("_ID" INTE