[sqlite] How do I output multi-word strings without braces?

2009-11-10 Thread Walter Dnes
Given the following code fragment... set xname [db eval { select name from elements where e_mtid = $element }] puts [format Requested element == %s == %s $element $xname] The business rules are such that I know I'll only get one row returned. I get output like so... Requested element ==

Re: [sqlite] How do I output multi-word strings without braces?

2009-11-10 Thread Dan Kennedy
On Nov 10, 2009, at 3:06 PM, Walter Dnes wrote: Given the following code fragment... set xname [db eval { select name from elements where e_mtid = $element }] puts [format Requested element == %s == %s $element $xname] The business rules are such that I know I'll only get one row

[sqlite] UPGRADE to 3.6.20 and python

2009-11-10 Thread Cooper, Andrew
This has probably been asked a lot of times before but I couldn't find an answer in the archives. I want to upgrade the version of sqlite in python 2.5 to use 3.6.20(the latest) What steps do I need to do to achieve this ? Does pysqlite need to be installed and if so does this support the

[sqlite] sqlite for threads

2009-11-10 Thread JeffHua
Hello, Maybe many others have asked this question, so I will say sorry if that's true. I have a program which uses threads, when writing to (sometime even reading from) SQLite, I always got the error of database is locked. I think since SQLite is a file db, so it get locked easily by

Re: [sqlite] sqlite for threads

2009-11-10 Thread Doug
Hello, Maybe many others have asked this question, so I will say sorry if that's true. I have a program which uses threads, when writing to (sometime even reading from) SQLite, I always got the error of database is locked. I think since SQLite is a file db, so it get locked easily by

Re: [sqlite] sqlite for threads

2009-11-10 Thread Jean-Christophe Deschamps
Hi, Maybe many others have asked this question, so I will say sorry if that's true. I have a program which uses threads, when writing to (sometime even reading from) SQLite, I always got the error of database is locked. I think since SQLite is a file db, so it get locked easily by

Re: [sqlite] Compile Virtualtext extension

2009-11-10 Thread Gary_Gabriel
Thanks Alexey, Great response. I'll make the changes and get back to you. Take care- Gary Gabriel ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] sqlite-users Digest, Vol 23, Issue 10

2009-11-10 Thread Peter Haworth
Thank you Igor, that's exactly what I need. Pete Haworth On Nov 10, 2009, at 4:00 AM, sqlite-users-requ...@sqlite.org wrote: You are looking for group_concat (http://sqlite.org/ lang_aggfunc.html): select KeyA, DataA, group_concat(DataB) from TABLEA join TABLEB on

Re: [sqlite] Fwd: SQLite 3.6.20 problem

2009-11-10 Thread Shane Harrelson
Fixed in check-in http://www.sqlite.org/src/info/8097c64acf On Mon, Nov 9, 2009 at 10:52 AM, D. Richard Hipp d...@hwaci.com wrote: Begin forwarded message: From: Ken Zalewski ken...@nycap.rr.com Date: November 9, 2009 9:45:22 AM EST To: d...@hwaci.com Subject: SQLite 3.6.20 problem

[sqlite] Output in currency format

2009-11-10 Thread Peter Haworth
I have a column defined with a type of FLOAT, which I believe is treated as REAL by SQLite. When selecting that column, I would like it to be returned with a leading $ sign and always have a decimal point and two numbers after the decimal point. I can use concatenation to get the $ sign

Re: [sqlite] Is the dbFileVers written to journal files?

2009-11-10 Thread Dan Kennedy
On Nov 11, 2009, at 1:24 AM, Scott Hess wrote: Someone was asking me a question about what happens if the wrong journal file gets applied to a database. My answer was that terrible things happen. I found myself wondering if the File change counter value is stored in the journal (*). It

Re: [sqlite] Output in currency format

2009-11-10 Thread Pavel Ivanov
There's no way to force SQLite to return exactly 2 decimal places for you. You have to do it in your application or if you really-really need to do it in sql you can do it like this (assuming you need column col from table tab): select '$'||case when length(col) = 1 then

[sqlite] Is the dbFileVers written to journal files?

2009-11-10 Thread Scott Hess
Someone was asking me a question about what happens if the wrong journal file gets applied to a database. My answer was that terrible things happen. I found myself wondering if the File change counter value is stored in the journal (*). It would seem like a cheap(ish) way to give some

Re: [sqlite] Output in currency format

2009-11-10 Thread Rich Shepard
On Tue, 10 Nov 2009, Peter Haworth wrote: Is there a way to do this or should I plan on handling it within the application? Pete, The latter. Display formatting is not part of SQL. You might also consider using integer values for money because the math is more accurate. Rich

Re: [sqlite] How do I output multi-word strings without braces?

2009-11-10 Thread Walter Dnes
On Tue, Nov 10, 2009 at 03:06:08AM -0500, Walter Dnes wrote Given the following code fragment... set xname [db eval { select name from elements where e_mtid = $element }] puts [format Requested element == %s == %s $element $xname] Oops, I forgot to mention that this is the TCL interface to

Re: [sqlite] Firefox SQLite Manager extension troubles.

2009-11-10 Thread Dennis Cote
Ted Rolle wrote: I've done as you said many times, but SQLite Manager still looks for the old database, reports that it's not available. Ted, Try turning off the option to open the last used database. In SQLite Manager Menu - Tools - Options then select Main tab and uncheck Open the Last

[sqlite] implementing without right join...

2009-11-10 Thread Sam Carleton
This question is purely a theoretical and came up in a discussion today about joins in DB's that allow both left and right: Given three tables, A, B, and C, joined such that: A left join B right join C Is my impression correct that this translates into: (outer join A and C) inner join B

[sqlite] Request: SQLITE_USE_MALLOCA

2009-11-10 Thread Shaun Seckman (Firaxis)
Hello all, SQLite currently has a SQLITE_USE_ALLOCA define in which it will attempt to use alloca instead of malloc when the usage fits. One of the common dangers with alloca is that if there is not enough stack space, bad things happen and it's usually very difficult to debug.

[sqlite] Get Max Samples

2009-11-10 Thread Rick Ratchford
Suppose you had a column called SampleNumber. And in this column, you might have... 1 1 1 2 2 2 2 3 3 4 4 4 5 5 5 5 etc. How would you write the SQL statement that would return the maximum number of a sample? For example, if within the SampleNumber column, the SampleNumber 17 had more

Re: [sqlite] Request: SQLITE_USE_MALLOCA

2009-11-10 Thread D. Richard Hipp
On Nov 10, 2009, at 3:19 PM, Shaun Seckman (Firaxis) wrote: SQLite currently has a SQLITE_USE_ALLOCA define in which it will attempt to use alloca instead of malloc when the usage fits. One of the common dangers with alloca is that if there is not enough stack space, bad

Re: [sqlite] Get Max Samples

2009-11-10 Thread Pavel Ivanov
You're right about max() and group_concat() will not help you either. You need something like this: select max(cnt) from (select count(*) as cnt from table_name group by SampleNum) Pavel On Tue, Nov 10, 2009 at 3:24 PM, Rick Ratchford r...@amazingaccuracy.com wrote: Suppose you had a column

Re: [sqlite] Get Max Samples

2009-11-10 Thread Matt Sergeant
On Tue, 10 Nov 2009 15:28:30 -0500, Pavel Ivanov wrote: You're right about max() and group_concat() will not help you either. You need something like this: select max(cnt) from (select count(*) as cnt from table_name group by SampleNum) That'll give you the count of the largest set. But not

Re: [sqlite] Get Max Samples

2009-11-10 Thread Igor Tandetnik
Rick Ratchford r...@amazingaccuracy.com wrote: How would you write the SQL statement that would return the maximum number of a sample? For example, if within the SampleNumber column, the SampleNumber 17 had more records (say there are 23 SampleNumber = 17 in the table, more than any

[sqlite] sqlite3 for Mac OSX 10.5

2009-11-10 Thread Peter Haworth
sqlite3 is rejecting a SELECT statement that includes the group_concat function saying it's an unknown function, yet the same SELECT statement works fine in the Firefox SQLite Manager extension. The version of sqlite3 on my Mac is 3.4.0 but it looks like the latest version is 3.6.x. Could

Re: [sqlite] Get Max Samples

2009-11-10 Thread Rick Ratchford
Thanks Pavel, Matt and Igor. :-) What more could I have provided? It's just a column and I have no idea how group_concat works anyways. That's why I threw that in. Yes, the largest SET is what I need. Didn't know to call it a SET until after reading your comments. Now to make sure I understand

[sqlite] db file locked after power loss

2009-11-10 Thread Shawn Boyle
I'm running SQLite v3.4.0 on an embedded linux device. I am testing a power loss scenario while updating a record. When the device boots back up and the device occasionally gets into a state where the database file seems locked. The sqlite3_open() call returns SQLITE_IOERR. All

[sqlite] Detach worked OK in 3.6.19 -- gets error #1 (Database is Locked) in 3.6.20.

2009-11-10 Thread Fred Meier
The following pseudo code works OK in 3.6.19 but the Detach gets error #1 (Database is Locked) in 3.6.20. 1. Prepare a Select statement returning 1 or more rows 2. Step the first row 3. Exec Attach statement 4. Exec Detach statement for previous Attach (This is statement that get

[sqlite] Database is locked

2009-11-10 Thread Frank Chang
We have an application which uses Microsoft SQL Server 2005 Extended stored procedures in conjunction with Sqlite databases. We have a C++ DLL which uses the following code to insert rows into a SQLite database: sprintf(Command,INSERT INTO [Keys] ([Key], [Cluster], [DupeGroup])

Re: [sqlite] UPGRADE to 3.6.20 and python

2009-11-10 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Cooper, Andrew wrote: This has probably been asked a lot of times before but I couldn't find an answer in the archives. You should ask on the python sqlite list :-) It is jointly maintained by the authors of the two Python to SQLite bindings:

Re: [sqlite] Database is locked

2009-11-10 Thread Jay A. Kreibich
On Tue, Nov 10, 2009 at 06:04:20PM -0500, Frank Chang scratched on the wall: We have an application which uses Microsoft SQL Server 2005 Extended stored procedures in conjunction with Sqlite databases. We have a C++ DLL which uses the following code to insert rows into a SQLite

Re: [sqlite] Output in currency format

2009-11-10 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Peter Haworth wrote: I have a column defined with a type of FLOAT, which I believe is treated as REAL by SQLite. When selecting that column, I would like it to be returned with a leading $ sign and always have a decimal point and two

Re: [sqlite] How do I output multi-word strings without braces?

2009-11-10 Thread D. Richard Hipp
On Nov 10, 2009, at 2:01 PM, Walter Dnes wrote: Oops, I forgot to mention that this is the TCL interface to SQLite. This is one of those grey area questions that could go to either TCL or SQLite forums, because it's an interaction between the two of them. I assume that some people here have

Re: [sqlite] Is the dbFileVers written to journal files?

2009-11-10 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Scott Hess wrote: Someone was asking me a question about what happens if the wrong journal file gets applied to a database. My answer was that terrible things happen. See also http://www.sqlite.org/src/info/61d35ac210 Roger -BEGIN PGP

Re: [sqlite] db file locked after power loss

2009-11-10 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Shawn Boyle wrote: The sqlite3_open() call returns SQLITE_IOERR. All attempts to copy the db file from the device fail. That indicates your device is having issues. If you can't read the file then neither can SQLite. Roger -BEGIN PGP

Re: [sqlite] sqlite for threads

2009-11-10 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 jeff...@aol.com wrote: I have a program which uses threads, when writing to (sometime even reading from) SQLite, I always got the error of database is locked. http://www.sqlite.org/lockingv3.html Roger -BEGIN PGP SIGNATURE- Version:

Re: [sqlite] Strange problem with different sqlite versions accessing the same database

2009-11-10 Thread Yuzem
Ok, I have replaced the older version and now I have the same sqlite version on both computers but the problem persist. Changes don't get saved on the computer that access the database trough the network. Any idea? -- View this message in context:

Re: [sqlite] Strange problem with different sqlite versions accessing the same database

2009-11-10 Thread Pavel Ivanov
Any idea? Apparently you have problematic implementation of network drive. Generally it's a very bad idea to use SQLite with file on network drive because SQLite uses file system locking mechanisms which are pretty bad working on network drives. Pavel On Tue, Nov 10, 2009 at 8:00 PM, Yuzem

Re: [sqlite] sqlite3 for Mac OSX 10.5

2009-11-10 Thread Dan Kennedy
On Nov 11, 2009, at 4:07 AM, Peter Haworth wrote: sqlite3 is rejecting a SELECT statement that includes the group_concat function saying it's an unknown function, yet the same SELECT statement works fine in the Firefox SQLite Manager extension. The version of sqlite3 on my Mac is 3.4.0 but

[sqlite] Reverse Referencing Rows

2009-11-10 Thread Rick Ratchford
A while back, Igor gave me some help on pulling out mm/dd ranges (sets) from my table. This is the code that does that. sSQL = SELECT Date, Year, Month, Day, Open, High, Low, Close FROM [ gsTableName ] _ WHERE ((Month - lngStartMth )*100 + (Day - lngStartDay ) + 1300) %

Re: [sqlite] Reverse Referencing Rows

2009-11-10 Thread Rick Ratchford
To add to my last post shown below, what I've done is added the Date to the ORDER BY, thus putting the unwanted rows at the very top. It doesn't remove it, but it does allow for stripping it off easier when transferring to an array if that is the best way to go. sSQL = SELECT Date, Year,

Re: [sqlite] sqlite3 for Mac OSX 10.5

2009-11-10 Thread Jay A. Kreibich
On Wed, Nov 11, 2009 at 11:23:18AM +0700, Dan Kennedy scratched on the wall: On Nov 11, 2009, at 4:07 AM, Peter Haworth wrote: sqlite3 is rejecting a SELECT statement that includes the group_concat function saying it's an unknown function, yet the same SELECT statement works fine in the

Re: [sqlite] Reverse Referencing Rows

2009-11-10 Thread Igor Tandetnik
Rick Ratchford wrote: For example, say that I want to run this SQL statement to pull out SETS that start with a MM/DD of 12/28 to 01/05. That means, each 'set' would be from December 25 to January 05, which means that each 'set' will cross a year end date (where the year value increments by

[sqlite] Understanding database lock

2009-11-10 Thread Akash Rao
Hello, Wanted to understand the sqlite database lock a little better. Especially while using perl DBI-sqlite module. I did some tests and wanted to know if this is a known way of sqlite's working. I have a perl script that add numbers 1-1000 into a db. Here is the code:

Re: [sqlite] Understanding database lock

2009-11-10 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Akash Rao wrote: Wanted to understand the sqlite database lock a little better. Read this: http://www.sqlite.org/lockingv3.html Roger -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla -

[sqlite] Problems passing parameters between SQLite + TCL

2009-11-10 Thread Walter Dnes
There's a lot more to this program, but I've cut it down to the bare minimum that illustrates my problem. I call a TCL script from the linux commandline, and get an error message like so... [waltdnes][~/SQLite] ./fragment