Re: [sqlite] Re ferential Integrity
gherwrote: > Hello everybody, does support "referential integrity" SQLITE database..? Yes it does. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] BINARY type
Hi, I was curious if there's a reason why BINARY as a column type doesn't produce a column without a type affinity like BLOB. This would be one less special case between SQLite and other RDMS. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Re ferential Integrity
Hello everybody, does support "referential integrity" SQLITE database..? Gher -- View this message in context: http://old.nabble.com/Referential-Integrity-tp29477414p29477414.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to execute '.read ...' along with some other commands from command-line?
On 18 August 2010 22:45, Peng Yuwrote: > Hi, > > I'm trying to use '.read ...' along with other commands from > command-line. But it was not successful. Could anybody let me know > what is the correct way to do so? > > $ cat main.sql > select 4; > $ cat main.sh > #!/usr/bin/env bash > > sqlite3 main.db3 'select 3; select 4;' > sqlite3 main.db3 '.read main.sql' > sqlite3 main.db3 'select 3; .read main.sql' > $ ./main.sh > 3 > 4 > 4 > 3 > Error: near ".": syntax error Here's a thread from some time ago: http://www.mail-archive.com/sqlite-users@sqlite.org/msg34690.html Mixing SQL with sqlite shell meta-commands in the first command string does not work. So: echo select 3;>mainplus.sql echo .read main.sql >> mainplus.sql sqlite3 main.db3 ".read mainplus.sql" > > -- > Regards, > Peng Regards, Simon ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] [PATCH] Fix locale-unsafe usage of tolower (upstreaming Chromium change)
I'm not sure Chromium has any fts1 databases, I think the original patch was applied there for completeness. The change from fts2 to fts3 has been made in the history system, but it only applies to new data, and hasn't yet rolled out to stable. So we wouldn't be able to even start to cease using it for awhile. Furthermore, for performance reasons we segment and finalize the history data by month, so older data will continue to use fts2. We could add new code to upgrade that older data, though there would be some risk of that causing new problems (some of the data has been idle for a long time, so no doubt we'll flush out undetected corruptions, etc), and the straight-forward migration strategy would require fts2 to stay linked until we had some confidence that most of the users had launched their browsers for long enough that the migration had completed. So it wouldn't really be the preferred solution, given that the current code is fairly well-tested (for our case). I suppose we could pull in the time window by using internals knowledge to upgrade fts2 tables manually. Either we could steal the document table and load it into an fts3 table, or we could edit the sqlite_master table directly to convert it to an fts3 table. Hmm. Or it's possible we could have fts3.c register as handling fts2 tables, which I think would work alright in the read-only case, though it's mis-leading at best. It is also possible that there are web-developer-controlled tables in the wild using fts2 (I mean like WHATWG Web SQL Database). I lobbied to include fts3 for that because I didn't think we should encourage fts2, but I don't know whether I caught it soon enough. I also don't know the status of this WRT Gears, though for purposes of Chromium upstreaming things I don't think that matters. -scott On Wed, Aug 18, 2010 at 1:49 PM, Richard Hippwrote: > I'm thinking that you shouldn't be using FTS1 and FTS2 in the first place. > They are untested and unsupported. We'll get around to patching them, if > you insist, but right now we are busy trying to 3.7.1 out the door. > > On Wed, Aug 18, 2010 at 4:41 PM, Paweł Hajdan, Jr. > wrote: > >> On Tue, Aug 10, 2010 at 13:16, Paweł Hajdan, Jr. > >wrote: >> >> > Now, how about fts1 and fts2? The original chromium patch is at >> > http://codereview.chromium.org/174387 . Could you take a look and >> suggest >> > a way to upstream those fixes to SQLite? >> > >> >> Ping about the above. Or have the fixes already been made and we just need >> to upgrade to new sqlite? >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > > > > -- > D. Richard Hipp > d...@sqlite.org > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to execute '.read ...' along with some other commands from command-line?
Hi, I'm trying to use '.read ...' along with other commands from command-line. But it was not successful. Could anybody let me know what is the correct way to do so? $ cat main.sql select 4; $ cat main.sh #!/usr/bin/env bash sqlite3 main.db3 'select 3; select 4;' sqlite3 main.db3 '.read main.sql' sqlite3 main.db3 'select 3; .read main.sql' $ ./main.sh 3 4 4 3 Error: near ".": syntax error -- Regards, Peng ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Question concerning foreign keys across databases
> In either case the insertion would > fail, since it can only be checked when it happens and it probably will > not be checked again afterwards. This is exactly the reason why it's not logical action: SQLite will check constraint only in those places where it knows that something is changed and constraint can be violated. And it shouldn't re-check it in million other places where nothing seems to be changed... To catch up with reason of "why" consider these scenarios: 1) You connected to main, attached texts, made foreign constraint and inserted some records. Then you created other connection to texts directly and deleted all referenced records. How should SQLite know that they cannot be deleted? 2) You made another connection to main and connected another database as "texts". How foreign keys should be enforced in this situation? Pavel On Wed, Aug 18, 2010 at 4:57 PM, Oliver Schneiderwrote: > Hello Pavel, > > thanks for your reply. > > On 2010-08-18 20:39, Pavel Ivanov wrote: >>> Summary: how can I use foreign keys across database boundaries? Is it at >>> all possible? >> >> No. It's logically incorrect action, so it's impossible. If you want >> consistency of your tables to be automatically checked by database >> engine you need to allow that engine to see those tables at all times. > Sorry to disagree, concerning the logic. But I can't see why an error > about texts.text instead of main.text would make such a difference. Why > is one more logical than the other? In either case the insertion would > fail, since it can only be checked when it happens and it probably will > not be checked again afterwards. > > If SQLite supports attaching multiple databases it would be natural to > support foreign tables across them. > > The only possible catch I see is if the references are two-way (or > more). Then it could really get messy, although the principle of failing > if the table does not exist would still apply. I guess I'll have to > dedicate a night or two to read over the code to get an idea about the > "why". > >> For SQLite it means that you need to keep those tables in one >> database. If you insist on keeping tables in different databases then >> your application should check consistency itself because it's the only >> one knowing how to keep track of different files. > I guess what I'll simply dump the data from the "static" DB (which will > only be modified manually) and import it right before creating the new > tables. > > > // Oliver > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Question concerning foreign keys across databases
Hello Pavel, thanks for your reply. On 2010-08-18 20:39, Pavel Ivanov wrote: >> Summary: how can I use foreign keys across database boundaries? Is it at >> all possible? > > No. It's logically incorrect action, so it's impossible. If you want > consistency of your tables to be automatically checked by database > engine you need to allow that engine to see those tables at all times. Sorry to disagree, concerning the logic. But I can't see why an error about texts.text instead of main.text would make such a difference. Why is one more logical than the other? In either case the insertion would fail, since it can only be checked when it happens and it probably will not be checked again afterwards. If SQLite supports attaching multiple databases it would be natural to support foreign tables across them. The only possible catch I see is if the references are two-way (or more). Then it could really get messy, although the principle of failing if the table does not exist would still apply. I guess I'll have to dedicate a night or two to read over the code to get an idea about the "why". > For SQLite it means that you need to keep those tables in one > database. If you insist on keeping tables in different databases then > your application should check consistency itself because it's the only > one knowing how to keep track of different files. I guess what I'll simply dump the data from the "static" DB (which will only be modified manually) and import it right before creating the new tables. // Oliver ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Question concerning foreign keys across databases
On Wed, Aug 18, 2010 at 1:39 PM, Pavel Ivanovwrote: >> Summary: how can I use foreign keys across database boundaries? Is it at >> all possible? > > No. It's logically incorrect action, so it's impossible. If you want > consistency of your tables to be automatically checked by database > engine you need to allow that engine to see those tables at all times. > For SQLite it means that you need to keep those tables in one > database. If you insist on keeping tables in different databases then > your application should check consistency itself because it's the only > one knowing how to keep track of different files. > So attaching the file1 before creating the table in file2 is going to fail? (Then sqlite would know about the {texts} table) Stephan > > Pavel > > On Wed, Aug 18, 2010 at 4:26 PM, Oliver Schneider wrote: >> Hello, >> >> when trying to use foreign keys I'm running into a problem. It could be >> that I hit some general limitation, but then again the error that I'm >> seeing could also be issued if the database with the table of the >> referenced foreign key is not attached. >> >> Here's what I'm trying to do. >> >> I have some meta-data that rarely changes (e.g. text strings with >> accompanying IDs) but is rather big. Suppose we have: >> >> - >> pragma foreign_keys = on; >> >> create table texts ( id integer primary key autoincrement, str text >> unique not null on conflict fail ); >> >> /* With the following data */ >> insert into texts(str) values('foo'); >> insert into texts(str) values('bar'); >> insert into texts(str) values('baz'); >> - >> >> I'll call this table {texts} from now on. It's contained in file1. Now >> comes some more variable data where I would prefer to use one database >> per "data set", so I create another database contained in file2 (which >> becomes {main}): >> >> - >> pragma foreign_keys = on; >> >> attach database file1 as text; >> >> /* This fails right away: >> >> create table main.result ( id integer primary key autoincrement, strid >> integer, details text default null, foreign key(strid) references >> text.texts(id) ); >> >> ... so I use: */ >> >> create table main.result ( id integer primary key autoincrement, strid >> integer, details text default null, foreign key(strid) references >> texts(id) ); >> >> /* Which succeeds for the moment, until ... */ >> >> insert into result(strid,details) values (1,'some foo value'); >> - >> >> This last line gives me "Error: no such table: main.texts", which, I >> suppose, is due to the constraint check for the foreign key "strid". >> >> The given error message obviously makes sense. However, since the >> constraint check is done upon insertion referencing an attached database >> shouldn't really pose a problem, right? At worst - e.g. if I hadn't >> attached "file1 as text" - I would get the that error with a slight >> variation: "Error: no such table: text.texts" ... >> >> Summary: how can I use foreign keys across database boundaries? Is it at >> all possible? >> >> >> Thanks, >> >> // Oliver >> >> PS: I'm using SQLite version 3.6.22 >> PPS: Tried to send it with PGP/MIME signature, but it didn't get through >> according to the list archive, so sending without signature. >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Stephan Wehner -> http://stephan.sugarmotor.org (blog and homepage) -> http://loggingit.com -> http://www.thrackle.org -> http://www.buckmaster.ca -> http://www.trafficlife.com -> http://stephansmap.org -- http://blog.stephansmap.org -> http://twitter.com/stephanwehner / @stephanwehner ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] [PATCH] Fix locale-unsafe usage of tolower (upstreaming Chromium change)
I'm thinking that you shouldn't be using FTS1 and FTS2 in the first place. They are untested and unsupported. We'll get around to patching them, if you insist, but right now we are busy trying to 3.7.1 out the door. On Wed, Aug 18, 2010 at 4:41 PM, Paweł Hajdan, Jr.wrote: > On Tue, Aug 10, 2010 at 13:16, Paweł Hajdan, Jr. >wrote: > > > Now, how about fts1 and fts2? The original chromium patch is at > > http://codereview.chromium.org/174387 . Could you take a look and > suggest > > a way to upstream those fixes to SQLite? > > > > Ping about the above. Or have the fixes already been made and we just need > to upgrade to new sqlite? > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] [PATCH] Fix locale-unsafe usage of tolower (upstreaming Chromium change)
On Tue, Aug 10, 2010 at 13:16, Paweł Hajdan, Jr.wrote: > Now, how about fts1 and fts2? The original chromium patch is at > http://codereview.chromium.org/174387 . Could you take a look and suggest > a way to upstream those fixes to SQLite? > Ping about the above. Or have the fixes already been made and we just need to upgrade to new sqlite? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Question concerning foreign keys across databases
> Summary: how can I use foreign keys across database boundaries? Is it at > all possible? No. It's logically incorrect action, so it's impossible. If you want consistency of your tables to be automatically checked by database engine you need to allow that engine to see those tables at all times. For SQLite it means that you need to keep those tables in one database. If you insist on keeping tables in different databases then your application should check consistency itself because it's the only one knowing how to keep track of different files. Pavel On Wed, Aug 18, 2010 at 4:26 PM, Oliver Schneiderwrote: > Hello, > > when trying to use foreign keys I'm running into a problem. It could be > that I hit some general limitation, but then again the error that I'm > seeing could also be issued if the database with the table of the > referenced foreign key is not attached. > > Here's what I'm trying to do. > > I have some meta-data that rarely changes (e.g. text strings with > accompanying IDs) but is rather big. Suppose we have: > > - > pragma foreign_keys = on; > > create table texts ( id integer primary key autoincrement, str text > unique not null on conflict fail ); > > /* With the following data */ > insert into texts(str) values('foo'); > insert into texts(str) values('bar'); > insert into texts(str) values('baz'); > - > > I'll call this table {texts} from now on. It's contained in file1. Now > comes some more variable data where I would prefer to use one database > per "data set", so I create another database contained in file2 (which > becomes {main}): > > - > pragma foreign_keys = on; > > attach database file1 as text; > > /* This fails right away: > > create table main.result ( id integer primary key autoincrement, strid > integer, details text default null, foreign key(strid) references > text.texts(id) ); > > ... so I use: */ > > create table main.result ( id integer primary key autoincrement, strid > integer, details text default null, foreign key(strid) references > texts(id) ); > > /* Which succeeds for the moment, until ... */ > > insert into result(strid,details) values (1,'some foo value'); > - > > This last line gives me "Error: no such table: main.texts", which, I > suppose, is due to the constraint check for the foreign key "strid". > > The given error message obviously makes sense. However, since the > constraint check is done upon insertion referencing an attached database > shouldn't really pose a problem, right? At worst - e.g. if I hadn't > attached "file1 as text" - I would get the that error with a slight > variation: "Error: no such table: text.texts" ... > > Summary: how can I use foreign keys across database boundaries? Is it at > all possible? > > > Thanks, > > // Oliver > > PS: I'm using SQLite version 3.6.22 > PPS: Tried to send it with PGP/MIME signature, but it didn't get through > according to the list archive, so sending without signature. > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Question concerning foreign keys across databases
Hello, when trying to use foreign keys I'm running into a problem. It could be that I hit some general limitation, but then again the error that I'm seeing could also be issued if the database with the table of the referenced foreign key is not attached. Here's what I'm trying to do. I have some meta-data that rarely changes (e.g. text strings with accompanying IDs) but is rather big. Suppose we have: - pragma foreign_keys = on; create table texts ( id integer primary key autoincrement, str text unique not null on conflict fail ); /* With the following data */ insert into texts(str) values('foo'); insert into texts(str) values('bar'); insert into texts(str) values('baz'); - I'll call this table {texts} from now on. It's contained in file1. Now comes some more variable data where I would prefer to use one database per "data set", so I create another database contained in file2 (which becomes {main}): - pragma foreign_keys = on; attach database file1 as text; /* This fails right away: create table main.result ( id integer primary key autoincrement, strid integer, details text default null, foreign key(strid) references text.texts(id) ); ... so I use: */ create table main.result ( id integer primary key autoincrement, strid integer, details text default null, foreign key(strid) references texts(id) ); /* Which succeeds for the moment, until ... */ insert into result(strid,details) values (1,'some foo value'); - This last line gives me "Error: no such table: main.texts", which, I suppose, is due to the constraint check for the foreign key "strid". The given error message obviously makes sense. However, since the constraint check is done upon insertion referencing an attached database shouldn't really pose a problem, right? At worst - e.g. if I hadn't attached "file1 as text" - I would get the that error with a slight variation: "Error: no such table: text.texts" ... Summary: how can I use foreign keys across database boundaries? Is it at all possible? Thanks, // Oliver PS: I'm using SQLite version 3.6.22 PPS: Tried to send it with PGP/MIME signature, but it didn't get through according to the list archive, so sending without signature. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in FTS3 when trying to rename table within a transaction
On Aug 19, 2010, at 1:21 AM, Nasron Cheong wrote: > I'm getting a db error when trying to alter an fts table within a > transaction. > > This only happens if the statement before the alter is an insert. Thanks for the report. This won't get fixed until after 3.7.1 though. For now, fts3 tables should only renamed outside of transactions. Dan. > > See below: > > D:\temp>sqlite3 tmp.db > SQLite version 3.6.23.1 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> create table NonFts (docid integer, msg string); > sqlite> create virtual table Fts using fts3(msg); > > sqlite> begin; > sqlite> insert into NonFts(docid,msg) values(1, "bob"); > sqlite> alter table nonfts rename to nonfts2; > sqlite> commit; //OK > > sqlite> begin; > sqlite> insert into fts(docid,msg) values(1,"bob"); > sqlite> alter table fts rename to fts2; > sqlite> commit; > Error: SQL logic error or missing database > sqlite> > > sqlite> begin; > sqlite> alter table fts rename to fts2; > sqlite> commit; //OK > > Something I should be doing differently? > > Thanks > > - Nasron Cheong > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Bug in FTS3 when trying to rename table within a transaction
I'm getting a db error when trying to alter an fts table within a transaction. This only happens if the statement before the alter is an insert. See below: D:\temp>sqlite3 tmp.db SQLite version 3.6.23.1 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table NonFts (docid integer, msg string); sqlite> create virtual table Fts using fts3(msg); sqlite> begin; sqlite> insert into NonFts(docid,msg) values(1, "bob"); sqlite> alter table nonfts rename to nonfts2; sqlite> commit; //OK sqlite> begin; sqlite> insert into fts(docid,msg) values(1,"bob"); sqlite> alter table fts rename to fts2; sqlite> commit; Error: SQL logic error or missing database sqlite> sqlite> begin; sqlite> alter table fts rename to fts2; sqlite> commit; //OK Something I should be doing differently? Thanks - Nasron Cheong ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Why the deadlock?
Nikolaus Rathwrites: > Dan Kennedy writes: >> On Aug 17, 2010, at 1:48 AM, Nikolaus Rath wrote: >> >>> Hello, >>> >>> The script below fails with >>> >>> Deadlock detected when executing 'DELETE FROM foo WHERE id=2' >>> >>> What I think should be happening instead is this: >>> >>> - When executing statement 1, the main thread obtains a SHARED lock. >> >>> - When executing statement 2, the main thread briefly obtains an >>> EXCLUSIVE lock. After statement 2 is executed, the EXCLUSIVE lock is >>> released and the main thread continues to hold the SHARED lock >>> (since >>> statement 1 is still active) >> >> Quite correct. > > Hmm. That's quite the opposite of what Igor said in his mail. Who is > right now? Still no one able to clarify the issues raised in this thread? Let me try to summarize what I still don't understand: - Will SQLite acquire and release an EXCLUSIVE lock while keeping a SHARED lock if one executes a UPDATE query with one cursor while a different cursor is in the middle of a SELECT query, -or- will the EXCLUSIVE lock be held until the SELECT query finishes? - Is there a way to prevent SQLite from keeping the SHARED lock while waiting for an EXCLUSIVE lock if doing so would result in a deadlock (because another connection holding a SHARED lock needs to get an EXCLUSIVE lock before it can release the SHARED lock)? Thanks, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] multiple conections for the same database
> #1 WAL COMMIT will not corrupt current reading thread (even if deletes occur, > changes/adds are not visible either). > #2 Next SELECT transaction will pick up the new data. > Correct? Yes that's correct. > Dangerous thing would be two threads writing if either one is using a currect > SELECT for it's updatable dataset. Is this even possible? No. WAL journal mode still doesn't allow 2 concurrent writers. Pavel On Wed, Aug 18, 2010 at 11:10 AM, Black, Michael (IS)wrote: > Soto clarify...this is a completely safe operation in 3.7.0.1.??? > > #1 WAL COMMIT will not corrupt current reading thread (even if deletes occur, > changes/adds are not visible either). > #2 Next SELECT transaction will pick up the new data. > Correct? > > Dangerous thing would be two threads writing if either one is using a currect > SELECT for it's updatable dataset. Is this even possible? > > Michael D. Black > Senior Scientist > Advanced Analytics Directorate > Northrop Grumman Information Systems > > > > > From: sqlite-users-boun...@sqlite.org on behalf of Pavel Ivanov > Sent: Wed 8/18/2010 9:57 AM > To: General Discussion of SQLite Database > Subject: EXTERNAL:Re: [sqlite] multiple conections for the same database > > > >> Which means the read works on old data until you COMMIT? >> Is that true? So that COMMIT will allow you to query the changed/new data >> from the other thread? > > AFAIK, no. Of course until you COMMIT no reader will see your data. > But after you commit all already started reading transactions won't > see your changes. Reading transaction should be started after COMMIT > to see changes. > > > Pavel > > On Wed, Aug 18, 2010 at 10:50 AM, Black, Michael (IS) > wrote: >> Which means the read works on old data until you COMMIT? >> Is that true? So that COMMIT will allow you to query the changed/new data >> from the other thread? >> >> Michael D. Black >> Senior Scientist >> Advanced Analytics Directorate >> Northrop Grumman Information Systems >> >> >> >> >> From: sqlite-users-boun...@sqlite.org on behalf of Pavel Ivanov >> Sent: Wed 8/18/2010 9:15 AM >> To: General Discussion of SQLite Database >> Subject: EXTERNAL:Re: [sqlite] multiple conections for the same database >> >> >> >>> SQLite allows multiple readers, or exactly one wrier, accessing the >>> database at the same time. You can't read and write simultaneously, you >>> must arrange for your connections to take turns. SQLITE_BUSY error is a >>> signal for you to back off, wait a little, then try again. See also >>> http://sqlite.org/c3ref/busy_timeout.html >> >> A little correction to this: in latest version (3.7.0.1) with WAL >> journal mode SQLite can read old data while another connection >> writing. So things could be a little easier for you. >> >> >> Pavel >> >> On Wed, Aug 18, 2010 at 8:11 AM, Igor Tandetnik wrote: >>> andres felipe tamayo cortes wrote: i have one application who reads a database, it run well without problems, but when i tried to load this dabase from other program (while its still running the first application), appearsme database blocked, isnt it possible to load one database from more than one programm at time? what i am tring to do its that one program reads the database while other program writes so the first program has to see what the second programs write. >>> >>> SQLite allows multiple readers, or exactly one wrier, accessing the >>> database at the same time. You can't read and write simultaneously, you >>> must arrange for your connections to take turns. SQLITE_BUSY error is a >>> signal for you to back off, wait a little, then try again. See also >>> http://sqlite.org/c3ref/busy_timeout.html >>> -- >>> Igor Tandetnik >>> >>> ___ >>> sqlite-users mailing list >>> sqlite-users@sqlite.org >>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >>> >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> >> >> >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> >> > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] multiple conections for the same database
Soto clarify...this is a completely safe operation in 3.7.0.1.??? #1 WAL COMMIT will not corrupt current reading thread (even if deletes occur, changes/adds are not visible either). #2 Next SELECT transaction will pick up the new data. Correct? Dangerous thing would be two threads writing if either one is using a currect SELECT for it's updatable dataset. Is this even possible? Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Pavel Ivanov Sent: Wed 8/18/2010 9:57 AM To: General Discussion of SQLite Database Subject: EXTERNAL:Re: [sqlite] multiple conections for the same database > Which means the read works on old data until you COMMIT? > Is that true? So that COMMIT will allow you to query the changed/new data > from the other thread? AFAIK, no. Of course until you COMMIT no reader will see your data. But after you commit all already started reading transactions won't see your changes. Reading transaction should be started after COMMIT to see changes. Pavel On Wed, Aug 18, 2010 at 10:50 AM, Black, Michael (IS)wrote: > Which means the read works on old data until you COMMIT? > Is that true? So that COMMIT will allow you to query the changed/new data > from the other thread? > > Michael D. Black > Senior Scientist > Advanced Analytics Directorate > Northrop Grumman Information Systems > > > > > From: sqlite-users-boun...@sqlite.org on behalf of Pavel Ivanov > Sent: Wed 8/18/2010 9:15 AM > To: General Discussion of SQLite Database > Subject: EXTERNAL:Re: [sqlite] multiple conections for the same database > > > >> SQLite allows multiple readers, or exactly one wrier, accessing the database >> at the same time. You can't read and write simultaneously, you must arrange >> for your connections to take turns. SQLITE_BUSY error is a signal for you to >> back off, wait a little, then try again. See also >> http://sqlite.org/c3ref/busy_timeout.html > > A little correction to this: in latest version (3.7.0.1) with WAL > journal mode SQLite can read old data while another connection > writing. So things could be a little easier for you. > > > Pavel > > On Wed, Aug 18, 2010 at 8:11 AM, Igor Tandetnik wrote: >> andres felipe tamayo cortes wrote: >>> i have one application who reads a database, it run well without problems, >>> but when i tried to load this dabase from other >>> program (while its still running the first application), appearsme database >>> blocked, isnt it possible to load one database from >>> more than one programm at time? >>> >>> what i am tring to do its that one program reads the database while other >>> program writes so the first program has to see what the >>> second programs write. >> >> SQLite allows multiple readers, or exactly one wrier, accessing the database >> at the same time. You can't read and write simultaneously, you must arrange >> for your connections to take turns. SQLITE_BUSY error is a signal for you to >> back off, wait a little, then try again. See also >> http://sqlite.org/c3ref/busy_timeout.html >> -- >> Igor Tandetnik >> >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] multiple conections for the same database
> Which means the read works on old data until you COMMIT? > Is that true? So that COMMIT will allow you to query the changed/new data > from the other thread? AFAIK, no. Of course until you COMMIT no reader will see your data. But after you commit all already started reading transactions won't see your changes. Reading transaction should be started after COMMIT to see changes. Pavel On Wed, Aug 18, 2010 at 10:50 AM, Black, Michael (IS)wrote: > Which means the read works on old data until you COMMIT? > Is that true? So that COMMIT will allow you to query the changed/new data > from the other thread? > > Michael D. Black > Senior Scientist > Advanced Analytics Directorate > Northrop Grumman Information Systems > > > > > From: sqlite-users-boun...@sqlite.org on behalf of Pavel Ivanov > Sent: Wed 8/18/2010 9:15 AM > To: General Discussion of SQLite Database > Subject: EXTERNAL:Re: [sqlite] multiple conections for the same database > > > >> SQLite allows multiple readers, or exactly one wrier, accessing the database >> at the same time. You can't read and write simultaneously, you must arrange >> for your connections to take turns. SQLITE_BUSY error is a signal for you to >> back off, wait a little, then try again. See also >> http://sqlite.org/c3ref/busy_timeout.html > > A little correction to this: in latest version (3.7.0.1) with WAL > journal mode SQLite can read old data while another connection > writing. So things could be a little easier for you. > > > Pavel > > On Wed, Aug 18, 2010 at 8:11 AM, Igor Tandetnik wrote: >> andres felipe tamayo cortes wrote: >>> i have one application who reads a database, it run well without problems, >>> but when i tried to load this dabase from other >>> program (while its still running the first application), appearsme database >>> blocked, isnt it possible to load one database from >>> more than one programm at time? >>> >>> what i am tring to do its that one program reads the database while other >>> program writes so the first program has to see what the >>> second programs write. >> >> SQLite allows multiple readers, or exactly one wrier, accessing the database >> at the same time. You can't read and write simultaneously, you must arrange >> for your connections to take turns. SQLITE_BUSY error is a signal for you to >> back off, wait a little, then try again. See also >> http://sqlite.org/c3ref/busy_timeout.html >> -- >> Igor Tandetnik >> >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] multiple conections for the same database
Which means the read works on old data until you COMMIT? Is that true? So that COMMIT will allow you to query the changed/new data from the other thread? Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Pavel Ivanov Sent: Wed 8/18/2010 9:15 AM To: General Discussion of SQLite Database Subject: EXTERNAL:Re: [sqlite] multiple conections for the same database > SQLite allows multiple readers, or exactly one wrier, accessing the database > at the same time. You can't read and write simultaneously, you must arrange > for your connections to take turns. SQLITE_BUSY error is a signal for you to > back off, wait a little, then try again. See also > http://sqlite.org/c3ref/busy_timeout.html A little correction to this: in latest version (3.7.0.1) with WAL journal mode SQLite can read old data while another connection writing. So things could be a little easier for you. Pavel On Wed, Aug 18, 2010 at 8:11 AM, Igor Tandetnikwrote: > andres felipe tamayo cortes wrote: >> i have one application who reads a database, it run well without problems, >> but when i tried to load this dabase from other >> program (while its still running the first application), appearsme database >> blocked, isnt it possible to load one database from >> more than one programm at time? >> >> what i am tring to do its that one program reads the database while other >> program writes so the first program has to see what the >> second programs write. > > SQLite allows multiple readers, or exactly one wrier, accessing the database > at the same time. You can't read and write simultaneously, you must arrange > for your connections to take turns. SQLITE_BUSY error is a signal for you to > back off, wait a little, then try again. See also > http://sqlite.org/c3ref/busy_timeout.html > -- > Igor Tandetnik > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] multiple conections for the same database
> SQLite allows multiple readers, or exactly one wrier, accessing the database > at the same time. You can't read and write simultaneously, you must arrange > for your connections to take turns. SQLITE_BUSY error is a signal for you to > back off, wait a little, then try again. See also > http://sqlite.org/c3ref/busy_timeout.html A little correction to this: in latest version (3.7.0.1) with WAL journal mode SQLite can read old data while another connection writing. So things could be a little easier for you. Pavel On Wed, Aug 18, 2010 at 8:11 AM, Igor Tandetnikwrote: > andres felipe tamayo cortes wrote: >> i have one application who reads a database, it run well without problems, >> but when i tried to load this dabase from other >> program (while its still running the first application), appearsme database >> blocked, isnt it possible to load one database from >> more than one programm at time? >> >> what i am tring to do its that one program reads the database while other >> program writes so the first program has to see what the >> second programs write. > > SQLite allows multiple readers, or exactly one wrier, accessing the database > at the same time. You can't read and write simultaneously, you must arrange > for your connections to take turns. SQLITE_BUSY error is a signal for you to > back off, wait a little, then try again. See also > http://sqlite.org/c3ref/busy_timeout.html > -- > Igor Tandetnik > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Sizeof tables
On Tue, Aug 17, 2010 at 4:28 PM, Lukas Haasewrote: > Hi, > > My sqlite database is about 65 MB. The data is split into serval tables. > > Is there a way to enumerate the space requirements for each table so > that I can see which tables are the memory consumers? > > Look at this discussion: http://www.mail-archive.com/sqlite-users@sqlite.org/msg53997.html at least two variants of the solution there. Max ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Forthcoming release of SQLite 3.7.1
SQLite is a great product; I use SEE, the encrypted edition. For those of us who are not using the C interface, I'd like to request that when possible, new C features like hinting about file sizes and extents also be added as pragmas. Pragmas make it very easy for non-C interfaces to make use of the new features. The async writer thread in earlier versions is one feature I'd really like to use, or at least try out, but I'm using pysqlite bindings. If there was a pragma to activate this, it'd be a snap. Thanks for providing a great library! Jim On 8/18/10, Richard Hippwrote: > We are striving to release SQLite version 3.7.1 within the next few days. > If you have any feedback, objections, comments, or concerns about this > release, please respond as soon as possible to this mailing list, or via > private email to me. > > A summary of the changes in 3.7.1 can be found here: > http://www.sqlite.org/draft/releaselog/3_7_1.html > > A release candidate amalgamation can be downloaded from here: > http://www.sqlite.org/draft/download.html > > Code changes since the prior release can be seen here (warning - approx > 10,000 lines of diff output): > http://www.sqlite.org/src/vdiff?from=release=trunk=1 > > -- > D. Richard Hipp > d...@sqlite.org > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- -- HashBackup: easy onsite and offsite Unix backup http://sites.google.com/site/hashbackup ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] fast string prefix matching
Doug Reederwrote: > Does SQLite treat strings as sequences of opaque 16-bit values, except > for the wildcard operators for LIKE and GLOB? Does it care about > surrogate code points? Does it care about FDD0 to FDEF ? SQLite knows something about surrogate pairs - this knowledge is required in order to properly convert between UTF-16 and UTF-8. I'm not sure whether " x LIKE '_' " would match a string that consists of a surrogate pair - in other words, whether a surrogate pair counts as one character or as two. You can figure this out experimentally, if you care. SQLite knows about some properties of characters in ASCII range. E.g. LIKE is case-insensitive by default, and " 'A' LIKE 'a' " is true for plain vanilla latin A, but not for, say, cyrillic A or greek alpha or italian A with grave. All other characters are treated as opaque bits to be shuffled around, in the out-of-the-box configuration. However, it's possible to install custom collations and custom implementations of LIKE, GLOB and MATCH that are more aware of the properties of Unicode characters. ICU extension does just that: http://www.sqlite.org/cvstrac/fileview?f=sqlite/ext/icu/README.txt -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Forthcoming release of SQLite 3.7.1
We are striving to release SQLite version 3.7.1 within the next few days. If you have any feedback, objections, comments, or concerns about this release, please respond as soon as possible to this mailing list, or via private email to me. A summary of the changes in 3.7.1 can be found here: http://www.sqlite.org/draft/releaselog/3_7_1.html A release candidate amalgamation can be downloaded from here: http://www.sqlite.org/draft/download.html Code changes since the prior release can be seen here (warning - approx 10,000 lines of diff output): http://www.sqlite.org/src/vdiff?from=release=trunk=1 -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] getting table notifications
Mark Chekhanovskiy (mchekhan)wrote: > I had been experimenting with TEMP triggers and > sqlite3_create_function() to get the notification about the table > changes. It seems to work on the same db connection within one thread. > Anyone tried doing similar stuff for two+ processes connecting to the > same db instance? Yes, and they all failed. SQLite is not designed to be an interprocess communication mechanism. The best you can do is polling, or the processes could communicate by some means outside SQLite. > PS. I will try using shared connection tomorrow. I suppose you mean shared cache mode. This only works within a single process. And you still won't have triggers on one connection fired by changes made on another. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Sizeof tables
Hi, My sqlite database is about 65 MB. The data is split into serval tables. Is there a way to enumerate the space requirements for each table so that I can see which tables are the memory consumers? Regards, Luke ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] multiple conections for the same database
HI, i have a doubt: i have one application who reads a database, it run well without problems, but when i tried to load this dabase from other program (while its still running the first application), appearsme database blocked, isnt it possible to load one database from more than one programm at time? what i am tring to do its that one program reads the database while other program writes so the first program has to see what the second programs write. what do i have to do?? thanks :) ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] fast string prefix matching
On 18 Aug 2010, at 7:26am, Doug Reeder wrote: > Does SQLite treat strings as sequences of opaque 16-bit values, except > for the wildcard operators for LIKE and GLOB? Does it care about > surrogate code points? Does it care about FDD0 to FDEF ? The first: opaque. It doesn't understand anything about two-byte text, Unicode, or even FFFE/FEFF. LIKE and GLOB operate on a strictly ASCII basis, and behaviour with anything with the top bit set is unpredictable. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] getting table notifications
Hi I had been experimenting with TEMP triggers and sqlite3_create_function() to get the notification about the table changes. It seems to work on the same db connection within one thread. Anyone tried doing similar stuff for two+ processes connecting to the same db instance? My ultimate goal is for having 2+ processes to connect/attach the same db.file and having 1+ process to update db records and others getting "notified" about the effected rows/columns. Thanks in advance, Mark PS. I will try using shared connection tomorrow. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] fast string prefix matching
On Aug 17, 2010, at 9:28 PM, Igor Tandetnik wrote: > Doug Reederwrote: >> I need to search for string prefix matches; for example given the >> path 'PP', >> I need to find 'PPA', 'PPBJQ', and 'PPz'. (The character set is all >> characters greater than or equal to 'A', and is case-sensitive.) A >> statement that does exactly what I want is >> >> "UPDATE item SET hasChildren = EXISTS (SELECT path FROM item AS c >> WHERE >> substr(c.path, 1, length(item.path)) == item.path AND >> length(c.path) > >> length(item.path)) WHERE path = ? OR path = ?" > > Try this: > > select path from item as c > where c.path > item.path and c.path <= item.path || 'z' > > You can use a large codepoint (say, U+ - it's not a valid > Unicode character, but SQLite won't complain) in place of 'z'. > -- > Igor Tandetnik That does what I need! Thanks! Does SQLite treat strings as sequences of opaque 16-bit values, except for the wildcard operators for LIKE and GLOB? Does it care about surrogate code points? Does it care about FDD0 to FDEF ? Doug Reeder reeder...@gmail.com http://reeder29.livejournal.com/ https://twitter.com/reeder29 https://twitter.com/hominidsoftware http://outlinetracker.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users