Re: [sqlite] Quoting identifier vs literal (was: Version 3.2.2)

2008-02-09 Thread Kees Nuyt
On Sat, 09 Feb 2008 17:16:57 +0100, you wrote: >On Sat, 9 Feb 2008 23:51:03 +1100, you wrote: [..] >>create table MyTable( MyField ); >>alter table MyTable rename to MyNewTable; >>select SQL from SQLite_Master; >> >>which gives: >> >>CREATE TABLE 'MyNewTable'( MyField ) >> >>SQLite should

Re: [sqlite] looping over a result set in a query

2008-02-09 Thread Alexander Batyrshin
> Is it possible to refine/combine the above two sets of queries into one? Yes. It's possible: A) SELECT e.to_node_id AS node_id FROM edge e WHERE e.from_node_id = $node_id UNION SELECT e.from_node_id AS node_id FROM edge e WHERE e.to_node_id = $node_id B) SELECT

Re: [sqlite] tclsqlite

2008-02-09 Thread Gerry Snyder
dick128 wrote: > I have a tcl app that I want to use tclsqlite with but when I load the dll > tcl exits without any error messages. did catch, etc. still exits. tries > 3.5.4 and 3.5.6 - same result. > What version of Tcl? I have used all of the recent tclsqlite3.dll files with almost all of

Re: [sqlite] looping over a result set in a query

2008-02-09 Thread P Kishor
ok, after embarrassedly realizing that I phrased my question terribly (thanks Alexander), here is a simplification and rewording of it -- (a) First I find all the "other nodes" in edges where a given $node_id is either the from_node_id or to_node_id. SELECT node_id, node_name FROM (

Re: [sqlite] looping over a result set in a query

2008-02-09 Thread Alexander Batyrshin
For your pseudo-code for (b) i can suggest this, but i still not understand why you need it :-/ SUBQUERY = SELECT e.to_node_id AS node_id FROM edge e WHERE e.from_node_id = $node_id UNION SELECT e.from_node_id AS node_id FROM edge e WHERE e.to_node_id = $node_id

Re: [sqlite] Quoting identifier vs literal (was: Version 3.2.2)

2008-02-09 Thread Kees Nuyt
On Sat, 9 Feb 2008 23:51:03 +1100, you wrote: >Following up: >> This also says that SQLite will accept a single quoted literal as an >> identifier in certain situations. I'm not aware of any other >> database that used single quotes that way, but I'm sure there was >> one somewhere along

Re: [sqlite] looping over a result set in a query

2008-02-09 Thread Alexander Batyrshin
Hello Kishor, a: if you want to find all edges, why your query returns nodes? So I think it should be like this: SELECT edge_id FROM edge WHERE from_node = $node OR to_node = $node; This query is not good, because "OR" drop out any index optimization. But As I see your example doesn't have

[sqlite] tclsqlite

2008-02-09 Thread dick128
I have a tcl app that I want to use tclsqlite with but when I load the dll tcl exits without any error messages. did catch, etc. still exits. tries 3.5.4 and 3.5.6 - same result. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] INSERTing records in two tables?

2008-02-09 Thread John Stanton
last_row_id is not a function. It is a predefined value. Gilles wrote: > On Sat, 9 Feb 2008 08:41:56 -0500, "Igor Tandetnik" > <[EMAIL PROTECTED]> wrote: >> INSERT INTO phones (tel,id_customers) VALUES ('1234567',last_row_id()); > > Thanks, but I'm getting an error (FWIW, I'm using 3.5.4): > >

Re: [sqlite] INSERTing records in two tables?

2008-02-09 Thread Igor Tandetnik
"Gilles" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sat, 9 Feb 2008 08:41:56 -0500, "Igor Tandetnik" > <[EMAIL PROTECTED]> wrote: >> INSERT INTO phones (tel,id_customers) VALUES >> ('1234567',last_row_id()); > > Thanks, but I'm getting an error (FWIW, I'm using 3.5.4):

[sqlite] looping over a result set in a query

2008-02-09 Thread P Kishor
I have a table of nodes and edges like so CREATE TABLE edge ( edge_id INTEGER PRIMARY KEY, from_node_id TEXT, to_node_id TEXT, .. ); CREATE TABLE node ( node_id INTEGER PRIMARY KEY, node_name TEXT, .. ); Given a $node_id, I want to find (a) all

Re: [sqlite] INSERTing records in two tables?

2008-02-09 Thread Gilles
On Sat, 9 Feb 2008 08:41:56 -0500, "Igor Tandetnik" <[EMAIL PROTECTED]> wrote: >INSERT INTO phones (tel,id_customers) VALUES ('1234567',last_row_id()); Thanks, but I'm getting an error (FWIW, I'm using 3.5.4): sqlite> BEGIN;INSERT INTO customers (id,name) VALUES (NULL,'John Doe');INSERT

Re: [sqlite] INSERTing records in two tables?

2008-02-09 Thread Igor Tandetnik
"Gilles" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > = > BEGIN; > INSERT INTO customers (id,name) VALUES (NULL,'John Doe'); > ;How to get ROW_ID? > INSERT INTO phones (tel,id_customers) VALUES ('1234567',ROW_ID); > COMMIT; > = INSERT INTO phones (tel,id_customers) VALUES

[sqlite] INSERTing records in two tables?

2008-02-09 Thread Gilles
Hello I'm an SQL newbie, and would like to know how to perform the following INSERT's: = BEGIN; INSERT INTO customers (id,name) VALUES (NULL,'John Doe'); ;How to get ROW_ID? INSERT INTO phones (tel,id_customers) VALUES ('1234567',ROW_ID); COMMIT; = The two records are linked, since a

[sqlite] Updatable views

2008-02-09 Thread BareFeet
Hi All, Short question: What's the best way (or your way) of facilitating an updatable view (a view that will accept insert, delete and update, propagating changes back to the underlying tables), especially for columns that are joined to satisfy normalization? Long version of question:

[sqlite] Quoting identifier vs literal (was: Version 3.2.2)

2008-02-09 Thread BareFeet
Following up: > This also says that SQLite will accept a single quoted literal as an > identifier in certain situations. I'm not aware of any other > database that used single quotes that way, but I'm sure there was > one somewhere along the line. It is a pain that SQLite accepts single

[sqlite] How to build sqlite3 (shell.c) shared linked?

2008-02-09 Thread Alexander Batyrshin
Hello, Is there any special arguments to ./configure for building sqlite3 (shell.c) shared linked to sqlite library? -- Alexander Batyrshin aka bash bash = Biomechanica Artificial Sabotage Humanoid ___ sqlite-users mailing list sqlite-users@sqlite.org

[sqlite] Bug in "quickstart" documentation

2008-02-09 Thread Alexander Batyrshin
Hello, I found that there is some mess in quickstart manual - http://www.sqlite.org/quickstart.html At C code example some lines ends with " argv}; hd_resolve_one {0}; hd_puts {);" -- Alexander Batyrshin aka bash bash = Biomechanica Artificial Sabotage Humanoid