Re: [sqlite] [PHP5-FPM/Sqlite3] PDO can create file but no more

2010-07-28 Thread Gilles Ganault
On Tue, 27 Jul 2010 22:56:23 -0700, Roger Binns
 wrote:
>You can if you quote it.  Note use double quotes to quote table & column
>names, single quotes for strings.  You can also quote names using square
>brackets - eg [table name].

Thanks Roger for the tip.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [PHP5-FPM/Sqlite3] PDO can create file but no more

2010-07-28 Thread Simon Slavin

On 28 Jul 2010, at 6:56am, Roger Binns wrote:

> This works:
> 
>  create table ""("" "");

The obfuscated SQLite contest closed three months ago.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [PHP5-FPM/Sqlite3] PDO can create file but no more

2010-07-27 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/27/2010 05:48 AM, Gilles Ganault wrote:
> Found it: For newbies like me... "table" is a reserved name so cannot
> be used as a name to table:

You can if you quote it.  Note use double quotes to quote table & column
names, single quotes for strings.  You can also quote names using square
brackets - eg [table name].

  create table "table"(...)

Heck SQLite even lets you create tables and columns with zero length names.
 This works:

  create table ""("" "");

Obviously I wouldn't recommend doing that, nor using reserved names :-)

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxPxoEACgkQmOOfHg372QSzjQCggSYL4xSQVUG83Cfz7N1XFCnc
absAoKipjx0W6L6w4TIhXM9KWmhFRgn6
=u0Bs
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [PHP5-FPM/Sqlite3] PDO can create file but no more

2010-07-27 Thread Gilles Ganault
On Tue, 27 Jul 2010 14:40:11 +0200, Gilles Ganault
 wrote:
>I'm having a problem with this PHP5 script running under Nginx +
>PHP5-FPM and PDO-SQLite3

Found it: For newbies like me... "table" is a reserved name so cannot
be used as a name to table:


#BAD $dbh->exec("CREATE TABLE IF NOT EXISTS table (id INTEGER PRIMARY
KEY AUTOINCREMENT, name VARCHAR(255))"); 
#BAD $dbh->exec("INSERT INTO table (name) VALUES ('dummy')");

$dbh->exec("CREATE TABLE IF NOT EXISTS mytable (id INTEGER PRIMARY KEY
AUTOINCREMENT, name VARCHAR(255))"); 
$dbh->exec("INSERT INTO mytable (name) VALUES ('dummy')");


HTH,

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] [PHP5-FPM/Sqlite3] PDO can create file but no more

2010-07-27 Thread Gilles Ganault
Hello

I'm having a problem with this PHP5 script running under Nginx +
PHP5-FPM and PDO-SQLite3:
=
exec("CREATE TABLE IF NOT EXISTS table (id INTEGER PRIMARY
KEY AUTOINCREMENT, name VARCHAR(255))"); 
$dbh->exec("INSERT INTO table (name) VALUES ('dummy')");

$dbh = null;
  } catch(PDOException $e) { 
  echo $e->getMessage();
  }
?> 
=

The script successfully creates the database file... but it remains
empty, with no error message reported.

FWIW, Nginx spawns child processes (threads?) as www-data, PHP5-FPM
does the same, and the www directory is owned by www-data:

=
# ps aux | grep -i -e nginx -e php5 | grep -v grep

root   nginx: master process /usr/sbin/nginx
www-data   nginx: worker process

root   /usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   /usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
=
# ll /var/www/nginx-default/

drwxr-xr-x  6 www-data www-data 4096 2010-07-27 14:24 ./
drwxr-xr-x  3 root root 4096 2010-07-27 13:00 ../

-rw-r--r--  1 www-data www-data0 2010-07-27 14:21 dummy.sqlite

-rw-r--r--  1 www-data www-data  565 2010-07-27 14:24
sqlite3_pdo_test.php
=

Thank you for any hint.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [PHP5-FPM] Sqlite3 or pdo_sqlite?

2010-07-24 Thread Gilles Ganault
On Sat, 24 Jul 2010 18:50:05 +0200, Kees Nuyt
 wrote:
>There's also pdo_sqlite_external which uses the sqlite3.dll
>the user provides, so you can use the latest and greatest
>sqlite version without having to wait for incorporation in
>PHP or PDO itself.

Thanks guys for the input. I'll check when sqlite_busy_timeout() is
added to the SQLite3 in PHP5, and use PDO if it doesn't come out soon
enough.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [PHP5-FPM] Sqlite3 or pdo_sqlite?

2010-07-24 Thread Kees Nuyt
On Sat, 24 Jul 2010 09:18:57 -0400, "J. King"
 wrote:


> PDO_sqlite3 also does have the advantage of being available by default  
> since PHP 5.0.0, whereas sqlite3 is only available by default since PHP  
> 5.3.0.  I'm aware of no other advantages to using PDO, and from what I've  
> read it's on the slow side.

There's also pdo_sqlite_external which uses the sqlite3.dll
the user provides, so you can use the latest and greatest
sqlite version without having to wait for incorporation in
PHP or PDO itself.

Possible limitation: I was told pdo_sqlite_external is only
available for MS Windows.
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [PHP5-FPM] Sqlite3 or pdo_sqlite?

2010-07-24 Thread Alan Chandler
On 24/07/10 15:41, Alan Chandler wrote:
> On 24/07/10 14:18, J. King wrote:
>
>> PDO_sqlite3 also does have the advantage of being available by default
>> since PHP 5.0.0, whereas sqlite3 is only available by default since PHP
>> 5.3.0.  I'm aware of no other advantages to using PDO, and from what I've
>> read it's on the slow side.
>>
>
> Right now its the only php library that calls (or enables a call) to
> sqlite_busy_timeout.
>
> There is a patch which will make it into php 5.3.3 when it is released
> "very shortly" that does provide for that call.
>
> This makes the sqlite3 pretty bad for applications (such as the typical
> web site) where there might be some locking issues.
>
>
I meant that right now PDO:: is the only library that enables the call. 
  Sqlite3 will get it shortly

-- 
Alan Chandler
http://www.chandlerfamily.org.uk

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [PHP5-FPM] Sqlite3 or pdo_sqlite?

2010-07-24 Thread Alan Chandler
On 24/07/10 14:18, J. King wrote:

> PDO_sqlite3 also does have the advantage of being available by default
> since PHP 5.0.0, whereas sqlite3 is only available by default since PHP
> 5.3.0.  I'm aware of no other advantages to using PDO, and from what I've
> read it's on the slow side.
>

Right now its the only php library that calls (or enables a call) to 
sqlite_busy_timeout.

There is a patch which will make it into php 5.3.3 when it is released 
"very shortly" that does provide for that call.

This makes the sqlite3 pretty bad for applications (such as the typical 
web site) where there might be some locking issues.


-- 
Alan Chandler
http://www.chandlerfamily.org.uk

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [PHP5-FPM] Sqlite3 or pdo_sqlite?

2010-07-24 Thread J. King
On Sat, 24 Jul 2010 08:33:21 -0400, Simon Slavin   
wrote:

>
> On 24 Jul 2010, at 9:56am, Gilles Ganault wrote:
>
>> So from the above, it looks like this binary supports access to
>> MySQL(i) and SQLite2/3, in both procedural and (PDO) object-oriented
>> modes.
>>
>> If that's correct, and provided the application doesn't need to be
>> DB-agnostic... why should I choose PDO instead of the procedural
>> functions to SQLite3?
>
> The main advantage of the PDO is that the calls for each SQL engine are  
> identical.  In other words, you can write your code as if you're going  
> to use SQLite, then one day find you have to move to MySQL, and you'll  
> only have to change one line of code -- the one that says which engine  
> you want it to use.  If you're in a profession where you have to use  
> many SQL engines this can save you from having to learn the different  
> rules and foibles of each one.

This is mostly fantasy, as SQL engines have widely diverging language  
dialects; the API is a relatively small component of interoperability  
pain.  Still, it is a concern, and certainly a slight advantage to PDO.

PDO_sqlite3 also does have the advantage of being available by default  
since PHP 5.0.0, whereas sqlite3 is only available by default since PHP  
5.3.0.  I'm aware of no other advantages to using PDO, and from what I've  
read it's on the slow side.

-- 
J. King
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [PHP5-FPM] Sqlite3 or pdo_sqlite?

2010-07-24 Thread Simon Slavin

On 24 Jul 2010, at 9:56am, Gilles Ganault wrote:

> So from the above, it looks like this binary supports access to
> MySQL(i) and SQLite2/3, in both procedural and (PDO) object-oriented
> modes.
> 
> If that's correct, and provided the application doesn't need to be
> DB-agnostic... why should I choose PDO instead of the procedural
> functions to SQLite3?

The main advantage of the PDO is that the calls for each SQL engine are 
identical.  In other words, you can write your code as if you're going to use 
SQLite, then one day find you have to move to MySQL, and you'll only have to 
change one line of code -- the one that says which engine you want it to use.  
If you're in a profession where you have to use many SQL engines this can save 
you from having to learn the different rules and foibles of each one.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] [PHP5-FPM] Sqlite3 or pdo_sqlite?

2010-07-24 Thread Gilles Ganault
Hello

I'm using the pre-compiled PHP5-FPM/FastCGI (www.php-fpm.org) which
seem to contain the following DB connectors:

PDO drivers mysql, sqlite, sqlite2
pdo_mysql 5.1.48
pdo_sqlite 3.6.22

SQLite 2.8.17
sqlite3 3.6.22

So from the above, it looks like this binary supports access to
MySQL(i) and SQLite2/3, in both procedural and (PDO) object-oriented
modes.

If that's correct, and provided the application doesn't need to be
DB-agnostic... why should I choose PDO instead of the procedural
functions to SQLite3?

Thank you.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] PHP5 and SQLite3 and SQLite2

2007-05-10 Thread Al Rider
As I understand it, SQLite2 files are not compatible with SQLite3.  This 
poses a dilemma for me and I would guess many others on shared, virtual 
webhosts.


The docs say to simply have both versions installed and copy from vers 2 
to vers 3.  That's OK for dedicated servers; but, most of us who use 
shared hosting can't get the webhosts to install both versions. It's 
hard enough to get them to upgrade to php5 with SQLite3. 

For example, my host has php5.1.4 /SQLite2.8.  I'd like to design a new 
application; but, am trapped because the host plans to upgrade to 
php5.4.4 in about a month or two.  This means my data files will not be 
compatible when the upgrade is effected. 

I need some suggestions on how to handle this dilemma. 


Thanks



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] PHP5 with SQLite3

2006-11-08 Thread Lloyd Thomas


- Original Message - 
From: "Rúben Lício" <[EMAIL PROTECTED]>

To: <sqlite-users@sqlite.org>
Sent: Wednesday, November 08, 2006 1:03 PM
Subject: [sqlite] PHP5 with SQLite3


Are you connecting correctly to the database. Which version of sqlite3 was 
the database created in. I beleive php5.1 is version 3.2.8



Hi,

I'm trying to use PHP5 with SQLite 3, but it's not working.

I see then the native PHP only suporte SQLite 2.8, but i can compile last
version of php with SQLite 3 suport.

O compile last PHP version with this line:
make clean && ./configure --prefix=/usr/local/php5 --enable-pdo
--with-sqlite=shared --with-pdo-sqlite=shared --with-zlib
--enable-track-vars --with-apxs2=/usr/local/apache2/bin/apxs
--enable-sqlite-utf8 && make && make install

phpinfo tell-me that it is ok with SQLite 3 suport. But when I try to
execute query, i have that exception message:
'PDOException' with message 'SQLSTATE[HY000]: General error: 1 SQL logic
error or missing database' in ...

Anybody know how to correct that problem?

ty

Ruben

--
Linux user #433535
Linux because we are freedon.




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] PHP5 with SQLite3

2006-11-08 Thread Rúben Lício

Hi,

I'm trying to use PHP5 with SQLite 3, but it's not working.

I see then the native PHP only suporte SQLite 2.8, but i can compile last
version of php with SQLite 3 suport.

O compile last PHP version with this line:
make clean && ./configure --prefix=/usr/local/php5 --enable-pdo
--with-sqlite=shared --with-pdo-sqlite=shared --with-zlib
--enable-track-vars --with-apxs2=/usr/local/apache2/bin/apxs
--enable-sqlite-utf8 && make && make install

phpinfo tell-me that it is ok with SQLite 3 suport. But when I try to
execute query, i have that exception message:
'PDOException' with message 'SQLSTATE[HY000]: General error: 1 SQL logic
error or missing database' in ...

Anybody know how to correct that problem?

ty

Ruben

--
Linux user #433535
Linux because we are freedon.