1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Amend PDO driver-specific class names (#14069)

As suggested in https://externals.io/message/123166
This commit is contained in:
Máté Kocsis
2024-05-30 20:15:42 +02:00
committed by GitHub
parent ec54edb9e1
commit 6ec4220148
50 changed files with 243 additions and 229 deletions

View File

@@ -204,7 +204,7 @@ PHP_MINIT_FUNCTION(pdo_dblib)
return FAILURE;
}
PdoDblib_ce = register_class_PdoDblib(pdo_dbh_ce);
PdoDblib_ce = register_class_Pdo_Dblib(pdo_dbh_ce);
PdoDblib_ce->create_object = pdo_dbh_new;
if (FAILURE == php_pdo_register_driver(&pdo_dblib_driver)) {

View File

@@ -2,11 +2,13 @@
/** @generate-class-entries */
namespace Pdo;
/**
* @strict-properties
* @not-serializable
*/
class PdoDblib extends PDO
class Dblib extends PDO
{
/** @cvalue PDO_DBLIB_ATTR_CONNECTION_TIMEOUT */
public const int ATTR_CONNECTION_TIMEOUT = UNKNOWN;

View File

@@ -1,16 +1,16 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: d2a7022c8e6e259b452786e00867b4a167d58277 */
* Stub hash: 7589c5d95f17513e35fa7884cd0ac4c6df253d09 */
static const zend_function_entry class_PdoDblib_methods[] = {
static const zend_function_entry class_Pdo_Dblib_methods[] = {
ZEND_FE_END
};
static zend_class_entry *register_class_PdoDblib(zend_class_entry *class_entry_PDO)
static zend_class_entry *register_class_Pdo_Dblib(zend_class_entry *class_entry_Pdo_PDO)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "PdoDblib", class_PdoDblib_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_PDO);
INIT_NS_CLASS_ENTRY(ce, "Pdo", "Dblib", class_Pdo_Dblib_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_Pdo_PDO);
class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_NOT_SERIALIZABLE;
zval const_ATTR_CONNECTION_TIMEOUT_value;

View File

@@ -1,5 +1,5 @@
--TEST--
PdoDblib basic
Pdo\Dblib basic
--EXTENSIONS--
pdo_dblib
--SKIPIF--
@@ -11,7 +11,7 @@ getDbConnection();
<?php
require __DIR__ . '/config.inc';
$db = getDbConnection(PdoDblib::class);
$db = getDbConnection(Pdo\Dblib::class);
$db->query("CREATE TABLE #pdo_dblib_001(name VARCHAR(32)); ");
$db->query("INSERT INTO #pdo_dblib_001 VALUES('PHP'), ('PHP6');");

View File

@@ -1,5 +1,5 @@
--TEST--
PdoDblib create through PDO::connect
Pdo\Dblib create through PDO::connect
--EXTENSIONS--
pdo_dblib
--SKIPIF--
@@ -13,8 +13,8 @@ getDbConnection();
require __DIR__ . '/config.inc';
$db = connectToDb();
if (!$db instanceof PdoDblib) {
echo "Wrong class type. Should be PdoDblib but is " . get_class($db) . "\n";
if (!$db instanceof Pdo\Dblib) {
echo "Wrong class type. Should be Pdo\Dblib but is " . get_class($db) . "\n";
}
$db->query("CREATE TABLE #pdo_dblib_002(name VARCHAR(32))");

View File

@@ -70,7 +70,7 @@ PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */
return FAILURE;
}
PdoFirebird_ce = register_class_PdoFirebird(pdo_dbh_ce);
PdoFirebird_ce = register_class_Pdo_Firebird(pdo_dbh_ce);
PdoFirebird_ce->create_object = pdo_dbh_new;
#ifdef ZEND_SIGNALS

View File

@@ -2,11 +2,13 @@
/** @generate-class-entries */
namespace Pdo;
/**
* @strict-properties
* @not-serializable
*/
class PdoFirebird extends PDO
class Firebird extends PDO
{
/** @cvalue PDO_FB_ATTR_DATE_FORMAT */
public const int ATTR_DATE_FORMAT = UNKNOWN;

View File

@@ -1,16 +1,16 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 037c073de9e3e3593c62cb7da8ee7202c38c2723 */
* Stub hash: 584b20b65c1ebccf82f894cb9e16ea76a2b1aa1e */
static const zend_function_entry class_PdoFirebird_methods[] = {
static const zend_function_entry class_Pdo_Firebird_methods[] = {
ZEND_FE_END
};
static zend_class_entry *register_class_PdoFirebird(zend_class_entry *class_entry_PDO)
static zend_class_entry *register_class_Pdo_Firebird(zend_class_entry *class_entry_Pdo_PDO)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "PdoFirebird", class_PdoFirebird_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_PDO);
INIT_NS_CLASS_ENTRY(ce, "Pdo", "Firebird", class_Pdo_Firebird_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_Pdo_PDO);
class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_NOT_SERIALIZABLE;
zval const_ATTR_DATE_FORMAT_value;

View File

@@ -13,8 +13,8 @@ See https://github.com/FirebirdSQL/firebird/issues/7849
require_once __DIR__ . "/testdb.inc";
$db = connectToDb();
if (!$db instanceof PdoFirebird) {
echo "Wrong class type. Should be PdoFirebird but is " . get_class($db) . "\n";
if (!$db instanceof Pdo\Firebird) {
echo "Wrong class type. Should be Pdo\Firebird but is " . get_class($db) . "\n";
}
$db->query('CREATE TABLE pdofirebird_002 (idx INT NOT NULL PRIMARY KEY, name VARCHAR(20))');

View File

@@ -21,8 +21,8 @@ function getDbConnection($class = PDO::class): PDO {
return new $class(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS);
}
function connectToDb(): PdoFirebird {
return PdoFirebird::connect(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS);
function connectToDb(): Pdo\Firebird {
return Pdo\Firebird::connect(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS);
}
?>

View File

@@ -84,10 +84,8 @@ static const MYSQLND_REVERSE_API pdo_mysql_reverse_api = {
};
#endif
/* proto string PDO::mysqlGetWarningCount()
* Returns the number of SQL warnings during the execution of the last statement
*/
PHP_METHOD(PdoMysql, getWarningCount)
/* Returns the number of SQL warnings during the execution of the last statement */
PHP_METHOD(Pdo_Mysql, getWarningCount)
{
pdo_dbh_t *dbh;
pdo_mysql_db_handle *H;
@@ -151,7 +149,7 @@ static PHP_MINIT_FUNCTION(pdo_mysql)
mysqlnd_reverse_api_register_api(&pdo_mysql_reverse_api);
#endif
pdo_mysql_ce = register_class_PdoMysql(pdo_dbh_ce);
pdo_mysql_ce = register_class_Pdo_Mysql(pdo_dbh_ce);
pdo_mysql_ce->create_object = pdo_dbh_new;
if (php_pdo_register_driver(&pdo_mysql_driver) == FAILURE) {

View File

@@ -2,11 +2,13 @@
/** @generate-class-entries */
namespace Pdo;
/**
* @strict-properties
* @not-serializable
*/
class PdoMysql extends PDO
class Mysql extends PDO
{
/** @cvalue PDO_MYSQL_ATTR_USE_BUFFERED_QUERY */
public const int ATTR_USE_BUFFERED_QUERY = UNKNOWN;

View File

@@ -1,22 +1,22 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 015ebac642032d22ee5a8793993f84092bb6bf86 */
* Stub hash: 065388b9ae5ffe9feb14fc4738ea5df66e0cf755 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoMysql_getWarningCount, 0, 0, IS_LONG, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Mysql_getWarningCount, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_METHOD(PdoMysql, getWarningCount);
ZEND_METHOD(Pdo_Mysql, getWarningCount);
static const zend_function_entry class_PdoMysql_methods[] = {
ZEND_ME(PdoMysql, getWarningCount, arginfo_class_PdoMysql_getWarningCount, ZEND_ACC_PUBLIC)
static const zend_function_entry class_Pdo_Mysql_methods[] = {
ZEND_ME(Pdo_Mysql, getWarningCount, arginfo_class_Pdo_Mysql_getWarningCount, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
static zend_class_entry *register_class_PdoMysql(zend_class_entry *class_entry_PDO)
static zend_class_entry *register_class_Pdo_Mysql(zend_class_entry *class_entry_Pdo_PDO)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "PdoMysql", class_PdoMysql_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_PDO);
INIT_NS_CLASS_ENTRY(ce, "Pdo", "Mysql", class_Pdo_Mysql_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_Pdo_PDO);
class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_NOT_SERIALIZABLE;
zval const_ATTR_USE_BUFFERED_QUERY_value;

View File

@@ -12,7 +12,7 @@ MySQLPDOTest::skip();
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory(PdoMysql::class);
$db = MySQLPDOTest::factory(Pdo\Mysql::class);
$db->query('CREATE TABLE pdomysql_001 (id INT, name TEXT)');

View File

@@ -13,8 +13,8 @@ MySQLPDOTest::skip();
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
$db = Pdo::connect(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS);
if (!$db instanceof PdoMysql) {
echo "Wrong class type. Should be PdoMysql but is " . get_class($db) . "\n";
if (!$db instanceof Pdo\Mysql) {
echo "Wrong class type. Should be Pdo\Mysql but is " . get_class($db) . "\n";
}
$db->exec('CREATE TABLE pdomysql_002(id INT NOT NULL PRIMARY KEY, name VARCHAR(10))');

View File

@@ -13,8 +13,8 @@ MySQLPDOTest::skip();
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
$db = Pdo::connect(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS);
if (!$db instanceof PdoMysql) {
echo "Wrong class type. Should be PdoMysql but is " . get_class($db) . "\n";
if (!$db instanceof Pdo\Mysql) {
echo "Wrong class type. Should be Pdo\Mysql but is " . get_class($db) . "\n";
}
$assertWarnings = function ($db, $q, $count) {

View File

@@ -107,7 +107,7 @@ PHP_MINIT_FUNCTION(pdo_odbc)
REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER);
REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC);
pdo_odbc_ce = register_class_PdoOdbc(pdo_dbh_ce);
pdo_odbc_ce = register_class_Pdo_Odbc(pdo_dbh_ce);
pdo_odbc_ce->create_object = pdo_dbh_new;
return php_pdo_register_driver_specific_ce(&pdo_odbc_driver, pdo_odbc_ce);

View File

@@ -2,30 +2,34 @@
/** @generate-class-entries */
/**
* @var string
* @cvalue PDO_ODBC_TYPE
*/
const PDO_ODBC_TYPE = UNKNOWN;
/**
* @strict-properties
* @not-serializable
*/
class PdoOdbc extends PDO
{
/** @cvalue PDO_ODBC_ATTR_USE_CURSOR_LIBRARY */
public const int ATTR_USE_CURSOR_LIBRARY = UNKNOWN;
/** @cvalue PDO_ODBC_ATTR_ASSUME_UTF8 */
public const int ATTR_ASSUME_UTF8 = UNKNOWN;
/** @cvalue SQL_CUR_USE_IF_NEEDED */
public const int SQL_USE_IF_NEEDED = UNKNOWN;
/** @cvalue SQL_CUR_USE_DRIVER */
public const int SQL_USE_DRIVER = UNKNOWN;
/** @cvalue SQL_CUR_USE_ODBC */
public const int SQL_USE_ODBC = UNKNOWN;
namespace {
/**
* @var string
* @cvalue PDO_ODBC_TYPE
*/
const PDO_ODBC_TYPE = UNKNOWN;
}
namespace Pdo {
/**
* @strict-properties
* @not-serializable
*/
class Odbc extends PDO
{
/** @cvalue PDO_ODBC_ATTR_USE_CURSOR_LIBRARY */
public const int ATTR_USE_CURSOR_LIBRARY = UNKNOWN;
/** @cvalue PDO_ODBC_ATTR_ASSUME_UTF8 */
public const int ATTR_ASSUME_UTF8 = UNKNOWN;
/** @cvalue SQL_CUR_USE_IF_NEEDED */
public const int SQL_USE_IF_NEEDED = UNKNOWN;
/** @cvalue SQL_CUR_USE_DRIVER */
public const int SQL_USE_DRIVER = UNKNOWN;
/** @cvalue SQL_CUR_USE_ODBC */
public const int SQL_USE_ODBC = UNKNOWN;
}
}

View File

@@ -1,7 +1,7 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 3cc19acf5943c09a011f15d9ef6d0f443d4b8a71 */
* Stub hash: 03226d99e04ac7db352bc8a9561826fa534c1fc7 */
static const zend_function_entry class_PdoOdbc_methods[] = {
static const zend_function_entry class_Pdo_Odbc_methods[] = {
ZEND_FE_END
};
@@ -10,12 +10,12 @@ static void register_pdo_odbc_symbols(int module_number)
REGISTER_STRING_CONSTANT("PDO_ODBC_TYPE", PDO_ODBC_TYPE, CONST_PERSISTENT);
}
static zend_class_entry *register_class_PdoOdbc(zend_class_entry *class_entry_PDO)
static zend_class_entry *register_class_Pdo_Odbc(zend_class_entry *class_entry_Pdo_PDO)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "PdoOdbc", class_PdoOdbc_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_PDO);
INIT_NS_CLASS_ENTRY(ce, "Pdo", "Odbc", class_Pdo_Odbc_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_Pdo_PDO);
class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_NOT_SERIALIZABLE;
zval const_ATTR_USE_CURSOR_LIBRARY_value;

View File

@@ -12,7 +12,7 @@ PDOTest::skip();
require 'ext/pdo/tests/pdo_test.inc';
$config = PDOTest::get_config(__DIR__ . "/common.phpt");
$db = new PdoOdbc($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'], $config['ENV']['PDOTEST_PASS']);
$db = new Pdo\Odbc($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'], $config['ENV']['PDOTEST_PASS']);
$db->query("CREATE TABLE pdoodbc_001 (id INT, name TEXT)");
$db->query("INSERT INTO pdoodbc_001 VALUES (NULL, 'PHP'), (NULL, 'PHP6')");

View File

@@ -12,9 +12,9 @@ PDOTest::skip();
require 'ext/pdo/tests/pdo_test.inc';
$config = PDOTest::get_config(__DIR__ . "/common.phpt");
$db = PdoOdbc::connect($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'], $config['ENV']['PDOTEST_PASS']);
if (!$db instanceof PdoOdbc) {
echo "Wrong class type. Should be PdoOdbc but is " . get_class($db) . "\n";
$db = Pdo\Odbc::connect($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'], $config['ENV']['PDOTEST_PASS']);
if (!$db instanceof Pdo\Odbc) {
echo "Wrong class type. Should be Pdo\Odbc but is " . get_class($db) . "\n";
}
$db->exec('CREATE TABLE pdoodbc_002(id INT NOT NULL PRIMARY KEY, name VARCHAR(10))');

View File

@@ -58,7 +58,7 @@ ZEND_GET_MODULE(pdo_pgsql)
#endif
/* Escape an identifier for insertion into a text field */
PHP_METHOD(PdoPgsql, escapeIdentifier)
PHP_METHOD(Pdo_Pgsql, escapeIdentifier)
{
zend_string *from = NULL;
char *tmp;
@@ -92,55 +92,55 @@ PHP_METHOD(PdoPgsql, escapeIdentifier)
}
/* Returns true if the copy worked fine or false if error */
PHP_METHOD(PdoPgsql, copyFromArray)
PHP_METHOD(Pdo_Pgsql, copyFromArray)
{
pgsqlCopyFromArray_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* Returns true if the copy worked fine or false if error */
PHP_METHOD(PdoPgsql, copyFromFile)
PHP_METHOD(Pdo_Pgsql, copyFromFile)
{
pgsqlCopyFromFile_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* Returns true if the copy worked fine or false if error */
PHP_METHOD(PdoPgsql, copyToFile)
PHP_METHOD(Pdo_Pgsql, copyToFile)
{
pgsqlCopyToFile_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* Returns true if the copy worked fine or false if error */
PHP_METHOD(PdoPgsql, copyToArray)
PHP_METHOD(Pdo_Pgsql, copyToArray)
{
pgsqlCopyToArray_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* Creates a new large object, returning its identifier. Must be called inside a transaction. */
PHP_METHOD(PdoPgsql, lobCreate)
PHP_METHOD(Pdo_Pgsql, lobCreate)
{
pgsqlLOBCreate_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* Opens an existing large object stream. Must be called inside a transaction. */
PHP_METHOD(PdoPgsql, lobOpen)
PHP_METHOD(Pdo_Pgsql, lobOpen)
{
pgsqlLOBOpen_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* Deletes the large object identified by oid. Must be called inside a transaction. */
PHP_METHOD(PdoPgsql, lobUnlink)
PHP_METHOD(Pdo_Pgsql, lobUnlink)
{
pgsqlLOBUnlink_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* Get asynchronous notification */
PHP_METHOD(PdoPgsql, getNotify)
PHP_METHOD(Pdo_Pgsql, getNotify)
{
pgsqlGetNotify_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* Get backend(server) pid */
PHP_METHOD(PdoPgsql, getPid)
PHP_METHOD(Pdo_Pgsql, getPid)
{
pgsqlGetPid_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
@@ -160,7 +160,7 @@ PHP_MINIT_FUNCTION(pdo_pgsql)
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_RESULT_MEMORY_SIZE", (zend_long)PDO_PGSQL_ATTR_RESULT_MEMORY_SIZE);
#endif
PdoPgsql_ce = register_class_PdoPgsql(pdo_dbh_ce);
PdoPgsql_ce = register_class_Pdo_Pgsql(pdo_dbh_ce);
PdoPgsql_ce->create_object = pdo_dbh_new;
if (php_pdo_register_driver(&pdo_pgsql_driver) == FAILURE) {

View File

@@ -2,11 +2,13 @@
/** @generate-class-entries */
namespace Pdo;
/**
* @strict-properties
* @not-serializable
*/
class PdoPgsql extends PDO
class Pgsql extends PDO
{
/** @cvalue PDO_PGSQL_ATTR_DISABLE_PREPARES */
public const int ATTR_DISABLE_PREPARES = UNKNOWN;
@@ -43,13 +45,15 @@ class PdoPgsql extends PDO
public function lobCreate(): string|false {}
// Opens an existing large object stream. Must be called inside a transaction.
/** @return resource|false */
public function lobOpen(string $oid, string $mode = "rb"){}
/**
* Opens an existing large object stream. Must be called inside a transaction.
* @return resource|false
*/
public function lobOpen(string $oid, string $mode = "rb") {}
public function lobUnlink(string $oid): bool {}
public function getNotify(int $fetchMode = PDO::FETCH_DEFAULT, int $timeoutMilliseconds = 0): array|false {}
public function getNotify(int $fetchMode = \PDO::FETCH_DEFAULT, int $timeoutMilliseconds = 0): array|false {}
public function getPid(): int {}
}

View File

@@ -1,11 +1,11 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 57eb44ac4546230b33165b7226b05d006b651e46 */
* Stub hash: 519530b2da60dbd7a70af6d7c566d93930cfbb24 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoPgsql_escapeIdentifier, 0, 1, IS_STRING, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Pgsql_escapeIdentifier, 0, 1, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoPgsql_copyFromArray, 0, 2, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Pgsql_copyFromArray, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, rows, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, separator, IS_STRING, 0, "\"\\t\"")
@@ -13,7 +13,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoPgsql_copyFromArray, 0,
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fields, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoPgsql_copyFromFile, 0, 2, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Pgsql_copyFromFile, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, separator, IS_STRING, 0, "\"\\t\"")
@@ -21,66 +21,66 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoPgsql_copyFromFile, 0,
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fields, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_PdoPgsql_copyToArray, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Pdo_Pgsql_copyToArray, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, separator, IS_STRING, 0, "\"\\t\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, nullAs, IS_STRING, 0, "\"\\\\\\\\N\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fields, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_class_PdoPgsql_copyToFile arginfo_class_PdoPgsql_copyFromFile
#define arginfo_class_Pdo_Pgsql_copyToFile arginfo_class_Pdo_Pgsql_copyFromFile
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_PdoPgsql_lobCreate, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Pdo_Pgsql_lobCreate, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PdoPgsql_lobOpen, 0, 0, 1)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Pdo_Pgsql_lobOpen, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, oid, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_STRING, 0, "\"rb\"")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoPgsql_lobUnlink, 0, 1, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Pgsql_lobUnlink, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, oid, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_PdoPgsql_getNotify, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Pdo_Pgsql_getNotify, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fetchMode, IS_LONG, 0, "PDO::FETCH_DEFAULT")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeoutMilliseconds, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoPgsql_getPid, 0, 0, IS_LONG, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Pgsql_getPid, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_METHOD(PdoPgsql, escapeIdentifier);
ZEND_METHOD(PdoPgsql, copyFromArray);
ZEND_METHOD(PdoPgsql, copyFromFile);
ZEND_METHOD(PdoPgsql, copyToArray);
ZEND_METHOD(PdoPgsql, copyToFile);
ZEND_METHOD(PdoPgsql, lobCreate);
ZEND_METHOD(PdoPgsql, lobOpen);
ZEND_METHOD(PdoPgsql, lobUnlink);
ZEND_METHOD(PdoPgsql, getNotify);
ZEND_METHOD(PdoPgsql, getPid);
ZEND_METHOD(Pdo_Pgsql, escapeIdentifier);
ZEND_METHOD(Pdo_Pgsql, copyFromArray);
ZEND_METHOD(Pdo_Pgsql, copyFromFile);
ZEND_METHOD(Pdo_Pgsql, copyToArray);
ZEND_METHOD(Pdo_Pgsql, copyToFile);
ZEND_METHOD(Pdo_Pgsql, lobCreate);
ZEND_METHOD(Pdo_Pgsql, lobOpen);
ZEND_METHOD(Pdo_Pgsql, lobUnlink);
ZEND_METHOD(Pdo_Pgsql, getNotify);
ZEND_METHOD(Pdo_Pgsql, getPid);
static const zend_function_entry class_PdoPgsql_methods[] = {
ZEND_ME(PdoPgsql, escapeIdentifier, arginfo_class_PdoPgsql_escapeIdentifier, ZEND_ACC_PUBLIC)
ZEND_ME(PdoPgsql, copyFromArray, arginfo_class_PdoPgsql_copyFromArray, ZEND_ACC_PUBLIC)
ZEND_ME(PdoPgsql, copyFromFile, arginfo_class_PdoPgsql_copyFromFile, ZEND_ACC_PUBLIC)
ZEND_ME(PdoPgsql, copyToArray, arginfo_class_PdoPgsql_copyToArray, ZEND_ACC_PUBLIC)
ZEND_ME(PdoPgsql, copyToFile, arginfo_class_PdoPgsql_copyToFile, ZEND_ACC_PUBLIC)
ZEND_ME(PdoPgsql, lobCreate, arginfo_class_PdoPgsql_lobCreate, ZEND_ACC_PUBLIC)
ZEND_ME(PdoPgsql, lobOpen, arginfo_class_PdoPgsql_lobOpen, ZEND_ACC_PUBLIC)
ZEND_ME(PdoPgsql, lobUnlink, arginfo_class_PdoPgsql_lobUnlink, ZEND_ACC_PUBLIC)
ZEND_ME(PdoPgsql, getNotify, arginfo_class_PdoPgsql_getNotify, ZEND_ACC_PUBLIC)
ZEND_ME(PdoPgsql, getPid, arginfo_class_PdoPgsql_getPid, ZEND_ACC_PUBLIC)
static const zend_function_entry class_Pdo_Pgsql_methods[] = {
ZEND_ME(Pdo_Pgsql, escapeIdentifier, arginfo_class_Pdo_Pgsql_escapeIdentifier, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Pgsql, copyFromArray, arginfo_class_Pdo_Pgsql_copyFromArray, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Pgsql, copyFromFile, arginfo_class_Pdo_Pgsql_copyFromFile, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Pgsql, copyToArray, arginfo_class_Pdo_Pgsql_copyToArray, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Pgsql, copyToFile, arginfo_class_Pdo_Pgsql_copyToFile, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Pgsql, lobCreate, arginfo_class_Pdo_Pgsql_lobCreate, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Pgsql, lobOpen, arginfo_class_Pdo_Pgsql_lobOpen, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Pgsql, lobUnlink, arginfo_class_Pdo_Pgsql_lobUnlink, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Pgsql, getNotify, arginfo_class_Pdo_Pgsql_getNotify, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Pgsql, getPid, arginfo_class_Pdo_Pgsql_getPid, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
static zend_class_entry *register_class_PdoPgsql(zend_class_entry *class_entry_PDO)
static zend_class_entry *register_class_Pdo_Pgsql(zend_class_entry *class_entry_Pdo_PDO)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "PdoPgsql", class_PdoPgsql_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_PDO);
INIT_NS_CLASS_ENTRY(ce, "Pdo", "Pgsql", class_Pdo_Pgsql_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_Pdo_PDO);
class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_NOT_SERIALIZABLE;
zval const_ATTR_DISABLE_PREPARES_value;

View File

@@ -1,5 +1,5 @@
--TEST--
PdoPgsql subclass basic
Pdo\Pgsql subclass basic
--EXTENSIONS--
pdo
pdo_pgsql
@@ -14,7 +14,7 @@ PDOTest::skip();
require_once __DIR__ . "/config.inc";
$db = new PdoPgsql($config['ENV']['PDOTEST_DSN']);
$db = new Pdo\Pgsql($config['ENV']['PDOTEST_DSN']);
$db->query('CREATE TABLE pdopgsql_001 (id INT, name TEXT)');
$db->query("INSERT INTO pdopgsql_001 VALUES (NULL, 'PHP'), (NULL, 'PHP6')");

View File

@@ -1,5 +1,5 @@
--TEST--
PdoPgsql connect through PDO::connect
Pdo\Pgsql connect through PDO::connect
--EXTENSIONS--
pdo
pdo_pgsql
@@ -15,8 +15,8 @@ PDOTest::skip();
require_once __DIR__ . "/config.inc";
$db = Pdo::connect($config['ENV']['PDOTEST_DSN']);
if (!$db instanceof PdoPgsql) {
echo "Wrong class type. Should be PdoPgsql but is " . get_class($db) . "\n";
if (!$db instanceof Pdo\Pgsql) {
echo "Wrong class type. Should be Pdo\Pgsql but is " . get_class($db) . "\n";
}
$db->exec('CREATE TABLE pdopgsql_002(id INT NOT NULL PRIMARY KEY, name VARCHAR(10))');

View File

@@ -1,5 +1,5 @@
--TEST--
PdoPgsql getWarningCount
Pdo\Pgsql getWarningCount
--EXTENSIONS--
pdo
pdo_pgsql
@@ -15,8 +15,8 @@ PDOTest::skip();
require_once __DIR__ . "/config.inc";
$db = Pdo::connect($config['ENV']['PDOTEST_DSN']);
if (!$db instanceof PdoPgsql) {
echo "Wrong class type. Should be PdoPgsql but is " . get_class($db) . "\n";
if (!$db instanceof Pdo\Pgsql) {
echo "Wrong class type. Should be Pdo\Pgsql but is " . get_class($db) . "\n";
}
echo $db->escapeIdentifier("This is a quote\"") . "\n";

View File

@@ -61,14 +61,14 @@ ZEND_GET_MODULE(pdo_sqlite)
/* proto bool PdoSqlite::createFunction(string $function_name, callable $callback, int $num_args = -1, int $flags = 0)
Creates a function that can be used in a query
*/
PHP_METHOD(PdoSqlite, createFunction)
PHP_METHOD(Pdo_Sqlite, createFunction)
{
pdo_sqlite_create_function_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
#ifndef PDO_SQLITE_OMIT_LOAD_EXTENSION
/* Attempts to load an SQLite extension library. */
PHP_METHOD(PdoSqlite, loadExtension)
PHP_METHOD(Pdo_Sqlite, loadExtension)
{
char *extension, *errtext = NULL;
char fullpath[MAXPATHLEN];
@@ -284,7 +284,7 @@ static const php_stream_ops php_stream_pdosqlite3_ops = {
};
/* Open a blob as a stream which we can read / write to. */
PHP_METHOD(PdoSqlite, openBlob)
PHP_METHOD(Pdo_Sqlite, openBlob)
{
char *table, *column, *dbname = "main", *mode = "rb";
size_t table_len, column_len, dbname_len;
@@ -368,12 +368,12 @@ static int php_sqlite_collation_callback(void *context, int string1_len, const v
return ret;
}
PHP_METHOD(PdoSqlite, createAggregate)
PHP_METHOD(Pdo_Sqlite, createAggregate)
{
pdo_sqlite_create_aggregate_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
PHP_METHOD(PdoSqlite, createCollation)
PHP_METHOD(Pdo_Sqlite, createCollation)
{
pdo_sqlite_create_collation_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, php_sqlite_collation_callback);
}
@@ -392,7 +392,7 @@ PHP_MINIT_FUNCTION(pdo_sqlite)
REGISTER_PDO_CLASS_CONST_LONG("SQLITE_ATTR_READONLY_STATEMENT", (zend_long)PDO_SQLITE_ATTR_READONLY_STATEMENT);
REGISTER_PDO_CLASS_CONST_LONG("SQLITE_ATTR_EXTENDED_RESULT_CODES", (zend_long)PDO_SQLITE_ATTR_EXTENDED_RESULT_CODES);
pdosqlite_ce = register_class_PdoSqlite(pdo_dbh_ce);
pdosqlite_ce = register_class_Pdo_Sqlite(pdo_dbh_ce);
pdosqlite_ce->create_object = pdo_dbh_new;
if (php_pdo_register_driver(&pdo_sqlite_driver) == FAILURE) {

View File

@@ -2,11 +2,13 @@
/** @generate-class-entries */
namespace Pdo;
/**
* @strict-properties
* @not-serializable
*/
class PdoSqlite extends PDO
class Sqlite extends PDO
{
#ifdef SQLITE_DETERMINISTIC
/** @cvalue SQLITE_DETERMINISTIC */
@@ -62,6 +64,6 @@ class PdoSqlite extends PDO
string $column,
int $rowid,
?string $dbname = "main",
int $flags = PdoSqlite::OPEN_READONLY
int $flags = \Pdo\Sqlite::OPEN_READONLY
) {}
}

View File

@@ -1,19 +1,19 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 167d0e30af99bd31c46ea1649c661b6aa38eaccb */
* Stub hash: 89e215924e6e1041d1ddfca6717e4ad2219d0199 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoSqlite_createAggregate, 0, 3, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Sqlite_createAggregate, 0, 3, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, step, IS_CALLABLE, 0)
ZEND_ARG_TYPE_INFO(0, finalize, IS_CALLABLE, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, numArgs, IS_LONG, 0, "-1")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoSqlite_createCollation, 0, 2, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Sqlite_createCollation, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoSqlite_createFunction, 0, 2, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Sqlite_createFunction, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, num_args, IS_LONG, 0, "-1")
@@ -21,44 +21,44 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoSqlite_createFunction,
ZEND_END_ARG_INFO()
#if !defined(PDO_SQLITE_OMIT_LOAD_EXTENSION)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_PdoSqlite_loadExtension, 0, 1, IS_VOID, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Sqlite_loadExtension, 0, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PdoSqlite_openBlob, 0, 0, 3)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Pdo_Sqlite_openBlob, 0, 0, 3)
ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, column, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, rowid, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, dbname, IS_STRING, 1, "\"main\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "PdoSqlite::OPEN_READONLY")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "Pdo\\Sqlite::OPEN_READONLY")
ZEND_END_ARG_INFO()
ZEND_METHOD(PdoSqlite, createAggregate);
ZEND_METHOD(PdoSqlite, createCollation);
ZEND_METHOD(PdoSqlite, createFunction);
ZEND_METHOD(Pdo_Sqlite, createAggregate);
ZEND_METHOD(Pdo_Sqlite, createCollation);
ZEND_METHOD(Pdo_Sqlite, createFunction);
#if !defined(PDO_SQLITE_OMIT_LOAD_EXTENSION)
ZEND_METHOD(PdoSqlite, loadExtension);
ZEND_METHOD(Pdo_Sqlite, loadExtension);
#endif
ZEND_METHOD(PdoSqlite, openBlob);
ZEND_METHOD(Pdo_Sqlite, openBlob);
static const zend_function_entry class_PdoSqlite_methods[] = {
ZEND_ME(PdoSqlite, createAggregate, arginfo_class_PdoSqlite_createAggregate, ZEND_ACC_PUBLIC)
ZEND_ME(PdoSqlite, createCollation, arginfo_class_PdoSqlite_createCollation, ZEND_ACC_PUBLIC)
ZEND_ME(PdoSqlite, createFunction, arginfo_class_PdoSqlite_createFunction, ZEND_ACC_PUBLIC)
static const zend_function_entry class_Pdo_Sqlite_methods[] = {
ZEND_ME(Pdo_Sqlite, createAggregate, arginfo_class_Pdo_Sqlite_createAggregate, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Sqlite, createCollation, arginfo_class_Pdo_Sqlite_createCollation, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Sqlite, createFunction, arginfo_class_Pdo_Sqlite_createFunction, ZEND_ACC_PUBLIC)
#if !defined(PDO_SQLITE_OMIT_LOAD_EXTENSION)
ZEND_ME(PdoSqlite, loadExtension, arginfo_class_PdoSqlite_loadExtension, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Sqlite, loadExtension, arginfo_class_Pdo_Sqlite_loadExtension, ZEND_ACC_PUBLIC)
#endif
ZEND_ME(PdoSqlite, openBlob, arginfo_class_PdoSqlite_openBlob, ZEND_ACC_PUBLIC)
ZEND_ME(Pdo_Sqlite, openBlob, arginfo_class_Pdo_Sqlite_openBlob, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
static zend_class_entry *register_class_PdoSqlite(zend_class_entry *class_entry_PDO)
static zend_class_entry *register_class_Pdo_Sqlite(zend_class_entry *class_entry_Pdo_PDO)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "PdoSqlite", class_PdoSqlite_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_PDO);
INIT_NS_CLASS_ENTRY(ce, "Pdo", "Sqlite", class_Pdo_Sqlite_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_Pdo_PDO);
class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_NOT_SERIALIZABLE;
#if defined(SQLITE_DETERMINISTIC)

View File

@@ -14,8 +14,8 @@ class Obj {
$obj = new Obj;
$obj->a = Pdo::connect('sqlite::memory:');
if (!$obj->a instanceof PdoSqlite) {
echo "Wrong class type. Should be PdoSqlite but is " . get_class($obj->a) . "]\n";
if (!$obj->a instanceof Pdo\Sqlite) {
echo "Wrong class type. Should be Pdo\Sqlite but is " . get_class($obj->a) . "]\n";
}
$obj->a->createFunction('func1', function() use ($obj) {}, 1);

View File

@@ -6,13 +6,13 @@ pdo_sqlite
<?php
echo "Hello\n";
var_dump(PdoSqlite::DETERMINISTIC);
var_dump(PdoSqlite::ATTR_OPEN_FLAGS);
var_dump(PdoSqlite::OPEN_READONLY);
var_dump(PdoSqlite::OPEN_READWRITE);
var_dump(PdoSqlite::OPEN_CREATE);
var_dump(PdoSqlite::ATTR_READONLY_STATEMENT);
var_dump(PdoSqlite::ATTR_EXTENDED_RESULT_CODES);
var_dump(Pdo\Sqlite::DETERMINISTIC);
var_dump(Pdo\Sqlite::ATTR_OPEN_FLAGS);
var_dump(Pdo\Sqlite::OPEN_READONLY);
var_dump(Pdo\Sqlite::OPEN_READWRITE);
var_dump(Pdo\Sqlite::OPEN_CREATE);
var_dump(Pdo\Sqlite::ATTR_READONLY_STATEMENT);
var_dump(Pdo\Sqlite::ATTR_EXTENDED_RESULT_CODES);
?>
--EXPECTF--

View File

@@ -1,5 +1,5 @@
--TEST--
Test PdoSqlite::createFunction() arguments error
Test Pdo\Sqlite::createFunction() arguments error
--EXTENSIONS--
pdo_sqlite
--FILE--
@@ -7,7 +7,7 @@ pdo_sqlite
declare(strict_types=1);
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
class TrampolineTest {
public function __call(string $name, array $arguments) {
@@ -42,8 +42,8 @@ try {
echo 'done!';
?>
--EXPECT--
PdoSqlite::createFunction(): Argument #1 ($function_name) must be of type string, null given
PdoSqlite::createFunction(): Argument #2 ($callback) must be a valid callback, no array or string given
PdoSqlite::createFunction(): Argument #3 ($num_args) must be of type int, null given
PdoSqlite::createFunction(): Argument #4 ($flags) must be of type int, null given
Pdo\Sqlite::createFunction(): Argument #1 ($function_name) must be of type string, null given
Pdo\Sqlite::createFunction(): Argument #2 ($callback) must be a valid callback, no array or string given
Pdo\Sqlite::createFunction(): Argument #3 ($num_args) must be of type int, null given
Pdo\Sqlite::createFunction(): Argument #4 ($flags) must be of type int, null given
done!

View File

@@ -1,11 +1,11 @@
--TEST--
Test PdoSqlite::createFunction() trampoline callback
Test Pdo\Sqlite::createFunction() trampoline callback
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
$db->query('CREATE TABLE test_pdo_sqlite_createaggregate_trampoline (a INTEGER, b INTEGER)');

View File

@@ -6,7 +6,7 @@ pdo_sqlite
<?php
// This test was copied from the pdo_sqlite test for sqliteCreateAggregate
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
$db->query('CREATE TABLE test_pdo_sqlite_createaggregate (id INT AUTO INCREMENT, name TEXT)');

View File

@@ -6,7 +6,7 @@ pdo_sqlite
<?php
// This test was copied from the pdo_sqlite test for sqliteCreateAggregate
$pdo = new PdoSqlite('sqlite::memory:');
$pdo = new Pdo\Sqlite('sqlite::memory:');
try {
$pdo->createAggregate('foo', 'a', '');
@@ -21,5 +21,5 @@ try {
?>
--EXPECT--
PdoSqlite::createAggregate(): Argument #2 ($step) must be a valid callback, function "a" not found or invalid function name
PdoSqlite::createAggregate(): Argument #3 ($finalize) must be a valid callback, function "" not found or invalid function name
Pdo\Sqlite::createAggregate(): Argument #2 ($step) must be a valid callback, function "a" not found or invalid function name
Pdo\Sqlite::createAggregate(): Argument #3 ($finalize) must be a valid callback, function "" not found or invalid function name

View File

@@ -1,5 +1,5 @@
--TEST--
Test PdoSqlite::createAggregate() arguments error
Test Pdo\Sqlite::createAggregate() arguments error
--EXTENSIONS--
pdo_sqlite
--FILE--
@@ -7,7 +7,7 @@ pdo_sqlite
declare(strict_types=1);
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
class TrampolineTest {
public function __call(string $name, array $arguments) {
@@ -54,10 +54,10 @@ try {
echo 'done!';
?>
--EXPECT--
PdoSqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
PdoSqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
PdoSqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
PdoSqlite::createAggregate(): Argument #2 ($step) must be a valid callback, no array or string given
PdoSqlite::createAggregate(): Argument #3 ($finalize) must be a valid callback, no array or string given
PdoSqlite::createAggregate(): Argument #4 ($numArgs) must be of type int, null given
Pdo\Sqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
Pdo\Sqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
Pdo\Sqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
Pdo\Sqlite::createAggregate(): Argument #2 ($step) must be a valid callback, no array or string given
Pdo\Sqlite::createAggregate(): Argument #3 ($finalize) must be a valid callback, no array or string given
Pdo\Sqlite::createAggregate(): Argument #4 ($numArgs) must be of type int, null given
done!

View File

@@ -1,11 +1,11 @@
--TEST--
Test PdoSqlite::createAggregate() trampoline callback
Test Pdo\Sqlite::createAggregate() trampoline callback
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
$db->query('CREATE TABLE test_pdo_sqlite_createaggregate_trampoline (a INTEGER, b INTEGER)');

View File

@@ -6,7 +6,7 @@ pdo_sqlite
<?php
// This test was copied from the pdo_sqlite test for sqliteCreateCollation
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->query('CREATE TABLE test_pdo_sqlite_createcollation (id INT AUTO INCREMENT, name TEXT)');

View File

@@ -1,5 +1,5 @@
--TEST--
Test PdoSqlite::createCollation() arguments error
Test Pdo\Sqlite::createCollation() arguments error
--EXTENSIONS--
pdo_sqlite
--FILE--
@@ -7,7 +7,7 @@ pdo_sqlite
declare(strict_types=1);
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
class TrampolineTest {
public function __call(string $name, array $arguments) {
@@ -30,6 +30,6 @@ try {
echo 'done!';
?>
--EXPECT--
PdoSqlite::createCollation(): Argument #1 ($name) must be of type string, null given
PdoSqlite::createCollation(): Argument #2 ($callback) must be a valid callback, no array or string given
Pdo\Sqlite::createCollation(): Argument #1 ($name) must be of type string, null given
Pdo\Sqlite::createCollation(): Argument #2 ($callback) must be a valid callback, no array or string given
done!

View File

@@ -1,11 +1,11 @@
--TEST--
Test PdoSqlite::createCollation() trampoline callback
Test Pdo\Sqlite::createCollation() trampoline callback
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
$db->query('CREATE TABLE test_pdo_sqlite_createcollation_trampoline (s VARCHAR(4))');

View File

@@ -9,11 +9,11 @@ if (!defined('PDO::SQLITE_DETERMINISTIC')) die('skip system sqlite is too old');
--FILE--
<?php
// This test was copied from the pdo_sqlite test for sqliteCreateCollation
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
$db->query('CREATE TABLE test_pdo_sqlite_createfunction_with_flags (id INT AUTO INCREMENT, name TEXT)');
$db->query('INSERT INTO test_pdo_sqlite_createfunction_with_flags VALUES (NULL, "PHP"), (NULL, "PHP6")');
$db->createFunction('testing', function($v) { return strtolower($v); }, 1, PdoSqlite::DETERMINISTIC);
$db->createFunction('testing', function($v) { return strtolower($v); }, 1, Pdo\Sqlite::DETERMINISTIC);
foreach ($db->query('SELECT testing(name) FROM test_pdo_sqlite_createfunction_with_flags') as $row) {
var_dump($row);

View File

@@ -1,18 +1,18 @@
--TEST--
PdoSqlite basic
Pdo\Sqlite basic
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
$db->query('CREATE TABLE pdosqlite_001 (id INT AUTO INCREMENT, name TEXT)');
$db->query('INSERT INTO pdosqlite_001 VALUES (NULL, "PHP")');
$db->query('INSERT INTO pdosqlite_001 VALUES (NULL, "PHP6")');
$db->createFunction('testing', function($v) { return strtolower($v); }, 1, PdoSqlite::DETERMINISTIC);
$db->createFunction('testing', function($v) { return strtolower($v); }, 1, Pdo\Sqlite::DETERMINISTIC);
foreach ($db->query('SELECT testing(name) FROM pdosqlite_001') as $row) {
var_dump($row);

View File

@@ -1,20 +1,20 @@
--TEST--
PdoSqlite create through PDO::connect and function define.
Pdo\Sqlite create through PDO::connect and function define.
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
$db = Pdo::connect('sqlite::memory:');
if (!$db instanceof PdoSqlite) {
echo "Wrong class type. Should be PdoSqlite but is " . get_class($db) . "\n";
if (!$db instanceof Pdo\Sqlite) {
echo "Wrong class type. Should be Pdo\Sqlite but is " . get_class($db) . "\n";
}
$db->query('CREATE TABLE pdosqlite_002 (id INT AUTO INCREMENT, name TEXT)');
$db->query('INSERT INTO pdosqlite_002 VALUES (NULL, "PHP")');
$db->query('INSERT INTO pdosqlite_002 VALUES (NULL, "PHP6")');
$db->createFunction('testing', function($v) { return strtolower($v); }, 1, PdoSqlite::DETERMINISTIC);
$db->createFunction('testing', function($v) { return strtolower($v); }, 1, Pdo\Sqlite::DETERMINISTIC);
foreach ($db->query('SELECT testing(name) FROM pdosqlite_002') as $row) {
var_dump($row);

View File

@@ -1,10 +1,10 @@
--TEST--
PdoSqlite load extension
Pdo\Sqlite load extension
--EXTENSIONS--
pdo_sqlite
--SKIPIF--
<?php
if (!method_exists(PdoSqlite::class, "loadExtension")) {
if (!method_exists(Pdo\Sqlite::class, "loadExtension")) {
die("skip loading sqlite extensions is not supported");
}
@@ -24,8 +24,8 @@ if ($location === null) {
require __DIR__ . "/config.inc";
$db = Pdo::connect('sqlite::memory:');
if (!$db instanceof PdoSqlite) {
echo "Wrong class type. Should be PdoSqlite but is " . get_class($db) . "\n";
if (!$db instanceof Pdo\Sqlite) {
echo "Wrong class type. Should be Pdo\Sqlite but is " . get_class($db) . "\n";
}
$db->loadExtension(getSpatialiteExtensionLocation());

View File

@@ -1,11 +1,11 @@
--TEST--
PdoSqlite::blobOpen stream test
Pdo\Sqlite::blobOpen stream test
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
$db = new PdoSqlite('sqlite::memory:');
$db = new Pdo\Sqlite('sqlite::memory:');
require_once(__DIR__ . '/stream_test.inc');
@@ -32,7 +32,7 @@ var_dump(fwrite($stream, 'ABCD'));
echo "Closing Stream\n";
var_dump(fclose($stream));
echo "Opening stream in write mode\n";
$stream = $db->openBlob('test', 'data', 1, 'main', PdoSqlite::OPEN_READWRITE);
$stream = $db->openBlob('test', 'data', 1, 'main', Pdo\Sqlite::OPEN_READWRITE);
var_dump($stream);
echo "Writing to blob\n";
var_dump(fwrite($stream, 'ABCD'));

View File

@@ -7,11 +7,11 @@ pdo_sqlite
<?php
try {
PdoPgSql::connect('sqlite::memory:');
Pdo\Pgsql::connect('sqlite::memory:');
} catch (PDOException $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECT--
PdoPgsql::connect() cannot be called when connecting to the "sqlite" driver, either PdoSqlite::connect() or PDO::connect() must be called instead
Pdo\Pgsql::connect() cannot be called when connecting to the "sqlite" driver, either Pdo\Sqlite::connect() or PDO::connect() must be called instead

View File

@@ -5,7 +5,7 @@ pdo_sqlite
--FILE--
<?php
class MyPdoSqlite extends PdoSqlite {}
class MyPdoSqlite extends Pdo\Sqlite {}
$db = MyPdoSqlite::connect('sqlite::memory:');
if (!$db instanceof MyPdoSqlite) {

View File

@@ -15,4 +15,4 @@ try {
?>
--EXPECT--
MyPDO::connect() cannot be called when connecting to the "sqlite" driver, either PdoSqlite::connect() or PDO::connect() must be called instead
MyPDO::connect() cannot be called when connecting to the "sqlite" driver, either Pdo\Sqlite::connect() or PDO::connect() must be called instead

View File

@@ -1,19 +1,19 @@
--TEST--
PdoSqlite load extension
Pdo\Sqlite load extension
--EXTENSIONS--
pdo_sqlite
--SKIPIF--
<?php
if (!method_exists(PdoSqlite::class, "loadExtension")) {
if (!method_exists(Pdo\Sqlite::class, "loadExtension")) {
die("skip loading sqlite extensions is not supported");
}
?>
--FILE--
<?php
$db = PdoSqlite::connect('sqlite::memory:');
if (!$db instanceof PdoSqlite) {
echo "Wrong class type. Should be PdoSqlite but is " . get_class($db) . "\n";
$db = Pdo\Sqlite::connect('sqlite::memory:');
if (!$db instanceof Pdo\Sqlite) {
echo "Wrong class type. Should be Pdo\Sqlite but is " . get_class($db) . "\n";
}
try {