cvs: pear /MDB2/tests MDB2_nonstandard_sqlite.php
| From: | Lorenzo Alberton | Date: | Mon, 05 Mar 2007 01:29:37 +0000 |
| Subject: | cvs: pear /MDB2/tests MDB2_nonstandard_sqlite.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44970@lists.php.net to get a copy of this message | ||
quipo Mon Mar 5 01:29:37 2007 UTC
Modified files:
/pear/MDB2/tests MDB2_nonstandard_sqlite.php
Log:
fixed queries and added createView()
http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_nonstandard_sqlite.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/MDB2/tests/MDB2_nonstandard_sqlite.php
diff -u pear/MDB2/tests/MDB2_nonstandard_sqlite.php:1.3
pear/MDB2/tests/MDB2_nonstandard_sqlite.php:1.4
--- pear/MDB2/tests/MDB2_nonstandard_sqlite.php:1.3 Sat Dec 9 21:58:49 2006
+++ pear/MDB2/tests/MDB2_nonstandard_sqlite.php Mon Mar 5 01:29:37 2007
@@ -2,7 +2,7 @@
// +----------------------------------------------------------------------+
// | PHP versions 4 and 5 |
// +----------------------------------------------------------------------+
-// | Copyright (c) 2006 Lorenzo Alberton |
+// | Copyright (c) 2006-2007 Lorenzo Alberton |
// | All rights reserved. |
// +----------------------------------------------------------------------+
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
@@ -41,7 +41,7 @@
// | Author: Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB2_nonstandard_sqlite.php,v 1.3 2006/12/09 21:58:49 quipo Exp $
+// $Id: MDB2_nonstandard_sqlite.php,v 1.4 2007/03/05 01:29:37 quipo Exp $
class MDB2_nonstandard_sqlite extends MDB2_nonstandard {
@@ -50,11 +50,11 @@
function createTrigger($trigger_name, $table_name) {
$this->trigger_body = 'UPDATE '. $table_name .' SET somedescription =
new.somename WHERE id = old.id;';
- $query = 'CREATE TRIGGER '. $trigger_name .' IF NOT EXISTS test_trigger
UPDATE ON '. $table_name .'
+ $query = 'CREATE TRIGGER '. $trigger_name .' UPDATE ON '. $table_name
.'
BEGIN
'. $this->trigger_body .'
END;';
- return $this->db->exec($query);
+ return $this->db->standaloneQuery($query);
}
function checkTrigger($trigger_name, $table_name, $def) {
@@ -63,7 +63,14 @@
}
function dropTrigger($trigger_name, $table_name) {
- return $this->db->exec('DROP TRIGGER '.$trigger_name);
+ return $this->db->standaloneQuery('DROP TRIGGER '.$trigger_name);
+ }
+
+ function createView($view_name, $table_name) {
+ $query = 'CREATE VIEW '. $this->db->quoteIdentifier($view_name, true)
+ .' AS SELECT id FROM '
+ . $this->db->quoteIdentifier($table_name, true) .' WHERE id >
1';
+ return $this->db->exec($query);
}
}