Package: php4-sqlite3
Version: 0.4-1frontier1
Severity: important
Tags: patch
I contacted the maintainer for this package about a year ago about
transaction support in php4-sqlite3; below are a couple of the messages we
exchanged.
It would be nice if this patch could be included in the Debian packaging.
Unfortunately, it looks like it hasn't been committed upstream yet, but I've
pinged Bruno to see what's up. I'll post any followup I receive.
thanks,
john
Date: Wed, 31 May 2006 16:41:29 -0400
From: John Morrissey <[EMAIL PROTECTED]>
To: Bruno Fleisch <[EMAIL PROTECTED]>
Subject: Transaction support in SQLite-PHP
Hi Bruno--
I tried e-mailing Chris Burton, who's listed as the maintainer for the
SourceForge project, but my message bounced[1]. I found your contact
information in the Debian packaging for SQLite-PHP - I hope you're an
appropriate person to contact. If not, could you please let me know who I
should be in touch with?
I'm having a problem with transaction support with SQLite-PHP 0.4 and SQLite
3.3.5 (the Debian versions of both, FWIW). Based on the symptoms, it acts
like autocommit mode is never being disabled. I can create a simple table,
start a transaction, insert a row, then ROLLBACK, but the row I inserted
remains. Here's a simple test case I got it down to:
<?php
system("sqlite3 foo.db 'CREATE TABLE user ( uid VARCHAR(32) );'");
require_once 'DB.php';
$db = DB::connect('sqlite3:///foo.db');
if (PEAR::isError($db)) {
die($db->getMessage() . "\n");
}
foreach (array(
"BEGIN TRANSACTION;",
"INSERT INTO user (uid) VALUES('jwm2');",
"ROLLBACK;") as $query) {
print "$query\n";
$result = $db->query($query);
if (PEAR::isError($result)) {
die($query->getMessage() . "\n");
}
}
The system() part to create the table isn't significant; the same symptoms
appear if I create the table via SQLite-PHP. If I execute the same
statements with the command line SQLite client, the behavior is as I would
expect - after the ROLLBACK, the table is empty.
Am I doing something wrong, or making a false assumption? I haven't had a
chance to delve into the SQLite-PHP source yet, but I would appreciate it if
you could have a look at this.
thanks!
john
[1] <[EMAIL PROTECTED]>: host
mail.sourceforge.net[66.35.250.206] said: 550-This
@users.sourceforge.net account doesn't exist or isn't currently
550-functioning (mail to them is bouncing). You can check that you have
the 550-right address by checking http://sourceforge.net/users/cburton/.
It's also 550-possible that this alias just isn't active yet. It may
take a few minutes 550 for new accounts to become active. (in reply to
RCPT TO command)
--
John Morrissey _o /\ ---- __o
[EMAIL PROTECTED] _-< \_ / \ ---- < \,
www.horde.net/ __(_)/_(_)________/ \_______(_) /_(_)__
Date: Fri, 02 Jun 2006 10:09:36 +0200
From: Bruno Fleisch <[EMAIL PROTECTED]>
To: John Morrissey <[EMAIL PROTECTED]>
Subject: Re: Transaction support in SQLite-PHP
Selon John Morrissey <[EMAIL PROTECTED]>:
> On Thu, Jun 01, 2006 at 05:56:24PM +0200, Bruno Fleisch wrote:
> > Attached is a patch made against DB/sqlite3.php that should solve this
> > issue.
> >
> > I've discovered that the BEGIN & END/ROLLBACK statments are executed by
> > sqlite3_query(), like all regualar SELECT queries. Such queries are NOT
> > performed until a fetchInto-like function is called.
> >
> > I've changed a bit that function. sqlite3_query() gets called by SELECT
> > queries, all others are handled by sqlite3_exec().
> >
> > Let me know if it works for you,
>
> Nifty - thanks for the quick response. There was no patch attached, though.
>
Let's try again...
Below is the patch's content.
Regards,
Bruno
--- sqlite3.php.org 2006-06-01 17:42:41.000000000 +0200
+++ sqlite3.php 2006-06-01 17:42:12.000000000 +0200
@@ -19,7 +19,7 @@
* @author Bruno Fleisch
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0
- * @version CVS: $Id: sqlite3.php,v 1.2 2006/03/28 15:33:30 bfleisch Exp $
+ * @version CVS: $Id: sqlite3.php,v 1.1.1.1 2005/10/13 20:24:55 bfleisch Exp
$
* @link http://pear.php.net/package/DB
*/
@@ -124,10 +124,10 @@
function simpleQuery($query)
{
-
- $isManip = DB::isManip($query);
-
- if ($isManip)
+
+ $isSelect = preg_match ("/^\s*SELECT/i", $query);
+
+ if (! $isSelect)
$this->result = sqlite3_exec($this->connection, $query);
else
$this->result = sqlite3_query($this->connection, $query);
-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.12-10-xeon
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages php4-sqlite3 depends on:
ii libapache-mod-php4 [p 4:4.3.10-19 server-side, HTML-embedded scripti
ii libapache2-mod-php4 [ 4:4.3.10-19 server-side, HTML-embedded scripti
ii libc6 2.3.2.ds1-22sarge5 GNU C Library: Shared libraries an
ii libsqlite3-0 3.3.5-0.2 SQLite 3 shared library
ii php4-cli [phpapi-2002 4:4.3.10-19 command-line interpreter for the p
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]