mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 06:07:39 +02:00
used PHP 5.4 syntax
This commit is contained in:
@@ -10,10 +10,10 @@ require __DIR__ . '/../src/loader.php';
|
||||
// connects to SQlite using dibi class
|
||||
echo '<p>Connecting to Sqlite: ';
|
||||
try {
|
||||
dibi::connect(array(
|
||||
dibi::connect([
|
||||
'driver' => 'sqlite3',
|
||||
'database' => 'data/sample.s3db',
|
||||
));
|
||||
]);
|
||||
echo 'OK';
|
||||
} catch (DibiException $e) {
|
||||
echo get_class($e), ': ', $e->getMessage(), "\n";
|
||||
@@ -24,10 +24,10 @@ echo "</p>\n";
|
||||
// connects to SQlite using DibiConnection object
|
||||
echo '<p>Connecting to Sqlite: ';
|
||||
try {
|
||||
$connection = new DibiConnection(array(
|
||||
$connection = new DibiConnection([
|
||||
'driver' => 'sqlite3',
|
||||
'database' => 'data/sample.s3db',
|
||||
));
|
||||
]);
|
||||
echo 'OK';
|
||||
} catch (DibiException $e) {
|
||||
echo get_class($e), ': ', $e->getMessage(), "\n";
|
||||
@@ -49,17 +49,17 @@ echo "</p>\n";
|
||||
// connects to MySQLi using array
|
||||
echo '<p>Connecting to MySQLi: ';
|
||||
try {
|
||||
dibi::connect(array(
|
||||
dibi::connect([
|
||||
'driver' => 'mysqli',
|
||||
'host' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => 'xxx',
|
||||
'database' => 'dibi',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
MYSQLI_OPT_CONNECT_TIMEOUT => 30,
|
||||
),
|
||||
],
|
||||
'flags' => MYSQLI_CLIENT_COMPRESS,
|
||||
));
|
||||
]);
|
||||
echo 'OK';
|
||||
} catch (DibiException $e) {
|
||||
echo get_class($e), ': ', $e->getMessage(), "\n";
|
||||
@@ -70,12 +70,12 @@ echo "</p>\n";
|
||||
// connects to ODBC
|
||||
echo '<p>Connecting to ODBC: ';
|
||||
try {
|
||||
dibi::connect(array(
|
||||
dibi::connect([
|
||||
'driver' => 'odbc',
|
||||
'username' => 'root',
|
||||
'password' => '***',
|
||||
'dsn' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq='.__DIR__.'/data/sample.mdb',
|
||||
));
|
||||
]);
|
||||
echo 'OK';
|
||||
} catch (DibiException $e) {
|
||||
echo get_class($e), ': ', $e->getMessage(), "\n";
|
||||
@@ -86,11 +86,11 @@ echo "</p>\n";
|
||||
// connects to PostgreSql
|
||||
echo '<p>Connecting to PostgreSql: ';
|
||||
try {
|
||||
dibi::connect(array(
|
||||
dibi::connect([
|
||||
'driver' => 'postgre',
|
||||
'string' => 'host=localhost port=5432 dbname=mary',
|
||||
'persistent' => TRUE,
|
||||
));
|
||||
]);
|
||||
echo 'OK';
|
||||
} catch (DibiException $e) {
|
||||
echo get_class($e), ': ', $e->getMessage(), "\n";
|
||||
@@ -101,10 +101,10 @@ echo "</p>\n";
|
||||
// connects to PDO
|
||||
echo '<p>Connecting to Sqlite via PDO: ';
|
||||
try {
|
||||
dibi::connect(array(
|
||||
dibi::connect([
|
||||
'driver' => 'pdo',
|
||||
'dsn' => 'sqlite::memory:',
|
||||
));
|
||||
]);
|
||||
echo 'OK';
|
||||
} catch (DibiException $e) {
|
||||
echo get_class($e), ': ', $e->getMessage(), "\n";
|
||||
@@ -115,12 +115,12 @@ echo "</p>\n";
|
||||
// connects to MS SQL
|
||||
echo '<p>Connecting to MS SQL: ';
|
||||
try {
|
||||
dibi::connect(array(
|
||||
dibi::connect([
|
||||
'driver' => 'mssql',
|
||||
'host' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => 'xxx',
|
||||
));
|
||||
]);
|
||||
echo 'OK';
|
||||
} catch (DibiException $e) {
|
||||
echo get_class($e), ': ', $e->getMessage(), "\n";
|
||||
@@ -131,13 +131,13 @@ echo "</p>\n";
|
||||
// connects to MS SQL 2005
|
||||
echo '<p>Connecting to MS SQL 2005: ';
|
||||
try {
|
||||
dibi::connect(array(
|
||||
dibi::connect([
|
||||
'driver' => 'mssql2005',
|
||||
'host' => '(local)',
|
||||
'username' => 'Administrator',
|
||||
'password' => 'xxx',
|
||||
'database' => 'main',
|
||||
));
|
||||
]);
|
||||
echo 'OK';
|
||||
} catch (DibiException $e) {
|
||||
echo get_class($e), ': ', $e->getMessage(), "\n";
|
||||
@@ -148,12 +148,12 @@ echo "</p>\n";
|
||||
// connects to Oracle
|
||||
echo '<p>Connecting to Oracle: ';
|
||||
try {
|
||||
dibi::connect(array(
|
||||
dibi::connect([
|
||||
'driver' => 'oracle',
|
||||
'username' => 'root',
|
||||
'password' => 'xxx',
|
||||
'database' => 'db',
|
||||
));
|
||||
]);
|
||||
echo 'OK';
|
||||
} catch (DibiException $e) {
|
||||
echo get_class($e), ': ', $e->getMessage(), "\n";
|
||||
|
Reference in New Issue
Block a user