diff --git a/.github/actions/setup-x64/action.yml b/.github/actions/setup-x64/action.yml index 91cf7ea51c356..bec213375b7c5 100644 --- a/.github/actions/setup-x64/action.yml +++ b/.github/actions/setup-x64/action.yml @@ -12,6 +12,8 @@ runs: # Ensure local_infile tests can run. mysql -uroot -proot -e "SET GLOBAL local_infile = true" docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;" + docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "" -Q "create login odbc_test with password='password', check_policy=off; create user odbc_test for login odbc_test; grant alter, control, delete to odbc_test;" + docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "" -Q "ALTER SERVER ROLE sysadmin ADD MEMBER odbc_test;" sudo locale-gen de_DE ./.github/scripts/setup-slapd.sh diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index 9b7d0d100608f..7657ff8c85ad2 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -30,6 +30,10 @@ runs: export PDO_OCI_TEST_DSN="oci:dbname=localhost/XEPDB1;charset=AL32UTF8" export PGSQL_TEST_CONNSTR="host=postgres dbname=test port=5432 user=postgres password=postgres" export PDO_PGSQL_TEST_DSN="host=postgres dbname=test port=5432 user=postgres password=postgres" + export ODBC_TEST_USER="odbc_test" + export ODBC_TEST_PASS="password" + export ODBC_TEST_DSN="Driver={ODBC Driver 17 for SQL Server};Server=127.0.0.1;Database=master;uid=$ODBC_TEST_USER;pwd=$ODBC_TEST_PASS" + export PDO_ODBC_TEST_DSN="odbc:$ODBC_TEST_DSN" export SKIP_IO_CAPTURE_TESTS=1 export TEST_PHP_JUNIT=junit.out.xml export STACK_LIMIT_DEFAULTS_CHECK=1 diff --git a/UPGRADING b/UPGRADING index 3e8f694c801eb..5696920d96a7a 100644 --- a/UPGRADING +++ b/UPGRADING @@ -497,6 +497,9 @@ PHP 8.3 UPGRADE NOTES - PCNTL: . SIGINFO +- PDO_ODBC + . PDO_ODBC_TYPE + - PGSQL: . PGSQL_TRACE_SUPPRESS_TIMESTAMPS . PGSQL_TRACE_REGRESS_MODE diff --git a/ext/odbc/tests/CONFLICTS b/ext/odbc/tests/CONFLICTS deleted file mode 100644 index a3722b55c518a..0000000000000 --- a/ext/odbc/tests/CONFLICTS +++ /dev/null @@ -1 +0,0 @@ -odbc diff --git a/ext/odbc/tests/bug44618.phpt b/ext/odbc/tests/bug44618.phpt index efead0e995189..ee7b10a7e908e 100644 --- a/ext/odbc/tests/bug44618.phpt +++ b/ext/odbc/tests/bug44618.phpt @@ -3,7 +3,13 @@ Bug #44618 (Fetching may rely on uninitialized data) --EXTENSIONS-- odbc --SKIPIF-- - + --FILE-- 7, 'name'=>'test 7'), array('id'=>6, 'name'=>'test 6'), ); -$sql = "UPDATE FOO +$sql = "UPDATE bug47803 SET [PAR_CHR] = ? WHERE [PAR_ID] = ?"; $result = odbc_prepare($link, $sql); @@ -69,7 +68,7 @@ foreach ($upd_params as &$k) { } odbc_free_result($result); -$sql = "SELECT * FROM FOO WHERE [PAR_ID] = ?"; +$sql = "SELECT * FROM bug47803 WHERE [PAR_ID] = ?"; $result = odbc_prepare($link, $sql); if (!$result) { print ('[sql] prep: '.$sql); @@ -89,6 +88,17 @@ out: if ($result) odbc_free_result($result); odbc_close($link); +?> +--CLEAN-- + --EXPECT-- array(3) { @@ -171,15 +181,3 @@ array(3) { ["PAR_CHR"]=> string(6) "test 7" } ---CLEAN-- - diff --git a/ext/odbc/tests/bug60616.phpt b/ext/odbc/tests/bug60616.phpt index 468d3d5234a42..9c060ebc39f36 100644 --- a/ext/odbc/tests/bug60616.phpt +++ b/ext/odbc/tests/bug60616.phpt @@ -2,12 +2,23 @@ odbc_exec(): Getting accurate unicode data from query --EXTENSIONS-- odbc +mbstring --SKIPIF-- - --FILE-- ---EXPECT-- -EUC-JP matched -ASCII matched --CLEAN-- +--EXPECT-- +EUC-JP matched +ASCII matched + diff --git a/ext/odbc/tests/bug68087.phpt b/ext/odbc/tests/bug68087.phpt index 6d4d4cc0b2bd6..250df2ef5acee 100644 --- a/ext/odbc/tests/bug68087.phpt +++ b/ext/odbc/tests/bug68087.phpt @@ -14,14 +14,11 @@ $id_2_date = '2014-09-24'; $conn = odbc_connect($dsn, $user, $pass); -@odbc_exec($conn, 'CREATE DATABASE odbcTEST'); +odbc_exec($conn, 'CREATE TABLE bug68087 (ID INT, VARCHAR_COL VARCHAR(100), DATE_COL DATE)'); -odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL VARCHAR(100), DATE_COL DATE)'); +odbc_exec($conn, "INSERT INTO bug68087(ID, VARCHAR_COL, DATE_COL) VALUES (1, 'hello', '$id_1_date'), (2, 'helloagain', '$id_2_date')"); -odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (1, 'hello', '$id_1_date')"); -odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (2, 'helloagain', '$id_2_date')"); - -$res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC'); +$res = odbc_exec($conn, 'SELECT * FROM bug68087 ORDER BY ID ASC'); while(odbc_fetch_row($res)) { $id = odbc_result($res, "ID"); @@ -44,16 +41,15 @@ while(odbc_fetch_row($res)) { } ?> ---EXPECT-- -Date_1 matched -Date_2 matched --CLEAN-- +--EXPECT-- +Date_1 matched +Date_2 matched diff --git a/ext/odbc/tests/bug69354.phpt b/ext/odbc/tests/bug69354.phpt index 3aab7aa4e9393..47933576130ab 100644 --- a/ext/odbc/tests/bug69354.phpt +++ b/ext/odbc/tests/bug69354.phpt @@ -11,13 +11,11 @@ include 'config.inc'; $conn = odbc_connect($dsn, $user, $pass); -@odbc_exec($conn, 'CREATE DATABASE odbcTEST'); +odbc_exec($conn, 'CREATE TABLE bug69354 (ID INT, VARCHAR_COL VARCHAR(100))'); -odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL VARCHAR(100))'); +odbc_exec($conn, "INSERT INTO bug69354(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a", 100) . "')"); -odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a", 100) . "')"); - -$res = odbc_exec($conn,"select VARCHAR_COL from FOO"); +$res = odbc_exec($conn,"SELECT VARCHAR_COL FROM bug69354"); if ($res) { if (odbc_fetch_row($res)) { $ret = odbc_result($res,'varchar_col'); @@ -27,17 +25,16 @@ if ($res) { } } ?> ---EXPECT-- -100 -a -a --CLEAN-- +--EXPECT-- +100 +a +a diff --git a/ext/odbc/tests/bug69975.phpt b/ext/odbc/tests/bug69975.phpt index 3617ee7198062..4ab0613eae947 100644 --- a/ext/odbc/tests/bug69975.phpt +++ b/ext/odbc/tests/bug69975.phpt @@ -9,26 +9,25 @@ odbc include 'config.inc'; $conn = odbc_connect($dsn, $user, $pass); -@odbc_exec($conn, 'CREATE DATABASE odbcTEST'); -odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL NVARCHAR(MAX))'); -odbc_exec($conn, "INSERT INTO FOO VALUES (1, 'foo')"); +odbc_exec($conn, 'CREATE TABLE bug69975 (ID INT, VARCHAR_COL NVARCHAR(MAX))'); +odbc_exec($conn, "INSERT INTO bug69975 VALUES (1, 'foo')"); -$result = odbc_exec($conn, "SELECT VARCHAR_COL FROM FOO"); +$result = odbc_exec($conn, "SELECT VARCHAR_COL FROM bug69975"); var_dump(odbc_fetch_array($result)); echo "ready"; ?> +--CLEAN-- + --EXPECT-- array(1) { ["VARCHAR_COL"]=> string(3) "foo" } ready ---CLEAN-- - diff --git a/ext/odbc/tests/bug71171.phpt b/ext/odbc/tests/bug71171.phpt index d2cef550e3b31..029c31962f6f4 100644 --- a/ext/odbc/tests/bug71171.phpt +++ b/ext/odbc/tests/bug71171.phpt @@ -11,33 +11,30 @@ include 'config.inc'; $conn = odbc_connect($dsn, $user, $pass); -@odbc_exec($conn, 'CREATE DATABASE odbcTEST'); +odbc_exec($conn, 'CREATE TABLE bug71171 (ID INT, VARCHAR_COL NVARCHAR(40))'); -odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL NVARCHAR(40))'); +odbc_exec($conn, "INSERT INTO bug71171(ID, VARCHAR_COL) VALUES (1, '" . chr(0x81) . "')"); -odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . chr(0x81) . "')"); - -$res = odbc_exec($conn,"SELECT ID FROM FOO WHERE VARCHAR_COL = '" . chr(0x81) . "'"); +$res = odbc_exec($conn,"SELECT ID FROM bug71171 WHERE VARCHAR_COL = '" . chr(0x81) . "'"); if ($res) { while($record = odbc_fetch_array($res)) var_dump($record); } odbc_close($conn); ?> ---EXPECT-- -array(1) { - ["ID"]=> - string(1) "1" -} --CLEAN-- +--EXPECT-- +array(1) { + ["ID"]=> + string(1) "1" +} diff --git a/ext/odbc/tests/bug73448.phpt b/ext/odbc/tests/bug73448.phpt index eae5aa8ec0e98..8ec4456323214 100644 --- a/ext/odbc/tests/bug73448.phpt +++ b/ext/odbc/tests/bug73448.phpt @@ -4,6 +4,8 @@ Bug #73448 odbc_errormsg returns trash, always 513 bytes odbc --SKIPIF-- +--CONFLICTS-- +odbc --FILE-- +--CLEAN-- + --EXPECT-- array(3) { @@ -38,18 +48,7 @@ array(3) { ["i"]=> string(3) "102" ["txt"]=> - string(12) "Müsliriegel" + string(17) "Lorem ipsum dolor" ["k"]=> string(2) "34" } ---CLEAN-- - diff --git a/ext/odbc/tests/odbc_close_all_001.phpt b/ext/odbc/tests/odbc_close_all_001.phpt new file mode 100644 index 0000000000000..9641ac4bd7e4a --- /dev/null +++ b/ext/odbc/tests/odbc_close_all_001.phpt @@ -0,0 +1,38 @@ +--TEST-- +odbc_close_all(): Basic test +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +resource(5) of type (odbc link) +resource(7) of type (odbc link persistent) +resource(8) of type (odbc result) +resource(9) of type (odbc result) +resource(5) of type (Unknown) +resource(7) of type (Unknown) +resource(8) of type (Unknown) +resource(9) of type (Unknown) diff --git a/ext/odbc/tests/odbc_columns_001.phpt b/ext/odbc/tests/odbc_columns_001.phpt index 489d2ccd84ef0..920735b791003 100644 --- a/ext/odbc/tests/odbc_columns_001.phpt +++ b/ext/odbc/tests/odbc_columns_001.phpt @@ -4,6 +4,8 @@ odbc_columns(): Basic test odbc --SKIPIF-- +--CONFLICTS-- +odbc --FILE-- +--CLEAN-- + --EXPECTF-- resource(%d) of type (odbc result) diff --git a/ext/odbc/tests/odbc_commit_001.phpt b/ext/odbc/tests/odbc_commit_001.phpt new file mode 100644 index 0000000000000..5db0b0627e5b8 --- /dev/null +++ b/ext/odbc/tests/odbc_commit_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +odbc_commit(): Basic test for odbc_commit() +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +bool(true) +string(1) "1" diff --git a/ext/odbc/tests/odbc_cursor_001.phpt b/ext/odbc/tests/odbc_cursor_001.phpt new file mode 100644 index 0000000000000..b7111393d8341 --- /dev/null +++ b/ext/odbc/tests/odbc_cursor_001.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test odbc_cursor() +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +string(%d) "SQL_CUR%s" diff --git a/ext/odbc/tests/odbc_data_source_001.phpt b/ext/odbc/tests/odbc_data_source_001.phpt index b546de2cd9d8c..be3c1226b68b9 100644 --- a/ext/odbc/tests/odbc_data_source_001.phpt +++ b/ext/odbc/tests/odbc_data_source_001.phpt @@ -4,10 +4,10 @@ odbc_data_source(): Basic test odbc --SKIPIF-- --FILE-- --FILE-- --EXPECTF-- -Warning: odbc_exec(): Argument #3 must be of type int, string given in %s on line %d - -Warning: odbc_exec(): SQL error: %s in %s on line %d - -Warning: odbc_exec(): Argument #3 must be of type int, string given in %s on line %d - -Warning: odbc_exec(): SQL error: %s in %s on line %d - -Warning: odbc_exec(): SQL error: %s in %s on line %d - -Warning: odbc_exec(): SQL error: %s in %s on line %d - Warning: odbc_exec(): SQL error: %s in %s on line %d Warning: odbc_exec(): SQL error: %s in %s on line %d diff --git a/ext/odbc/tests/odbc_exec_002.phpt b/ext/odbc/tests/odbc_exec_002.phpt index 44c1baad5ac8e..347d633905384 100644 --- a/ext/odbc/tests/odbc_exec_002.phpt +++ b/ext/odbc/tests/odbc_exec_002.phpt @@ -11,14 +11,10 @@ include 'config.inc'; $conn = odbc_connect($dsn, $user, $pass); -odbc_exec($conn, 'CREATE DATABASE odbcTEST'); +odbc_exec($conn, 'CREATE TABLE exec2 (TEST INT)'); +odbc_exec($conn, 'INSERT INTO exec2 VALUES (1), (2)'); -odbc_exec($conn, 'CREATE TABLE FOO (TEST INT)'); - -odbc_exec($conn, 'INSERT INTO FOO VALUES (1)'); -odbc_exec($conn, 'INSERT INTO FOO VALUES (2)'); - -$res = odbc_exec($conn, 'SELECT * FROM FOO'); +$res = odbc_exec($conn, 'SELECT * FROM exec2'); var_dump(odbc_fetch_row($res)); var_dump(odbc_result($res, 'test')); @@ -28,8 +24,7 @@ var_dump(odbc_fetch_array($res)); --EXPECT-- bool(true) diff --git a/ext/odbc/tests/odbc_fetch_array_001.phpt b/ext/odbc/tests/odbc_fetch_array_001.phpt new file mode 100644 index 0000000000000..bf13ed25e4d64 --- /dev/null +++ b/ext/odbc/tests/odbc_fetch_array_001.phpt @@ -0,0 +1,44 @@ +--TEST-- +odbc_fetch_array(): Getting data from query +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +array(1) { + ["foo"]=> + string(1) "1" +} +array(1) { + ["foo"]=> + string(1) "2" +} +array(1) { + ["foo"]=> + string(1) "2" +} +bool(false) diff --git a/ext/odbc/tests/odbc_fetch_into_001.phpt b/ext/odbc/tests/odbc_fetch_into_001.phpt new file mode 100644 index 0000000000000..19f7f79268c58 --- /dev/null +++ b/ext/odbc/tests/odbc_fetch_into_001.phpt @@ -0,0 +1,57 @@ +--TEST-- +odbc_fetch_into(): Getting data from query +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +int(1) +array(1) { + [0]=> + string(1) "1" +} +int(1) +array(1) { + [0]=> + string(1) "2" +} +int(1) +array(1) { + [0]=> + string(1) "2" +} +bool(false) +array(0) { +} diff --git a/ext/odbc/tests/odbc_fetch_object_001.phpt b/ext/odbc/tests/odbc_fetch_object_001.phpt new file mode 100644 index 0000000000000..62a8fc3b2c7e5 --- /dev/null +++ b/ext/odbc/tests/odbc_fetch_object_001.phpt @@ -0,0 +1,44 @@ +--TEST-- +odbc_fetch_object(): Getting data from query +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +object(stdClass)#%d (%d) { + ["foo"]=> + string(1) "1" +} +object(stdClass)#%d (%d) { + ["foo"]=> + string(1) "2" +} +object(stdClass)#%d (%d) { + ["foo"]=> + string(1) "2" +} +bool(false) diff --git a/ext/odbc/tests/odbc_fetch_row_001.phpt b/ext/odbc/tests/odbc_fetch_row_001.phpt new file mode 100644 index 0000000000000..4e5e6b69d5b88 --- /dev/null +++ b/ext/odbc/tests/odbc_fetch_row_001.phpt @@ -0,0 +1,50 @@ +--TEST-- +odbc_fetch_row(): Getting data from query +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +bool(false) +bool(true) +string(1) "1" +bool(true) +string(1) "2" +bool(true) +string(1) "2" +bool(false) diff --git a/ext/odbc/tests/odbc_field_len_001.phpt b/ext/odbc/tests/odbc_field_len_001.phpt new file mode 100644 index 0000000000000..81b6fe9344fd8 --- /dev/null +++ b/ext/odbc/tests/odbc_field_len_001.phpt @@ -0,0 +1,42 @@ +--TEST-- +odbc_field_len(): Getting the length of the field +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +var_dump(odbc_field_len($res, 1)); +var_dump(odbc_field_len($res, 2)); +var_dump(odbc_field_len($res, 3)); +var_dump(odbc_field_len($res, 4)); + +odbc_close($conn); +?> +--CLEAN-- + +--EXPECTF-- +odbc_field_len(): Argument #2 ($field) must be greater than 0 +int(10) +int(2147483647) +int(50) + +Warning: odbc_field_len(): Field index larger than number of fields in %s on line %d +bool(false) diff --git a/ext/odbc/tests/odbc_field_name_001.phpt b/ext/odbc/tests/odbc_field_name_001.phpt new file mode 100644 index 0000000000000..f26e9cd205629 --- /dev/null +++ b/ext/odbc/tests/odbc_field_name_001.phpt @@ -0,0 +1,41 @@ +--TEST-- +odbc_field_name(): Getting the name of the field +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +var_dump(odbc_field_name($res, 1)); +var_dump(odbc_field_name($res, 2)); +var_dump(odbc_field_name($res, 3)); +var_dump(odbc_field_name($res, 4)); + +?> +--CLEAN-- + +--EXPECTF-- +odbc_field_name(): Argument #2 ($field) must be greater than 0 +string(3) "foo" +string(3) "bar" +string(3) "baz" + +Warning: odbc_field_name(): Field index larger than number of fields in %s on line %d +bool(false) diff --git a/ext/odbc/tests/odbc_field_num_001.phpt b/ext/odbc/tests/odbc_field_num_001.phpt new file mode 100644 index 0000000000000..3191f939fc243 --- /dev/null +++ b/ext/odbc/tests/odbc_field_num_001.phpt @@ -0,0 +1,33 @@ +--TEST-- +odbc_field_scale(): Getting the scale of the field +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +int(1) +int(2) +int(3) +bool(false) diff --git a/ext/odbc/tests/odbc_field_precision_001.phpt b/ext/odbc/tests/odbc_field_precision_001.phpt new file mode 100644 index 0000000000000..ccbe851f1d6b2 --- /dev/null +++ b/ext/odbc/tests/odbc_field_precision_001.phpt @@ -0,0 +1,41 @@ +--TEST-- +odbc_field_precision(): Getting the precision of the field +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +var_dump(odbc_field_precision($res, 1)); +var_dump(odbc_field_precision($res, 2)); +var_dump(odbc_field_precision($res, 3)); +var_dump(odbc_field_precision($res, 4)); + +?> +--CLEAN-- + +--EXPECTF-- +odbc_field_precision(): Argument #2 ($field) must be greater than 0 +int(10) +int(7) +int(50) + +Warning: odbc_field_precision(): Field index larger than number of fields in %s on line %d +bool(false) diff --git a/ext/odbc/tests/odbc_field_scale_001.phpt b/ext/odbc/tests/odbc_field_scale_001.phpt new file mode 100644 index 0000000000000..5fef7c2d9e6a1 --- /dev/null +++ b/ext/odbc/tests/odbc_field_scale_001.phpt @@ -0,0 +1,41 @@ +--TEST-- +odbc_field_scale(): Getting the scale of the field +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +var_dump(odbc_field_scale($res, 1)); +var_dump(odbc_field_scale($res, 2)); +var_dump(odbc_field_scale($res, 3)); +var_dump(odbc_field_scale($res, 4)); + +?> +--CLEAN-- + +--EXPECTF-- +odbc_field_scale(): Argument #2 ($field) must be greater than 0 +int(0) +int(0) +int(0) + +Warning: odbc_field_scale(): Field index larger than number of fields in %s on line %d +bool(false) diff --git a/ext/odbc/tests/odbc_field_type_001.phpt b/ext/odbc/tests/odbc_field_type_001.phpt new file mode 100644 index 0000000000000..374136c4e47b2 --- /dev/null +++ b/ext/odbc/tests/odbc_field_type_001.phpt @@ -0,0 +1,41 @@ +--TEST-- +odbc_field_type(): Getting the type of the field +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +var_dump(odbc_field_type($res, 1)); +var_dump(odbc_field_type($res, 2)); +var_dump(odbc_field_type($res, 3)); +var_dump(odbc_field_type($res, 4)); + +?> +--CLEAN-- + +--EXPECTF-- +odbc_field_type(): Argument #2 ($field) must be greater than 0 +string(3) "int" +string(4) "text" +string(9) "varbinary" + +Warning: odbc_field_type(): Field index larger than number of fields in %s on line %d +bool(false) diff --git a/ext/odbc/tests/odbc_free_result_001.phpt b/ext/odbc/tests/odbc_free_result_001.phpt index 653e5a0d9facb..8fc4075581a2f 100644 --- a/ext/odbc/tests/odbc_free_result_001.phpt +++ b/ext/odbc/tests/odbc_free_result_001.phpt @@ -11,15 +11,11 @@ include 'config.inc'; $conn = odbc_connect($dsn, $user, $pass); -odbc_exec($conn, 'CREATE DATABASE odbcTEST'); +odbc_exec($conn, 'CREATE TABLE free_result (TEST INT NOT NULL)'); -odbc_exec($conn, 'CREATE TABLE FOO (TEST INT NOT NULL)'); -odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY (TEST)'); +odbc_exec($conn, 'INSERT INTO free_result VALUES (1), (2)'); -odbc_exec($conn, 'INSERT INTO FOO VALUES (1)'); -odbc_exec($conn, 'INSERT INTO FOO VALUES (2)'); - -$res = odbc_exec($conn, 'SELECT * FROM FOO'); +$res = odbc_exec($conn, 'SELECT * FROM free_result'); var_dump(odbc_fetch_row($res)); var_dump(odbc_result($res, 'test')); @@ -44,8 +40,7 @@ try { --EXPECT-- bool(true) diff --git a/ext/odbc/tests/odbc_gettypeinfo_001.phpt b/ext/odbc/tests/odbc_gettypeinfo_001.phpt new file mode 100644 index 0000000000000..76b06089181fa --- /dev/null +++ b/ext/odbc/tests/odbc_gettypeinfo_001.phpt @@ -0,0 +1,154 @@ +--TEST-- +odbc_gettypeinfo(): Getting info about data types +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(20) { + ["TYPE_NAME"]=> + string(14) "datetimeoffset" + ["DATA_TYPE"]=> + string(4) "-155" + ["COLUMN_SIZE"]=> + string(2) "34" + ["LITERAL_PREFIX"]=> + string(1) "'" + ["LITERAL_SUFFIX"]=> + string(1) "'" + ["CREATE_PARAMS"]=> + string(5) "scale" + ["NULLABLE"]=> + string(1) "1" + ["CASE_SENSITIVE"]=> + string(1) "0" + ["SEARCHABLE"]=> + string(1) "3" + ["UNSIGNED_ATTRIBUTE"]=> + NULL + ["FIXED_PREC_SCALE"]=> + string(1) "0" + ["AUTO_UNIQUE_VALUE"]=> + NULL + ["LOCAL_TYPE_NAME"]=> + string(14) "datetimeoffset" + ["MINIMUM_SCALE"]=> + string(1) "0" + ["MAXIMUM_SCALE"]=> + string(1) "7" + ["SQL_DATA_TYPE"]=> + string(4) "-155" + ["SQL_DATETIME_SUB"]=> + string(1) "0" + ["NUM_PREC_RADIX"]=> + NULL + ["INTERVAL_PRECISION"]=> + NULL + ["USERTYPE"]=> + string(1) "0" +} +array(20) { + ["TYPE_NAME"]=> + string(4) "char" + ["DATA_TYPE"]=> + string(1) "1" + ["COLUMN_SIZE"]=> + string(4) "8000" + ["LITERAL_PREFIX"]=> + string(1) "'" + ["LITERAL_SUFFIX"]=> + string(1) "'" + ["CREATE_PARAMS"]=> + string(6) "length" + ["NULLABLE"]=> + string(1) "1" + ["CASE_SENSITIVE"]=> + string(1) "0" + ["SEARCHABLE"]=> + string(1) "3" + ["UNSIGNED_ATTRIBUTE"]=> + NULL + ["FIXED_PREC_SCALE"]=> + string(1) "0" + ["AUTO_UNIQUE_VALUE"]=> + NULL + ["LOCAL_TYPE_NAME"]=> + string(4) "char" + ["MINIMUM_SCALE"]=> + NULL + ["MAXIMUM_SCALE"]=> + NULL + ["SQL_DATA_TYPE"]=> + string(1) "1" + ["SQL_DATETIME_SUB"]=> + NULL + ["NUM_PREC_RADIX"]=> + NULL + ["INTERVAL_PRECISION"]=> + NULL + ["USERTYPE"]=> + string(1) "1" +} +array(20) { + ["TYPE_NAME"]=> + string(7) "numeric" + ["DATA_TYPE"]=> + string(1) "2" + ["COLUMN_SIZE"]=> + string(2) "38" + ["LITERAL_PREFIX"]=> + NULL + ["LITERAL_SUFFIX"]=> + NULL + ["CREATE_PARAMS"]=> + string(15) "precision,scale" + ["NULLABLE"]=> + string(1) "1" + ["CASE_SENSITIVE"]=> + string(1) "0" + ["SEARCHABLE"]=> + string(1) "2" + ["UNSIGNED_ATTRIBUTE"]=> + string(1) "0" + ["FIXED_PREC_SCALE"]=> + string(1) "0" + ["AUTO_UNIQUE_VALUE"]=> + string(1) "0" + ["LOCAL_TYPE_NAME"]=> + string(7) "numeric" + ["MINIMUM_SCALE"]=> + string(1) "0" + ["MAXIMUM_SCALE"]=> + string(2) "38" + ["SQL_DATA_TYPE"]=> + string(1) "2" + ["SQL_DATETIME_SUB"]=> + NULL + ["NUM_PREC_RADIX"]=> + string(2) "10" + ["INTERVAL_PRECISION"]=> + NULL + ["USERTYPE"]=> + string(2) "10" +} diff --git a/ext/odbc/tests/odbc_longreadlen_001.phpt b/ext/odbc/tests/odbc_longreadlen_001.phpt new file mode 100644 index 0000000000000..d27fa8bf9581a --- /dev/null +++ b/ext/odbc/tests/odbc_longreadlen_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test odbc_longreadlen() +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +string(4) "what" diff --git a/ext/odbc/tests/odbc_num_fields_001.phpt b/ext/odbc/tests/odbc_num_fields_001.phpt new file mode 100644 index 0000000000000..f5c55d583a2dd --- /dev/null +++ b/ext/odbc/tests/odbc_num_fields_001.phpt @@ -0,0 +1,35 @@ +--TEST-- +odbc_num_fields(): Getting the number of fields +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +int(3) +int(3) diff --git a/ext/odbc/tests/odbc_num_rows_001.phpt b/ext/odbc/tests/odbc_num_rows_001.phpt new file mode 100644 index 0000000000000..342762f920f7c --- /dev/null +++ b/ext/odbc/tests/odbc_num_rows_001.phpt @@ -0,0 +1,35 @@ +--TEST-- +odbc_num_rows(): Getting the number of rows +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +int(3) +int(0) diff --git a/ext/odbc/tests/odbc_primarykeys_001.phpt b/ext/odbc/tests/odbc_primarykeys_001.phpt new file mode 100644 index 0000000000000..543a22733da71 --- /dev/null +++ b/ext/odbc/tests/odbc_primarykeys_001.phpt @@ -0,0 +1,93 @@ +--TEST-- +odbc_primarykeys(): Basic test for odbc_primarykeys() +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +bool(false) +bool(false) +bool(false) +array(%d) { + ["TABLE_CAT"]=> + string(%d) "PrimarykeysTest" + ["TABLE_SCHEM"]=> + string(%d) "dbo" + ["TABLE_NAME"]=> + string(%d) "primarykeys" + ["COLUMN_NAME"]=> + string(%d) "test" + ["KEY_SEQ"]=> + string(%d) "1" + ["PK_NAME"]=> + string(%d) "primarykeys_pk" +} +array(%d) { + ["TABLE_CAT"]=> + string(%d) "PrimarykeysTest" + ["TABLE_SCHEM"]=> + string(%d) "dbo" + ["TABLE_NAME"]=> + string(%d) "primarykeys" + ["COLUMN_NAME"]=> + string(%d) "test" + ["KEY_SEQ"]=> + string(%d) "1" + ["PK_NAME"]=> + string(%d) "primarykeys_pk" +} diff --git a/ext/odbc/tests/odbc_rollback_001.phpt b/ext/odbc/tests/odbc_rollback_001.phpt new file mode 100644 index 0000000000000..6f4cf3d6926d7 --- /dev/null +++ b/ext/odbc/tests/odbc_rollback_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +odbc_rollback(): Basic test for odbc_rollback() +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +bool(true) +bool(false) diff --git a/ext/odbc/tests/odbc_setoption_001.phpt b/ext/odbc/tests/odbc_setoption_001.phpt new file mode 100644 index 0000000000000..3f2202100aa64 --- /dev/null +++ b/ext/odbc/tests/odbc_setoption_001.phpt @@ -0,0 +1,24 @@ +--TEST-- +odbc_setoption(): Basic test for odbc_setoption() +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) +int(0) diff --git a/ext/odbc/tests/odbc_setoption_002.phpt b/ext/odbc/tests/odbc_setoption_002.phpt new file mode 100644 index 0000000000000..e93d45b6fb414 --- /dev/null +++ b/ext/odbc/tests/odbc_setoption_002.phpt @@ -0,0 +1,25 @@ +--TEST-- +odbc_setoption(): Test for odbc_setoption() with persistent connection +--EXTENSIONS-- +odbc +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: odbc_setoption(): Unable to set option for persistent connection in %s on line %d +bool(false) +int(1) diff --git a/ext/pdo/tests/bug_36798.phpt b/ext/pdo/tests/bug_36798.phpt index dea1a5b92a23c..da258bc87d34d 100644 --- a/ext/pdo/tests/bug_36798.phpt +++ b/ext/pdo/tests/bug_36798.phpt @@ -13,6 +13,8 @@ if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))){ if (!strpos(strtolower(getenv('PDOTEST_DSN')), 'charset=we8mswin1252')) die('skip expected output valid for Oracle with WE8MSWIN1252 character set'); } elseif (!strncasecmp(getenv('PDOTEST_DSN'), 'dblib', strlen('dblib'))) { die('skip not for pdo_dblib'); +} elseif (!strncasecmp(getenv('PDOTEST_DSN'), 'odbc', strlen('odbc'))) { + die('skip not for pdo_odbc'); } ?> diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c index 98e684bc5a95b..8e090a397f061 100644 --- a/ext/pdo_odbc/pdo_odbc.c +++ b/ext/pdo_odbc/pdo_odbc.c @@ -25,6 +25,7 @@ #include "pdo/php_pdo_driver.h" #include "php_pdo_odbc.h" #include "php_pdo_odbc_int.h" +#include "pdo_odbc_arginfo.h" /* {{{ pdo_odbc_deps[] */ static const zend_module_dep pdo_odbc_deps[] = { @@ -96,6 +97,8 @@ PHP_MINIT_FUNCTION(pdo_odbc) } #endif + register_pdo_odbc_symbols(module_number); + REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY); REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_ASSUME_UTF8", PDO_ODBC_ATTR_ASSUME_UTF8); REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED); diff --git a/ext/pdo_odbc/pdo_odbc.stub.php b/ext/pdo_odbc/pdo_odbc.stub.php new file mode 100644 index 0000000000000..745be283375da --- /dev/null +++ b/ext/pdo_odbc/pdo_odbc.stub.php @@ -0,0 +1,9 @@ + --FILE--