summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-08-19 10:22:38 +0200
committerOndřej Surý <ondrej@sury.org>2011-08-19 10:22:38 +0200
commitf452a2b3e4e4279b27594a8ddb66525442d59227 (patch)
treed05cb62c5515ada33076d3cc3e49b664733a478c /ext/pdo_sqlite
parent038ba12e8724d537040e88ec794354b0c063f0a6 (diff)
downloadphp-upstream/5.3.7.tar.gz
Imported Upstream version 5.3.7upstream/5.3.7
Diffstat (limited to 'ext/pdo_sqlite')
-rw-r--r--ext/pdo_sqlite/config.m42
-rw-r--r--ext/pdo_sqlite/pdo_sqlite.c6
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c18
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt17
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_get_attribute.phpt15
5 files changed, 45 insertions, 13 deletions
diff --git a/ext/pdo_sqlite/config.m4 b/ext/pdo_sqlite/config.m4
index eceb94d8b..2ddf8d8a4 100644
--- a/ext/pdo_sqlite/config.m4
+++ b/ext/pdo_sqlite/config.m4
@@ -1,4 +1,4 @@
-dnl $Id: config.m4 291414 2009-11-29 06:13:22Z rasmus $
+dnl $Id: config.m4 311041 2011-05-15 05:49:34Z rasmus $
dnl config.m4 for extension pdo_sqlite
dnl vim:et:sw=2:ts=2:
diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c
index d8275b71c..9ac167a8b 100644
--- a/ext/pdo_sqlite/pdo_sqlite.c
+++ b/ext/pdo_sqlite/pdo_sqlite.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sqlite.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: pdo_sqlite.c 314376 2011-08-06 14:47:44Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -35,7 +35,7 @@
/* {{{ pdo_sqlite_functions[] */
const zend_function_entry pdo_sqlite_functions[] = {
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* }}} */
@@ -44,7 +44,7 @@ const zend_function_entry pdo_sqlite_functions[] = {
#if ZEND_MODULE_API_NO >= 20050922
static const zend_module_dep pdo_sqlite_deps[] = {
ZEND_MOD_REQUIRED("pdo")
- {NULL, NULL, NULL}
+ ZEND_MOD_END
};
#endif
/* }}} */
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 8a731fc93..2eb78fc63 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sqlite_driver.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: sqlite_driver.c 314451 2011-08-08 00:07:54Z iliaa $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -47,33 +47,33 @@ int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int li
}
einfo->errmsg = pestrdup((char*)sqlite3_errmsg(H->db), dbh->is_persistent);
} else { /* no error */
- strcpy(*pdo_err, PDO_ERR_NONE);
+ strncpy(*pdo_err, PDO_ERR_NONE, sizeof(PDO_ERR_NONE));
return 0;
}
switch (einfo->errcode) {
case SQLITE_NOTFOUND:
- strcpy(*pdo_err, "42S02");
+ strncpy(*pdo_err, "42S02", sizeof("42S02"));
break;
case SQLITE_INTERRUPT:
- strcpy(*pdo_err, "01002");
+ strncpy(*pdo_err, "01002", sizeof("01002"));
break;
case SQLITE_NOLFS:
- strcpy(*pdo_err, "HYC00");
+ strncpy(*pdo_err, "HYC00", sizeof("HYC00"));
break;
case SQLITE_TOOBIG:
- strcpy(*pdo_err, "22001");
+ strncpy(*pdo_err, "22001", sizeof("22001"));
break;
case SQLITE_CONSTRAINT:
- strcpy(*pdo_err, "23000");
+ strncpy(*pdo_err, "23000", sizeof("23000"));
break;
case SQLITE_ERROR:
default:
- strcpy(*pdo_err, "HY000");
+ strncpy(*pdo_err, "HY000", sizeof("HY000"));
break;
}
@@ -593,7 +593,7 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate)
static const zend_function_entry dbh_methods[] = {
PHP_ME(SQLite, sqliteCreateFunction, NULL, ZEND_ACC_PUBLIC)
PHP_ME(SQLite, sqliteCreateAggregate, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
static const zend_function_entry *get_driver_methods(pdo_dbh_t *dbh, int kind TSRMLS_DC)
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt
new file mode 100644
index 000000000..671e4b345
--- /dev/null
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt
@@ -0,0 +1,17 @@
+--TEST--
+PDO_sqlite: Testing invalid callback for sqliteCreateAggregate()
+--SKIPIF--
+<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
+--FILE--
+<?php
+
+$pdo = new PDO('sqlite::memory:');
+
+$pdo->sqliteCreateAggregate('foo', 'a', '');
+$pdo->sqliteCreateAggregate('foo', 'strlen', '');
+
+?>
+--EXPECTF--
+Warning: PDO::sqliteCreateAggregate(): function 'a' is not callable in %s on line %d
+
+Warning: PDO::sqliteCreateAggregate(): function '' is not callable in %s on line %d
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_get_attribute.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_get_attribute.phpt
new file mode 100644
index 000000000..d6e095d54
--- /dev/null
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_get_attribute.phpt
@@ -0,0 +1,15 @@
+--TEST--
+PDO_sqlite: Testing getAttribute()
+--SKIPIF--
+<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
+--FILE--
+<?php
+
+$pdo = new PDO('sqlite::memory:');
+var_dump($pdo->getAttribute(PDO::ATTR_SERVER_VERSION));
+var_dump($pdo->getAttribute(PDO::ATTR_CLIENT_VERSION));
+
+?>
+--EXPECTF--
+string(%d) "%s"
+string(%d) "%s"