1
0
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:
David Grudl
2007-08-28 22:13:53 +00:00
parent 0ff0cd21df
commit 6f4d2c545d
8 changed files with 115 additions and 103 deletions

View File

@@ -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;
}