Re: [sqlite] Multiple update processes
Richard Boulton wrote: I have been experimenting with SQLite version 3.0 and am trying to implement a simple publish - subscribe model where multiple processes can publish/subscribe to messages stored in a SQLite table. This works fine when a single process is updating the database at any one time, however I am struggling to get this working with multiple processes concurrently updating the database. Once multiple processes try to perform updates on the database, most processes fail to update the database and I get lots of SQLITE_BUSY errors. I have tried using the sqlite3_busy_timeout routine, but this just seems to make things worse as all processes remain locked out for the period of the timeout and then return SQLITE_BUSY anyway. I turned on the debugging in the locking code and ran a simple case where 2 processes were trying to update the database, it appears that one process is trying to COMMIT it's transaction (it has a PENDING lock and is trying to get an EXCLUSIVE lock), while the other process is attempting to BEGIN a transaction (it has a SHARED lock and is trying to get a RESERVED lock). This seems to cause a deadlock for the period of the sqlite3_busy_timeout. Good point. I think the right fix for this is for me to change SQLite so that it does not invoke the busy callback when it is trying to acquire a RESERVED lock. If it fails to get a RESERVED lock, then it returns SQLITE_BUSY right away. The busy callback will then only be invoked when trying to get a PENDING lock. -- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565
[sqlite] Multiple update processes
Hi, I have been experimenting with SQLite version 3.0 and am trying to implement a simple publish - subscribe model where multiple processes can publish/subscribe to messages stored in a SQLite table. This works fine when a single process is updating the database at any one time, however I am struggling to get this working with multiple processes concurrently updating the database. Once multiple processes try to perform updates on the database, most processes fail to update the database and I get lots of SQLITE_BUSY errors. I have tried using the sqlite3_busy_timeout routine, but this just seems to make things worse as all processes remain locked out for the period of the timeout and then return SQLITE_BUSY anyway. I turned on the debugging in the locking code and ran a simple case where 2 processes were trying to update the database, it appears that one process is trying to COMMIT it's transaction (it has a PENDING lock and is trying to get an EXCLUSIVE lock), while the other process is attempting to BEGIN a transaction (it has a SHARED lock and is trying to get a RESERVED lock). This seems to cause a deadlock for the period of the sqlite3_busy_timeout. I had a look back through the mailing list and found a thread with a discussion in this area "A quick code review, analysis of locking model, "fine-tuning" suggestions", are any changes being made in this area to resolve this type of problem? I am new to SQLite so maybe I'm not handling the SQLITE_BUSY return codes correctly for this scenario. Does anybody know of a way to handle multiple processes updating a database efficiently in version 3? Many thanks, Richard
Re: [sqlite] Apostrophes in strings
Apply the php-function "sqlite_escape_string" on all the string data you insert/update to the database. That should to the trick. Thanks, it just makes a '' from ' instead of \' as with MySQL. Reminds me a bit of Visual Basic... It's the standard SQL way of escaping a ' character (MySQL (and some others) are incorrect to use \' - those need escaping of the \ character as well, which isn't necessary with the proper SQL method) PaulVPOP3 - Internet Email Server/Gateway [EMAIL PROTECTED] http://www.pscs.co.uk/
Re: [sqlite] Lemon Parser Examples - I'll show you my examples
On Thu, Aug 05, 2004 at 09:07:36AM -0400, Joseph Stewart wrote: > Many thanks for your contribution! > -joe > > On Wed, 4 Aug 2004 22:02:48 -0400, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > A user earlier posted a question about terminating > > the grammer for a simple calculator done with lemon. > > > > I ran into the same problem and had to use > > the following, which worked fine: > > > > main ::= in. > > in ::= . > > in ::= in state NEWLINE. > > > > I cannot reduce it any further. For instance, > > the following does not work: > > > > in ::= . > > in ::= in stmt ENDLINE. > > > > The version of lemon I'm using is from the > > cvs 3.0.3. > > > > The full calculator, there are 4 examples, can > > be downloaded from the following link: > > > > http://prdownloads.sourceforge.net/souptonuts/lemon_examples.tar.gz?download > > > > Look at example4.y, if you want to go directly to > > the terminating issue above. Everything should be in > > this download including lemon.c and lempar.c, so you > > won't have to download anything else. > > > > Take a look at the README. I tried to add documentation > > on creating custom tokens, destructors, and a little bit > > on what the grammer does. > > > > To run everything, just run make > > > >$ make > > > > Then, each example can be run separately > > > >$ ./ex1 > > > >$ ./ex2 > > > > > >$ ./ex4 > > > > Anyway, I hope this examples will help. Or > > inspire you to take a took at lemon. > > > > Regards, > > > > Mike Chirico > > > > I've added an example with flex, and I'm trying write some engaging documentation. If enough people find it useful, and if it can help bring people to SQLite, I'll change the license from GPL to the public domain. But, it will probably have to go through a few revisions first. Regards, Mike Chirico
Re: [sqlite] Apostrophes in strings
On 07.08.2004 12:04 (+0200), Yves Glodt wrote: Apply the php-function "sqlite_escape_string" on all the string data you insert/update to the database. That should to the trick. Thanks, it just makes a '' from ' instead of \' as with MySQL. Reminds me a bit of Visual Basic... p.s. There is also "mysql_escape_string" I did this myself by now... ;) -- Yves Goergen <[EMAIL PROTECTED]> BlackBoard Internet Newsboard System --> blackboard.unclassified.de Free (GPL), easy to use and install, secure, innovative! (PHP+MySQL)
Re: [sqlite] Apostrophes in strings
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Saturday 07 August 2004 11:46, Yves Goergen wrote: > Hi everyone, Hi, > I found the SQLite DLL for PHP today and just wanted to do some > testing with it. I could rewrite my dump of the MySQL tables and data > so that SQLite would understand it. But there's a fundamental problem > left. I have strings that contain ' characters. But strings are > written in '' characters theirselves. MySQL would want a > 'Rock\'n\'Roll' here, so ' get backlash-escaped. But there seems to > be a problem with it. I get no detailled error description, but when > I remove all \' it works. Here's my SQL and result: > > ---SQL > INSERT INTO tasks VALUES (1, 1, 1091182902, 'Access rules are not > applied to forums\' categories', 'ACL system:\nRules are only applied > to the specified and subsidiary forums. Guests may not be able to see > an actually accessible forum inside a category which they have no > view rights for.\n-> Extend forum rights to directly superior > categories in a way that doesn\'t open all other forums', 'ACL > apply', 5, 1, 1, 1091225287, 4, 1, 2, 0, 0, 0, 1, '1.5-dev-20040729', > '1.6', 0, 0, ''); --- > > ---PHP code > sqlite_query($db, join(file('bugs.sql'))); > --- > > ---PHP output > Warning: sqlite_query(): unrecognized token: ":" in > C:\wwwroot\projects\bugtracker\sql.php on line 4 > --- > > It means the : behind the \' I guess. Removing all \' helps to > execute the query. > > So how can I insert ' characters into a table other than by \'? Apply the php-function "sqlite_escape_string" on all the string data you insert/update to the database. That should to the trick. best regards, Yves p.s. There is also "mysql_escape_string" > PS: Subscription to this list has not replied my anything within an > hour, I home I'll get replies to this post. Please CC me to be sure. > TIA - -- Linux 2.4.26 #4 Wed Apr 14 19:23:19 CEST 2004 i686 12:02:09 up 1:16, 1 user, load average: 0.47, 0.21, 0.12 -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFBFKkmfmxiTOp0sQYRAqVyAJwJatsJXMRux5GLycT44Xx2BTen2ACfdC9a B7tKHzPdIp7MREx68Pstm2w= =3eqg -END PGP SIGNATURE-
[sqlite] Apostrophes in strings
Hi everyone, I found the SQLite DLL for PHP today and just wanted to do some testing with it. I could rewrite my dump of the MySQL tables and data so that SQLite would understand it. But there's a fundamental problem left. I have strings that contain ' characters. But strings are written in '' characters theirselves. MySQL would want a 'Rock\'n\'Roll' here, so ' get backlash-escaped. But there seems to be a problem with it. I get no detailled error description, but when I remove all \' it works. Here's my SQL and result: ---SQL INSERT INTO tasks VALUES (1, 1, 1091182902, 'Access rules are not applied to forums\' categories', 'ACL system:\nRules are only applied to the specified and subsidiary forums. Guests may not be able to see an actually accessible forum inside a category which they have no view rights for.\n-> Extend forum rights to directly superior categories in a way that doesn\'t open all other forums', 'ACL apply', 5, 1, 1, 1091225287, 4, 1, 2, 0, 0, 0, 1, '1.5-dev-20040729', '1.6', 0, 0, ''); --- ---PHP code sqlite_query($db, join(file('bugs.sql'))); --- ---PHP output Warning: sqlite_query(): unrecognized token: ":" in C:\wwwroot\projects\bugtracker\sql.php on line 4 --- It means the : behind the \' I guess. Removing all \' helps to execute the query. So how can I insert ' characters into a table other than by \'? PS: Subscription to this list has not replied my anything within an hour, I home I'll get replies to this post. Please CC me to be sure. TIA -- Yves Goergen <[EMAIL PROTECTED]> BlackBoard Internet Newsboard System --> blackboard.unclassified.de Free (GPL), easy to use and install, secure, innovative! (PHP+MySQL)
Re: [sqlite] QNX and PPC
[EMAIL PROTECTED] schrieb am 06.08.04 19:40:55: >Hello everybody, >does someone have any experience with building for the QNX operating >system? And for the Power PC processor? >QNX 6.2.1 is a real-time Linux but it behaves strangely sometimes. No .. it doesn't behave 'strangely" at all :) > It has not gcc but a qcc compiler. qcc is only a frontend of the gcc ... so QNX has gcc. >Our testing program runs correctly on >the x86 PC. It creates a database, a table, inserts and selects data. >But the same program cross-compiled on the same computer for PPC ends at >the first "CREATE TABLE" statement with SQLITE_BUSY. >I am using SQLite 2.8.6. Is it possible that the little-or-big-endian >thing could cause this trouble? That's the case .. Regards Armin Steinhoff >Or do you have any other ideas? >Thank you very much, >Jakub Aufnehmen, abschicken, nah sein - So einfach ist WEB.DE Video-Mail: http://freemail.web.de/?mc=021200