mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 06:07:39 +02:00
* removed variables $insertId & $affectedRows
This commit is contained in:
@@ -1,21 +1,35 @@
|
||||
<pre>
|
||||
<?php
|
||||
|
||||
require_once '../dibi/dibi.php';
|
||||
|
||||
|
||||
// connects to SQlite
|
||||
try {
|
||||
|
||||
// connects to SQlite
|
||||
dibi::connect(array(
|
||||
'driver' => 'sqlite',
|
||||
'database' => 'sample.sdb',
|
||||
));
|
||||
|
||||
// connects to MySQL using DSN
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// connects to MySQL using DSN
|
||||
try {
|
||||
dibi::connect('driver=mysql&host=localhost&username=root&password=xxx&database=test&charset=utf8');
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
}
|
||||
|
||||
// connects to MySQL / MySQLi
|
||||
|
||||
|
||||
|
||||
// connects to MySQL / MySQLi
|
||||
try {
|
||||
dibi::connect(array(
|
||||
'driver' => 'mysql', // or 'mysqli'
|
||||
'host' => 'localhost',
|
||||
@@ -25,8 +39,15 @@ try {
|
||||
'charset' => 'utf8',
|
||||
));
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
}
|
||||
|
||||
// connects to ODBC
|
||||
|
||||
|
||||
|
||||
// connects to ODBC
|
||||
try {
|
||||
dibi::connect(array(
|
||||
'driver' => 'odbc',
|
||||
'username' => 'root',
|
||||
@@ -34,22 +55,43 @@ try {
|
||||
'database' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\Database.mdb',
|
||||
));
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
}
|
||||
|
||||
// connects to PostgreSql
|
||||
|
||||
|
||||
|
||||
// connects to PostgreSql
|
||||
try {
|
||||
dibi::connect(array(
|
||||
'driver' => 'postgre',
|
||||
'string' => 'host=localhost port=5432 dbname=mary',
|
||||
'persistent' => TRUE,
|
||||
));
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
}
|
||||
|
||||
// connects to PDO
|
||||
|
||||
|
||||
|
||||
// connects to PDO
|
||||
try {
|
||||
dibi::connect(array(
|
||||
'driver' => 'pdo',
|
||||
'dsn' => 'sqlite2::memory:',
|
||||
));
|
||||
|
||||
// connects to MS SQL
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// connects to MS SQL
|
||||
try {
|
||||
dibi::connect(array(
|
||||
'driver' => 'mssql',
|
||||
'host' => 'localhost',
|
||||
@@ -58,7 +100,5 @@ try {
|
||||
));
|
||||
|
||||
} catch (DibiException $e) {
|
||||
|
||||
echo "DibiException: <pre>", $e;
|
||||
|
||||
echo 'DibiException: ', $e;
|
||||
}
|
||||
|
Reference in New Issue
Block a user