[sqlite] Re: The term "flat-file" as applied to sqlite

2006-09-25 Thread A. Pagaltzis
* Griggs, Donald <[EMAIL PROTECTED]> [2006-09-25 22:10]: > 2) If instead, I'm unaware of another popular use of the term > "flat file" -- then I'd be glad to learn this. I think there's another explanation for how this term came about. Dr. Hipp has asserted many timed that SQLite should be

Re: [sqlite] Using SQLite on networked drive

2006-09-25 Thread RohitPatel9999
Thomas It is not safe to use SQLite on networked drive because of file locking problems and how OS caching takes place. Please refer answers by DRH above as well as in other question-answers. Different OS have different file locking and caching mechanism. Probably Windows 2000 might have

Re: [sqlite] Re: hi,UTF-8 again

2006-09-25 Thread Roger Binns
hongdong wrote: > Forgot this. > > 2006/9/26, hongdong <[EMAIL PROTECTED]>: >> >> I want to know:after run"sqlite3_get_table",what kind of encoding used >> with the result?? They are in UTF8. All SQLite 3 APIs use Unicode. If the type is a char* then it is UTF8 and if it is void* then it is

[sqlite] Please test check-ins [3445] and [3446]

2006-09-25 Thread drh
Windows users with the ability to build from source, please help me out by testing the changes in check-ins [3445] and [3446] at http://www.sqlite.org/cvstrac/chngview?cn=3445 and http://www.sqlite.org/cvstrac/chngview?cn=3446 verifying that they do not break anything. Tnx. -- D. Richard Hipp

[sqlite] Re: hi,UTF-8 again

2006-09-25 Thread hongdong
Forgot this. 2006/9/26, hongdong <[EMAIL PROTECTED]>: I want to know:after run"sqlite3_get_table",what kind of encoding used with the result?? thanks first.

Re: [sqlite] Please help me locking/transaction? logic !

2006-09-25 Thread John Stanton
If you do not rely on Posix file locks at all and use a mutex then all your problems are gone. Sqlite users are always getting their knickers in a knot using file locking. Martin Alfredsson wrote: Sorry, no. The problem is that BEGIN TRANSACTION or _prepare/_step does NOT set a SHARED lock

Re: [sqlite] The term "flat-file" as applied to sqlite

2006-09-25 Thread Clark Christensen
In a project team I was on recently, the PM, and some other team members seemed to think "database" meant either Access, or client-server (Oracle/MS SQL Server). They kept wanting to "access the database directly". I ended-up telling them if they think of this database as if it were a "flat

Re: [sqlite] The term "flat-file" as applied to sqlite

2006-09-25 Thread Dennis Cote
Fred Williams wrote: Unless you have a very funny shaped disk drive all the files are "Flat" :-) Actually, none of the files on a hard disk are "flat", since they are stored on circular tracks on the surface of the platters. Those on the outer cylinders of the disk will be flatter than

RE: [sqlite] The term "flat-file" as applied to sqlite

2006-09-25 Thread Fred Williams
Unless you have a very funny shaped disk drive all the files are "Flat" :-) I tend to agree stating SQLite is a "Flat file" somewhat oversimplifies things to me as my definition of a "flat file" is a simple sequential set of data written in no particular order and retrievable only by opening the

Re: [sqlite] Please help me locking/transaction? logic !

2006-09-25 Thread drh
Martin Alfredsson <[EMAIL PROTECTED]> wrote: > Sorry, no. > > The problem is that BEGIN TRANSACTION or _prepare/_step does > NOT set a SHARED lock when the SELECT statement is run. > > I think this is a bug (since the doc says it should) so I have > added a ticket. There is a workaround though

[sqlite] Please help me locking/transaction? logic !

2006-09-25 Thread Martin Alfredsson
Sorry, no. The problem is that BEGIN TRANSACTION or _prepare/_step does NOT set a SHARED lock when the SELECT statement is run. I think this is a bug (since the doc says it should) so I have added a ticket. There is a workaround though but since SQLite does not support nested transactions it

Re: [sqlite] Please help me locking/transaction? logic !

2006-09-25 Thread John Stanton
Only one thread or process may be writing, but two of them have a lock. What I do to make writing efficient and the logic simple is to use a mutex to synchronize the writes. Martin Alfredsson wrote: Hi ! Only one process IS writing at once. The problem is that if the writing is able to

Re: [sqlite] How long can I keep a prepared statement around?

2006-09-25 Thread Roger Binns
[EMAIL PROTECTED] wrote: > The TCL bindings also keep a cache of recently used SQL > statements. The bindings automatically detect if the SQL matches a statement in cache > and reuse the existing sqlite3_stmt if it does. Does the TCL wrapper allow multiple commands in one go? eg can it be

Re: [sqlite] The term "flat-file" as applied to sqlite

2006-09-25 Thread John Stanton
Griggs, Donald wrote: I've noticed that more than one contributor to this list has referred to sqlite as a "flat file database." I had always thought of a flat file as a file composed of single table of records, with records defined either by fixed-width allocations or by some sort of

[sqlite] Please help me locking/transaction? logic !

2006-09-25 Thread Martin Alfredsson
Hi ! Only one process IS writing at once. The problem is that if the writing is able to happen after _step and before _finalize it locks the database, What my code does: sqlite3_exec(... "BEGIN TRANSACTION" ...) sqlite3_prepare(... "SELECT * FROM A_TABLE" ...) sqlite3_step(...)

[sqlite] The term "flat-file" as applied to sqlite

2006-09-25 Thread Griggs, Donald
I've noticed that more than one contributor to this list has referred to sqlite as a "flat file database." I had always thought of a flat file as a file composed of single table of records, with records defined either by fixed-width allocations or by some sort of delimiter (e.g.,

Re: [sqlite] Please help me locking/transaction? logic !

2006-09-25 Thread John Stanton
Martin Alfredsson wrote: Is this correct ? My program calls: sqlite3_prepare(...) sqlite3_step(...) Here another process writes to the database sqlite3_exec(...) sqlite3_finalize(...) Now my program will fail with SQLITE_BUSY (5) when accessing the database. If I dont terminate the other

Re: [sqlite] undelete records?

2006-09-25 Thread azerger
Even if the meta data is gone - is there a way to access these deleted items and let a secondary program deal with the contents? Thanks, Art drh wrote: > > Kimball Larsen <[EMAIL PROTECTED]> wrote: >> I have an sqlite 2.1 format database file with records in it that >> have been marked

Re: [sqlite] Using SQLite on networked drive

2006-09-25 Thread John Stanton
RohitPatel wrote: I have read articles and understood that it is not safe to access SQLite database file on network drive. (on all windows). But what about Windows 2000 (Server) ??? i.e. If SQLite (3.3.4 or 3.3.6) database file resides on disk drive of Windows 2000 Server, then is it

[sqlite] Please help me locking/transaction? logic !

2006-09-25 Thread Martin Alfredsson
Is this correct ? My program calls: sqlite3_prepare(...) sqlite3_step(...) Here another process writes to the database sqlite3_exec(...) sqlite3_finalize(...) Now my program will fail with SQLITE_BUSY (5) when accessing the database. If I dont terminate the other process restaring my program

Re: [sqlite] Using SQLite on networked drive

2006-09-25 Thread Thomas . L
On Mon, 25 Sep 2006 11:22:41 -0700 (PDT), you wrote: Hello >I have read articles and understood that it is not safe to access SQLite >database file on network drive. (on all windows). > >But what about Windows 2000 (Server) ??? i.e. If SQLite (3.3.4 or 3.3.6) >database file resides on disk

Re: [sqlite] Summit a bug : data encoded from UTF8 is incorrect

2006-09-25 Thread Roger Binns
hongdong wrote: > I guess it is not a bug,but because SQLite treate Chinese ASCII as UTF-8, The SQLite APIs are defined to take UTF-8 or UTF-16 *only*. If you provide a sequence of bytes that aren't UTF-8 to the UTF-8 API then they will be treated as UTF-8. There would be no way for SQLite to

Re: [sqlite] Summit a bug : data encoded from UTF8 is incorrect

2006-09-25 Thread hongdong
I guess it is not a bug,but because SQLite treate Chinese ASCII as UTF-8,it just copy byte to byte without conversion.one program write the data using GB2312 and other program try to read it as UTF,so you can't get what you want. 在06-9-21,Nuno Lucas <[EMAIL PROTECTED]> 写道: On 9/21/06, 卢炎君

Re: [sqlite] Using SQLite on networked drive

2006-09-25 Thread RohitPatel9999
I have read articles and understood that it is not safe to access SQLite database file on network drive. (on all windows). But what about Windows 2000 (Server) ??? i.e. If SQLite (3.3.4 or 3.3.6) database file resides on disk drive of Windows 2000 Server, then is it safe to access that SQLite

Re: [sqlite] Re: Query returns all rows

2006-09-25 Thread Mark Richards
Hmm.. I'm so used to doing this via php's sqlite interface: SELECT * FROM blah WHERE id = "12345"; "form" in double quotes is an alternative way to refer to FORM column - it is _not_ a string literal. So your query condition is WHERE FORM=FORM, which is of course always true (except

Re: [sqlite] Query returns all rows

2006-09-25 Thread drh
"Igor Tandetnik" <[EMAIL PROTECTED]> wrote: > David Champagne > wrote: > > If I have a table defined in the following manner > > > >CREATE TABLE License (Form varchar(256), Type int, NbOcc int) > > > > and then I execute a query > > > >SELECT * FROM License WHERE FORM = "form"; > > > > I

Re: [sqlite] Query returns all rows

2006-09-25 Thread Paolo Vernazza
David Champagne wrote: If I have a table defined in the following manner CREATE TABLE License (Form varchar(256), Type int, NbOcc int) and then I execute a query SELECT * FROM License WHERE FORM = "form"; I get all rows returned, even though I only want the rows where the column FORM

Re: [sqlite] Query returns all rows

2006-09-25 Thread Mark Richards
I would tend to avoid mixed case and never use all upper case to specify anything (other than when defining a constant perhaps). Your use of case between "FORM" and "Form" as example. Also the use of the term "Type" for a fieldname (or variable) may be stretching reserved words a bit. For

[sqlite] Re: Query returns all rows

2006-09-25 Thread Igor Tandetnik
David Champagne wrote: If I have a table defined in the following manner CREATE TABLE License (Form varchar(256), Type int, NbOcc int) and then I execute a query SELECT * FROM License WHERE FORM = "form"; I get all rows returned "form" in double quotes is an alternative way to refer

[sqlite] hi,UTF-8 again

2006-09-25 Thread hongdong
I want to know:after run"sqlite3_get_table",what kind of encoding used with the result?? thanks first.

Re: [sqlite] Query returns all rows

2006-09-25 Thread Doug Currie
Monday, September 25, 2006, 1:46:12 PM, David Champagne wrote: > and then I execute a query > SELECT * FROM License WHERE FORM = "form"; > I get all rows returned Try: SELECT * FROM License WHERE FORM = 'form'; e -- Doug Currie Londonderry, NH

[sqlite] Query returns all rows

2006-09-25 Thread David Champagne
If I have a table defined in the following manner CREATE TABLE License (Form varchar(256), Type int, NbOcc int) and then I execute a query SELECT * FROM License WHERE FORM = "form"; I get all rows returned, even though I only want the rows where the column FORM contains the string

Re: [sqlite] How long can I keep a prepared statement around?

2006-09-25 Thread drh
"Shields, Daniel" <[EMAIL PROTECTED]> wrote: > > > > Use the function sqlite3_expired to determine, when you need > > to recompile a prepared statement. That's the approach I use. > > > > Mike > > How does this compare with the re-preparing statements that > have failed with a SQLITE_SCHEMA

[sqlite] Re: Re: Queries fail - I can't figure out why

2006-09-25 Thread Igor Tandetnik
Michael Ruck wrote: Interestingly I've even had some queries fail in the SQLite shell yesterday. Others worked. See if you have something non-obvious in those records that fail to be found. Could the field have trailing spaces? Or maybe some hex digits are lowercase? Missing braces? I

AW: AW: [sqlite] Re: Queries fail - I can't figure out why

2006-09-25 Thread michael . ruck
Nevermind the issue. I've found my problem: I bound my string using character length instead of byte length for UTF-16. Problem solved. Mike >Hi, > >Yes I showed an example query. The query I used for sqlite3_prepare >is the following: > >SELECT * FROM Objects WHERE ObjectID = ? > >If I'd put

AW: RE: RE: [sqlite] How long can I keep a prepared statement around?

2006-09-25 Thread michael . ruck
That's basically the way I do it. I have a factory method for all prepared statements, where I wrap the (optional) recompilation in and aquire a named mutex for every method invocation in the class. I think this should be a safe approach to prevent SQLITE_SCHEMA errors if the only schema

RE: RE: [sqlite] How long can I keep a prepared statement around?

2006-09-25 Thread Shields, Daniel
> Looking at the implementation of sqlite3_expired, its just a > comparison of the expired flag in the statement or if the > passed statement is NULL. The cost is an additional if > statement before execution, however this does not save you > from SQLITE_SCHEMA errors. In theory someone could

AW: RE: [sqlite] How long can I keep a prepared statement around?

2006-09-25 Thread michael . ruck
Looking at the implementation of sqlite3_expired, its just a comparison of the expired flag in the statement or if the passed statement is NULL. The cost is an additional if statement before execution, however this does not save you from SQLITE_SCHEMA errors. In theory someone could modify the

RE: [sqlite] How long can I keep a prepared statement around?

2006-09-25 Thread Shields, Daniel
> > Use the function sqlite3_expired to determine, when you need > to recompile a prepared statement. That's the approach I use. > > Mike How does this compare with the re-preparing statements that have failed with a SQLITE_SCHEMA error during sqlite3_step? e.g.

AW: [sqlite] Re: Queries fail - I can't figure out why

2006-09-25 Thread Michael Ruck
Hi, Yes I showed an example query. The query I used for sqlite3_prepare is the following: SELECT * FROM Objects WHERE ObjectID = ? If I'd put quotes around the question mark, binding would have failed. Interestingly I've even had some queries fail in the SQLite shell yesterday. Others worked.