[sqlite] Retrieving column names?

2008-02-04 Thread Gilles
Hello I'd like to display the column names as headers in an HTML table. 1. I need to retrieve the column names, but the following doesn't work: # cat cols.php ?php $dbh = new PDO(sqlite:db.sqlite); $sql = .header ON; $dbh-exec($sql); $sql = SELECT * FROM

[sqlite] sqlite 3.5.5 and SQLITE_ENABLE_LOCKING_STYLE=1

2008-02-04 Thread Marco Bambini
It is safe to define SQLITE_ENABLE_LOCKING_STYLE=1 with sqlite 3.5.5 if I am interested in opening database files on a shared volumes on Mac? As far as I know it was the only workaround ... or something is changed in recent versions? Thanks. --- Marco Bambini http://www.sqlabs.net

Re: [sqlite] Retrieving column names?

2008-02-04 Thread Kees Nuyt
On Mon, 04 Feb 2008 10:46:53 +0100, Gilles [EMAIL PROTECTED] wrote: Hello I'd like to display the column names as headers in an HTML table. 1. I need to retrieve the column names, but the following doesn't work: # cat cols.php ?php $dbh = new PDO(sqlite:db.sqlite);

[���۟�][sqlite] Pysqlite issue no attribute 'autocommit'

2008-02-04 Thread sqlite-users
수신자가 sqlite-users@sqlite.org 로부터 오는 메일의 수신을 거부하였습니다. _ ---BeginMessage--- Hi there, Im trying to run a Python based program which uses MySQL with python-sqlite and Im recieving this error, 'Connection' object has no attribute 'autocommit'

[sqlite] Pysqlite issue no attribute 'autocommit'

2008-02-04 Thread sqlite-users
Hi there, Im trying to run a Python based program which uses MySQL with python-sqlite and Im recieving this error, 'Connection' object has no attribute 'autocommit' I´ve had a google for this and its seems like it may be a bug python-sqlite or sqlite bug , but also I tried searching for it

[sqlite] Vacuum

2008-02-04 Thread sqlite-users
Hi all, Hopefully you can help, while running sqlite version 3.5.5 Two seperate threads each attempt to run a vacuum command against the same db. Each thread has an independent connnection to the db. One thread succeeds and the other gets a return code of 1 (SQLITE_ERROR) from

Re: [sqlite] Vacuum

2008-02-04 Thread Ken
DRH, I guess, the question being asked is twofold. Should there be an error returned at all ? Or if there is an error, wouldn't SQLITE_BUSY be more appropriate... So the users app could attempt a retry? Since there is an error, it seems that the error message is not the same

[sqlite] Update value from either database table?

2008-02-04 Thread Gussimulator
I have a field I need to update given a condition, but I don't know wether the condition occurs in table A or table B, how can I perform this query? I have 2 identical tables in design, but one contains system data and the other one contains user data... On my update routine (in C) I have to

Re: [sqlite] open statements upon close

2008-02-04 Thread drh
Ken [EMAIL PROTECTED] wrote: Hi all, I'm getting a sqlite error when running sqlite3_close. The error indicates that there are open statements. To the best of my knowledge all statements are closed. I loooked at the sqlite3_close function and call to close the virtual tables appears

[sqlite] open statements upon close

2008-02-04 Thread Ken
Hi all, I'm getting a sqlite error when running sqlite3_close. The error indicates that there are open statements. To the best of my knowledge all statements are closed. I loooked at the sqlite3_close function and call to close the virtual tables appears to be causing this issue. My

Re: [sqlite] Update value from either database table?

2008-02-04 Thread Gussimulator
table a: dict_base table b: dict_user condition: wether 'sz_word' = 'X' increase the value of 'dw_uses' by 1 sz_word could be in either table, dw_uses must be updated on the pertinent table/s though. Sorry for not being too clear :) Thanks again - Original Message - From: Fowler,

Re: [sqlite] 3.5.5 Compilation failure / Bug

2008-02-04 Thread drh
Ken [EMAIL PROTECTED] wrote: Amalgamation fails to compile when -DSQLITE_OMIT_VIEW is defined. Neither the nor the preprocessed sources work with -DSQLITE_OMIT macros. If you need to use -DSQLITE_OMIT, then you will need to compile on Unix using the original source code. Both the

Re: [sqlite] Update value from either database table?

2008-02-04 Thread Igor Tandetnik
Gussimulator [EMAIL PROTECTED] wrote: I have a field I need to update given a condition, but I don't know wether the condition occurs in table A or table B, how can I perform this query? I have 2 identical tables in design, but one contains system data and the other one contains user data...

Re: [sqlite] Update value from either database table?

2008-02-04 Thread Fowler, Jeff
Without more info, here's the general approach: UPDATE c SET int_field = int_field+1 WHERE (table a condition) OR (table b condition) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gussimulator Sent: Monday, February 04, 2008 1:57 PM To:

[sqlite] 3.5.5 Compilation failure / Bug

2008-02-04 Thread Ken
Amalgamation fails to compile when -DSQLITE_OMIT_VIEW is defined. ./sqliteSrc/sqlite-3.5.5/sqlite3.c: In function 'sqlite3Insert': ../sqliteSrc/sqlite-3.5.5/sqlite3.c:55512: error: syntax error before numeric constant ../sqliteSrc/sqlite-3.5.5/sqlite3.c:55543: error: invalid lvalue in

Re: [sqlite] [3.5.4] Fails importing CSV file

2008-02-04 Thread Gilles
At 22:47 04/02/2008 +1100, John Machin wrote: Well, obviously(?) you are closer to success with \t than with '\t'. You probably have an extra unseen TAB. It won't like that NULL. Thanks, but no matter what I try, it doesn't work: - just two columns, assuming it will just increment the primary

[���۟�]Re: [sqlite] Vacuum

2008-02-04 Thread sqlite-users
수신자가 sqlite-users@sqlite.org 로부터 오는 메일의 수신을 거부하였습니다. _ ---BeginMessage--- sqlite-users@sqlite.org wrote: Hi all, Hopefully you can help, while running sqlite version 3.5.5 Two seperate threads each attempt to run a vacuum command against

Re: [sqlite] [3.5.4] Fails importing CSV file

2008-02-04 Thread John Machin
Gilles wrote: At 22:47 04/02/2008 +1100, John Machin wrote: Well, obviously(?) you are closer to success with \t than with '\t'. You probably have an extra unseen TAB. It won't like that NULL. Thanks, but no matter what I try, it doesn't work: - just two columns, assuming it will

Re: [sqlite] [3.5.4] Fails importing CSV file

2008-02-04 Thread Dennis Cote
Gilles wrote: At 22:47 04/02/2008 +1100, John Machin wrote: Well, obviously(?) you are closer to success with \t than with '\t'. You probably have an extra unseen TAB. It won't like that NULL. Thanks, but no matter what I try, it doesn't work: - just two columns, assuming it will just

Re: [sqlite] [3.5.4] Fails importing CSV file

2008-02-04 Thread John Machin
Gilles wrote: At 02:27 04/02/2008 +0100, Gilles wrote: Thanks for the tip, but I tried that too, with no success: I tried both: sqlite .separator \t sqlite .import test.csv customer test.csv line 1: expected 3 columns of data but found 4 sqlite .separator '\t' sqlite .import

Re: [sqlite] Vacuum

2008-02-04 Thread sqlite-users
sqlite-users@sqlite.org wrote: Hi all, Hopefully you can help, while running sqlite version 3.5.5 Two seperate threads each attempt to run a vacuum command against the same db. Each thread has an independent connnection to the db. One thread succeeds and the other gets a return code

Re: [sqlite] Pysqlite issue no attribute 'autocommit' RESOLVED

2008-02-04 Thread Andy Smith
Ok, simple fix... Updated to MySQL_python-1.2.2 and all ok now! :D - Original Message - From: Andy Smith To: sqlite-users@sqlite.org Sent: Monday, February 04, 2008 3:52 PM Subject: Pysqlite issue no attribute 'autocommit' Hi there, Im trying to run a Python based

[sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread Piotr Budny
Hello, I've got strange behaviour, I want to select row ID of MAX(something) row for group: CREATE TABLE test ( id INTEGER , name CHAR(50) , weight INTEGER ); INSERT INTO test VALUES(1,'A',1); INSERT INTO test VALUES(2,'A',50); INSERT INTO test VALUES(3,'B',1); INSERT INTO test

Re: [sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread P Kishor
On 2/4/08, Igor Tandetnik [EMAIL PROTECTED] wrote: Piotr Budny [EMAIL PROTECTED] wrote: select name,max(weight) from test group by name; The result is fine: A|50 B|1 C|123 Now, I want to get the ID for such max rows: select id,name,max(weight) from test group by name; 2|A|50

Re: [sqlite] open statements upon close

2008-02-04 Thread Ken
I wrote a function to traverse the linked list and print the zSql to stderr. There was indeed a sql statement being left open by my code! Thats a really usefull debugging technique. I might write an extension to implement this in a more formally. Thanks, Ken [EMAIL PROTECTED] wrote: Ken

Re: [sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread P Kishor
On 2/4/08, Igor Tandetnik [EMAIL PROTECTED] wrote: P Kishor [EMAIL PROTECTED] wrote: On 2/4/08, Piotr Budny [EMAIL PROTECTED] wrote: Now, I want to get the ID for such max rows: select id,name,max(weight) from test group by name; sqlite select t.* from test t join (select name,

Re: [sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread Igor Tandetnik
Piotr Budny [EMAIL PROTECTED] wrote: select name,max(weight) from test group by name; The result is fine: A|50 B|1 C|123 Now, I want to get the ID for such max rows: select id,name,max(weight) from test group by name; 2|A|50 3|B|1 15|C|123 It is OK. It's only OK by accident. The id

Re: [sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread Piotr Budny
Dnia poniedziałek, 4 lutego 2008, Simon Davies napisał: Hi Piotr, Hello, Looks fine to me. Isn't 123 the max weight for those rows with name 'C'? Yes, the C is the right answer, but that row (row with max weight value) is not a row with ID=10. The row with max val is row with ID=15. vip;

Re: [sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread Simon Davies
Hi Piotr, Looks fine to me. Isn't 123 the max weight for those rows with name 'C'? Rgds, Simon On 04/02/2008, Piotr Budny [EMAIL PROTECTED] wrote: Hello, I've got strange behaviour, I want to select row ID of MAX(something) row for group: CREATE TABLE test ( id INTEGER , name CHAR(50) ,

Re: [sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread P Kishor
On 2/4/08, Piotr Budny [EMAIL PROTECTED] wrote: Hello, I've got strange behaviour, I want to select row ID of MAX(something) row for group: CREATE TABLE test ( id INTEGER , name CHAR(50) , weight INTEGER ); INSERT INTO test VALUES(1,'A',1); INSERT INTO test VALUES(2,'A',50); INSERT INTO

Re: [sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread Gerry Snyder
P Kishor wrote: sqlite select t.* from test t join (select name, max(weight) as m from test group by name) w on t.weight = w.m and t.name = w.name; To me the following almost identical query is more readable, but I guess it is objectively better only if you are having trouble with the

Re: [sqlite] Selecting ID for MAX() + GROUP BY

2008-02-04 Thread Igor Tandetnik
P Kishor [EMAIL PROTECTED] wrote: On 2/4/08, Piotr Budny [EMAIL PROTECTED] wrote: Now, I want to get the ID for such max rows: select id,name,max(weight) from test group by name; sqlite select t.* from test t join (select name, max(weight) as m from test group by name) w on t.weight = w.m

Re: [sqlite] Is it possible to do this using only SQL?

2008-02-04 Thread Dennis Volodomanov
Hmm, strange - my testing produces very slow results (it took over a minute to update 120K rows). Maybe it's because I'm also creating an index on the new row and doing an ANALYZE - do these 2 operations take considerable amount of time? There's also a VACUUM later on, which might be slow? (The

Re: [sqlite] Is it possible to do this using only SQL?

2008-02-04 Thread P Kishor
On 2/4/08, Dennis Volodomanov [EMAIL PROTECTED] wrote: Oh, that looks simpler than I thought. Thank you for the reply! not only is it simple... ... On 04-Feb-2008, at 3:41 PM, Dennis Volodomanov wrote: Is that possible? If not, I'll have to do it in the code, but that will probably be

Re: [sqlite] Is it possible to do this using only SQL?

2008-02-04 Thread Dennis Volodomanov
Oh, that looks simpler than I thought. Thank you for the reply! Dennis -Original Message- From: Steven Fisher [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 05, 2008 10:50 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Is it possible to do this using only SQL?

[sqlite] Is it possible to do this using only SQL?

2008-02-04 Thread Dennis Volodomanov
Hello all, I'm not sure if it's possible to do this using only SQL, so I'd like to ask: I need to add a column to a table which will be populated with data from another column in that table, but converted to lower-case. So, in pseudo-code I need to do this: ALTER TABLE MyTable ADD

Re: [sqlite] Is it possible to do this using only SQL?

2008-02-04 Thread Steven Fisher
On 04-Feb-2008, at 3:41 PM, Dennis Volodomanov wrote: Is that possible? If not, I'll have to do it in the code, but that will probably be slower and I'm expecting to have tens of thousands of rows. Sure: sqlite create table x(a); sqlite insert into x(a) values('ABC'); sqlite insert into

Re: [sqlite] Is it possible to do this using only SQL?

2008-02-04 Thread Dennis Volodomanov
After removing ANALYZE and VACUUM things are going fast enough. I assume I don't need to ANALYZE because the index is being created from scratch anyway and VACUUM I can avoid as well, because I don't expect the database to opened with any previous versions of SQLite anyway. Thanks! Dennis

[sqlite] Select Error - SQL error: unrecognized token: select

2008-02-04 Thread Carl Lindgren
Could someone please give me a clue on why I'm getting this message SQL error: unrecognized token: select from the command line using Bash for Dos and a sh script? Thanks for any help, Carl -- Carl Lindgren C. R. Lindgren Consulting / Business on the Desktop Using Bash for Dos and MS-KSH

Re: [sqlite] Is it possible to do this using only SQL?

2008-02-04 Thread P Kishor
On 2/4/08, Dennis Volodomanov [EMAIL PROTECTED] wrote: Hmm, strange - my testing produces very slow results (it took over a minute to update 120K rows). well, for one, you are adding different stuff from me. Maybe it's because I'm also creating an index on the new row and doing an ANALYZE -

Re: [sqlite] Is it possible to do this using only SQL?

2008-02-04 Thread Dennis Volodomanov
I'll try taking out the ANALYZE and VACUUM and see if it helps. I'm using transactions and I am creating the index after the update (and dropping it before). So, the only 2 possible delays are in those two commands, from what I can see... The problem is that it's actually inside a Windows

[sqlite] sqlite3_db_handle

2008-02-04 Thread Ken
The sqlite3_db_handle returns a different address for my statements than the database session address. (using sqlite3_open) Should it return the .aDb field instead of the pVfs ? Thanks, Ken ___ sqlite-users mailing list sqlite-users@sqlite.org

[sqlite] DBD::SQLite 1.14 prepare_cached bug?

2008-02-04 Thread Clark Christensen
Sorry, this was mis-addressed. Should have gone to the list... - Forwarded Message From: Clark Christensen [EMAIL PROTECTED] To: Alexander Batyrshin [EMAIL PROTECTED] Sent: Monday, February 4, 2008 9:46:49 AM Subject: Re: [sqlite] DBD::SQLite 1.14 prepare_cached bug? bash, What do you

Re: [sqlite] Mailing List Changes

2008-02-04 Thread Clark Christensen
So, I sent a reply this morning to a list message, and it seems to have gone to the OP's email address rather than to the list (sorry bash). I don't remember having that issue with the old software (ezmlm). To fix, is it a client configuration, or is there a reply-to header that should be set

Re: [sqlite] Mailing List Changes

2008-02-04 Thread P Kishor
On 2/4/08, Clark Christensen [EMAIL PROTECTED] wrote: So, I sent a reply this morning to a list message, and it seems to have gone to the OP's email address rather than to the list (sorry bash). I don't remember having that issue with the old software (ezmlm). To fix, is it a client

Re: [sqlite] Mailing List Changes

2008-02-04 Thread Doug Currie
On Monday, February 04, 2008 P Kishor wrote: On 2/4/08, Clark Christensen [EMAIL PROTECTED] wrote: So, I sent a reply this morning to a list message, and it seems to have gone to the OP's email address rather than to the list (sorry bash). I don't remember having that issue with the old

Re: [sqlite] Mailing List Changes

2008-02-04 Thread drh
Doug Currie [EMAIL PROTECTED] wrote: Please set the list so default reply is to the list. http://www.unicom.com/pw/reply-to-harmful.html One finds various screeds such as the one Doug references above. And on the configuration screen for GNU mailman, it strongly recommends that replys

Re: [sqlite] Mailing List Changes

2008-02-04 Thread Rich Shepard
On Tue, 5 Feb 2008, [EMAIL PROTECTED] wrote: One finds various screeds such as the one Doug references above. And on the configuration screen for GNU mailman, it strongly recommends that replys be to the author and not to the list. And yet nearly everyone I know loaths that behavior. The

Re: [sqlite] DBD::SQLite 1.14 prepare_cached bug?

2008-02-04 Thread Alexander Batyrshin
Hello, What do you expect to see? From the code, I'm guessing something like: This is test-case program for testing DBD-SQLite behavior. Dumper is only for be sure, that data was read correctly from database. If you're just trying to silence the closing dbh with active handles... warning,

Re: [sqlite] Mailing List Changes

2008-02-04 Thread Aristotle Pagaltzis
* [EMAIL PROTECTED] [EMAIL PROTECTED] [2008-02-05 02:35]: The overwhelming majority of users prefer mailing list replies to go back to the mailing list *only*. Reply-To munging is still harmful, because if the original sender had set this header, that information is lost; if someone really

Re: [sqlite] Mailing List Changes

2008-02-04 Thread Glenn McAllister
[EMAIL PROTECTED] wrote: In a semi-related rant: Setting up a new mailing list is *way* harder than it needs to be. Way, Way harder. In order to go from ezmlm to GNU mailman, we had to prototype the setup on a separate machine, then spend a day debugging the setup after transferring it to

[sqlite] Can't use cursor keys

2008-02-04 Thread Gilles
Hello I can't use the cursor keys (arrows) when using SQLite on Linux from a remote Windows host. Both are supposed to be set to xterm, but when I hit eg. the up key in SQLite, it shows ^[[A. Other applications work OK. I've tried using vt100 instead of xterm, but it made no

Re: [sqlite] Mailing List Changes

2008-02-04 Thread Nicolas Williams
On Tue, Feb 05, 2008 at 01:30:01AM +, [EMAIL PROTECTED] wrote: And yet nearly everyone I know loaths that behavior. The overwhelming majority of users prefer mailing list replies to go back to the mailing list *only*. Users need to learn to do list reply or reply all :) Getting dups

Re: [sqlite] Mailing List Changes

2008-02-04 Thread drh
Nicolas Williams [EMAIL PROTECTED] wrote: On Tue, Feb 05, 2008 at 01:30:01AM +, [EMAIL PROTECTED] wrote: And yet nearly everyone I know loaths that behavior. The overwhelming majority of users prefer mailing list replies to go back to the mailing list *only*. Users need to learn to

Re: [sqlite] DBD::SQLite 1.14 prepare_cached bug?

2008-02-04 Thread Alexander Batyrshin
I think i found solution. The problem is that DBD::SQlite-disconnect() method execute sqlite3_close() function. This function return SQLITE_BUSY in case if there are any active statement. From API: Applications should finalize all prepared statements and close all BLOBs associated with the sqlite3

[sqlite] After sqlite3_create_function, calling function returns no such function

2008-02-04 Thread Joe Cosby
I can't spot what I'm doing wrong here, maybe somebody else can see it ... I define a function: static void sqliteTimeToHms(sqlite3_context *context, int argc, sqlite3_value **argv) { sqlite3_result_text(context, 0:00:00, 8, NULL); } Then call rc = sqlite3_create_function16(db,