Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
93bec92
Add github ci
schengawegga May 13, 2025
8f4a4f4
New mysqli method multiquery
schengawegga May 13, 2025
2c7e4cc
New mysqli method multiquery
schengawegga May 13, 2025
ce5de2f
New mysqli method multiquery
schengawegga May 13, 2025
c2e538a
New mysqli method multiquery
schengawegga May 13, 2025
b9e6127
New mysqli method multiquery
schengawegga May 13, 2025
d2513e2
New mysqli method multiquery
schengawegga May 13, 2025
271bf70
New mysqli method multiquery
schengawegga May 13, 2025
c948519
New mysqli method multiquery
schengawegga May 13, 2025
0e0fb8a
New mysqli method multiquery
schengawegga May 13, 2025
d36fcaf
New mysqli method multiquery
schengawegga May 13, 2025
b676769
New mysqli method multiquery
schengawegga May 13, 2025
d391160
New mysqli method multiquery
schengawegga May 13, 2025
35fb7bf
New mysqli method multiquery
schengawegga May 13, 2025
a63b043
New mysqli method multiquery
schengawegga May 13, 2025
0ffad39
New mysqli method multiquery
schengawegga May 13, 2025
4059f3b
New mysqli method multiquery
schengawegga May 13, 2025
b2a771a
New mysqli method multiquery
schengawegga May 13, 2025
9b50514
New mysqli method multiquery
schengawegga May 13, 2025
1067472
New mysqli method multiquery
schengawegga May 13, 2025
3b2c4b9
New mysqli method multiquery
schengawegga May 13, 2025
9354c1d
New mysqli method multiquery
schengawegga May 13, 2025
67aa67e
New mysqli method multiquery
schengawegga May 13, 2025
9aa501d
New mysqli method multiquery
schengawegga May 13, 2025
862d89f
New mysqli method multiquery
schengawegga May 13, 2025
c9abfb0
New mysqli method multiquery
schengawegga May 13, 2025
4d08697
New mysqli method multiquery
schengawegga May 13, 2025
7586a72
New mysqli method multiquery
schengawegga May 13, 2025
86c7f02
Setup ci.yml env
schengawegga Jun 25, 2025
f2513ec
Setup ci.yml env
schengawegga Jun 25, 2025
44d497e
Setup ci.yml env
schengawegga Jun 25, 2025
4f20fc8
Setup ci.yml env
schengawegga Jun 25, 2025
bb4cfbd
Setup ci.yml env
schengawegga Jun 25, 2025
6b8601c
Setup ci.yml env
schengawegga Jun 25, 2025
967727e
Setup ci.yml env
schengawegga Jun 25, 2025
d0192da
Setup ci.yml env
schengawegga Jun 25, 2025
9458f23
Setup ci.yml env
schengawegga Jun 27, 2025
5e21f1e
Setup ci.yml env
schengawegga Jun 27, 2025
eb645d1
Setup ci.yml env
schengawegga Jun 27, 2025
a08b20a
Setup ci.yml env
schengawegga Jun 27, 2025
24b356d
Setup ci.yml env
schengawegga Jun 27, 2025
7c4113f
Setup ci.yml env
schengawegga Jun 27, 2025
e0a63f7
Setup ci.yml env
schengawegga Jun 27, 2025
7a62845
Setup ci.yml env
schengawegga Jun 27, 2025
4864c0c
Setup ci.yml env
schengawegga Jun 27, 2025
7d05806
Setup ci.yml env
schengawegga Jun 27, 2025
a84e8a4
Setup ci.yml env
schengawegga Jun 27, 2025
8dd2128
Setup ci.yml env
schengawegga Jun 27, 2025
2b8abee
Setup ci.yml env
schengawegga Jun 27, 2025
a1c9b77
Setup ci.yml env
schengawegga Jun 27, 2025
72d7851
Setup ci.yml env
schengawegga Jun 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: CI

on:
push:
branches:
- trunk
pull_request:
branches:
- trunk

jobs:
test:
continue-on-error: true
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

steps:
- uses: actions/checkout@v4
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mysql, mysqli
ini-values: include_path=.:/usr/share/php:pear/usr/share/php
tools: none
- name: Set up MySQL
run: |
sudo systemctl start mysql.service
mysql -e 'CREATE DATABASE pear_db;' -uroot -proot
- name: Get MySQL Version
run: |
mysqld --version
- name: Run tests
uses: gacts/run-and-post-run@v1
env:
MYSQL_TEST_USER: 'root'
MYSQL_TEST_PASSWD: 'root'
MYSQL_TEST_DB: 'pear_db'
MYSQL_TEST_HOST: '127.0.0.1'
with:
run: |
pear run-tests -r tests/
post: |
for i in `find tests/ -name '*.out'`; do echo "$i"; cat "$i"; done
48 changes: 48 additions & 0 deletions .github/workflows/ci2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: CI2

on:
push:
branches:
- trunk
pull_request:
branches:
- trunk

jobs:
test:
continue-on-error: true
#runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
php-version: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

steps:
- uses: actions/checkout@v4
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mysql, mysqli
ini-values: include_path=.:/usr/share/php:pear/usr/share/php
tools: none
- name: Set up MySQL
run: |
sudo systemctl start mysql.service
mysql -e 'CREATE DATABASE pear_db;' -uroot -proot
- name: Get MySQL Version
run: |
mysqld --version
- name: Run tests
uses: gacts/run-and-post-run@v1
env:
MYSQL_TEST_USER: 'root'
MYSQL_TEST_PASSWD: 'root'
MYSQL_TEST_DB: 'pear_db'
MYSQL_TEST_HOST: '127.0.0.1'
with:
run: |
pear run-tests -r tests/
post: |
for i in `find tests/ -name '*.out'`; do echo "$i"; cat "$i"; done
5 changes: 2 additions & 3 deletions DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -1001,9 +1001,8 @@ public function __call($method, $arguments)
if ($method == 'DB_Error') {
return call_user_func_array(array($this, '__construct'), $arguments);
}
trigger_error(
'Call to undefined method DB_Error::' . $method . '()', E_USER_ERROR
);

throw new RuntimeException('Call to undefined method DB_Error::' . $method . '()', E_USER_ERROR);
}
// }}}
}
Expand Down
1 change: 1 addition & 0 deletions tests/db_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function test_error_handler($errno, $errmsg, $file, $line, $vars=null) {
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Strict Notice',
E_DEPRECATED => 'Deprecated',
);
$prefix = $errortype[$errno];
print "\n$prefix: $errmsg in " . basename($file) . " on line XXX\n";
Expand Down
4 changes: 4 additions & 0 deletions tests/driver/connect.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ $dbh = DB::connect($dsn, $options);
if (DB::isError($dbh)) {
die('connect.inc: ' . $dbh->toString());
}

if ($dbms == 'mysql' || $dbms == 'mysqli') {
$dbh->query("SET CHARACTER SET ?", array('latin1'));
}
42 changes: 30 additions & 12 deletions tests/driver/setup.inc
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,37 @@ $dsns = array(
);

if (getenv('MYSQL_TEST_USER')) {
$dsns['mysqli'] = array(
'phptype' => 'mysqli',
'username' => getenv('MYSQL_TEST_USER'),
'password' => getenv('MYSQL_TEST_PASSWD'),
'database' => getenv('MYSQL_TEST_DB'),
/*if(version_compare(PHP_VERSION, '7.2.0', '<')) {
$dsns['mysql'] = array(
'phptype' => 'mysql',
'username' => getenv('MYSQL_TEST_USER'),
'password' => getenv('MYSQL_TEST_PASSWD'),
'database' => getenv('MYSQL_TEST_DB'),

'hostspec' => getenv('MYSQL_TEST_HOST') == ''
? null : getenv('MYSQL_TEST_HOST'),
'hostspec' => getenv('MYSQL_TEST_HOST') == ''
? null : getenv('MYSQL_TEST_HOST'),

'port' => getenv('MYSQL_TEST_PORT') == ''
? null : getenv('MYSQL_TEST_PORT'),
'port' => getenv('MYSQL_TEST_PORT') == ''
? null : getenv('MYSQL_TEST_PORT'),

'socket' => getenv('MYSQL_TEST_SOCKET') == ''
? null : getenv('MYSQL_TEST_SOCKET'),
);
'socket' => getenv('MYSQL_TEST_SOCKET') == ''
? null : getenv('MYSQL_TEST_SOCKET'),
);
} else {*/
$dsns['mysqli'] = array(
'phptype' => 'mysqli',
'username' => getenv('MYSQL_TEST_USER'),
'password' => getenv('MYSQL_TEST_PASSWD'),
'database' => getenv('MYSQL_TEST_DB'),

'hostspec' => getenv('MYSQL_TEST_HOST') == ''
? null : getenv('MYSQL_TEST_HOST'),

'port' => getenv('MYSQL_TEST_PORT') == ''
? null : getenv('MYSQL_TEST_PORT'),

'socket' => getenv('MYSQL_TEST_SOCKET') == ''
? null : getenv('MYSQL_TEST_SOCKET'),
);
//}
}
2 changes: 1 addition & 1 deletion tests/driver/skipif.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Establish the include_path, DSN's and connection $options
*/
require_once dirname(__FILE__) . '/setup.inc';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'setup.inc';

if (empty($dsns)) {
die('skip At least one element of $dsns must be defined in setup.inc');
Expand Down
17 changes: 13 additions & 4 deletions tests/errors.inc
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ $res = $dbh->query("INSERT INTO peartestnull VALUES ('one')");
$res = $dbh->query("UPDATE peartestnull SET a = NULL WHERE a = 'one'");
switch ($dbh->phptype) {
case 'mysql':
case 'mysqli':
case 'mysqli' && PHP_VERSION_ID < 70400:
check_error($res, DB_ERROR_CONSTRAINT_NOT_NULL, false);
break;
default:
Expand Down Expand Up @@ -339,11 +339,14 @@ print 'DB_ERROR_INVALID_NUMBER putting chars in INT column: ';
$res = $dbh->query("UPDATE phptest SET a = 'abc' WHERE a = 42");
switch ($dbh->phptype) {
case 'mysql':
case 'mysqli':
case 'mysqli' && PHP_VERSION_ID < 70400:
case 'sqlite':
case 'sqlite3':
check_error($res, DB_ERROR_INVALID_NUMBER, false);
break;
case 'mysqli' && PHP_VERSION_ID >= 70400:
check_error($res, DB_ERROR);
break;
default:
check_error($res, DB_ERROR_INVALID_NUMBER);
}
Expand Down Expand Up @@ -443,13 +446,16 @@ switch ($dbh->phptype . ':' . $dbh->dbsyntax) {
case 'msql:msql':
case 'mssql:mssql':
case 'mysql:mysql':
case 'mysqli:mysqli':
case 'mysqli:mysqli' && PHP_VERSION_ID < 70400:
case 'odbc:access':
case 'sqlite:sqlite':
case 'sybase:sybase':
case 'sqlite3:sqlite':
check_error($res, DB_ERROR_INVALID, false);
break;
case 'mysqli:mysqli' && PHP_VERSION_ID >= 70400:
check_error($res, DB_ERROR);
break;
case 'fbsql:fbsql':
check_error($res, DB_ERROR_TRUNCATED);
break;
Expand All @@ -465,13 +471,16 @@ switch ($dbh->phptype . ':' . $dbh->dbsyntax) {
case 'msql:msql':
case 'mssql:mssql':
case 'mysql:mysql':
case 'mysqli:mysqli':
case 'mysqli:mysqli' && PHP_VERSION_ID < 70400:
case 'odbc:access':
case 'sqlite:sqlite':
case 'sybase:sybase':
case 'sqlite3:sqlite':
check_error($res, DB_ERROR_INVALID, false);
break;
case 'mysqli:mysqli' && PHP_VERSION_ID >= 70400:
check_error($res, DB_ERROR);
break;
case 'fbsql:fbsql':
check_error($res, DB_ERROR_TRUNCATED);
break;
Expand Down
Loading