mirror of
https://github.com/dg/dibi.git
synced 2025-08-29 16:59:49 +02:00
* removed $throwExceptions (always throws)
* added DibiLogger, dibi::notify(), dibi::startLogger() * miniprofiler dibi::$numOfQueries, $totalTime, $elapsedTime * simplified DibiException, added DibiDatabaseException * Dibi::nativeQuery splitted into DibiDriver::doQuery & nativeQuery() * moved dibi::dumpResult -> DibiResult::dump() * moved dibi::test() -> DibiDriver::test() * DibiTranslator generates $mask
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<pre>
|
||||
<h1>dibi connect example</h1>
|
||||
<?php
|
||||
|
||||
require_once '../dibi/dibi.php';
|
||||
@@ -10,9 +10,10 @@ try {
|
||||
'driver' => 'sqlite',
|
||||
'database' => 'sample.sdb',
|
||||
));
|
||||
echo '<p>Connected to Sqlite</p>';
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
echo '<pre>', $e, '</pre>';
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +21,10 @@ try {
|
||||
// connects to MySQL using DSN
|
||||
try {
|
||||
dibi::connect('driver=mysql&host=localhost&username=root&password=xxx&database=test&charset=utf8');
|
||||
echo '<p>Connected to MySQL</p>';
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
echo '<pre>', $e, '</pre>';
|
||||
}
|
||||
|
||||
|
||||
@@ -38,9 +40,10 @@ try {
|
||||
'database' => 'dibi',
|
||||
'charset' => 'utf8',
|
||||
));
|
||||
echo '<p>Connected to MySQL</p>';
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
echo '<pre>', $e, '</pre>';
|
||||
}
|
||||
|
||||
|
||||
@@ -52,11 +55,12 @@ try {
|
||||
'driver' => 'odbc',
|
||||
'username' => 'root',
|
||||
'password' => '***',
|
||||
'database' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\Database.mdb',
|
||||
'database' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq='.dirname(__FILE__).'/sample.mdb',
|
||||
));
|
||||
echo '<p>Connected to ODBC</p>';
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
echo '<pre>', $e, '</pre>';
|
||||
}
|
||||
|
||||
|
||||
@@ -69,9 +73,10 @@ try {
|
||||
'string' => 'host=localhost port=5432 dbname=mary',
|
||||
'persistent' => TRUE,
|
||||
));
|
||||
echo '<p>Connected to PostgreSql</p>';
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
echo '<pre>', $e, '</pre>';
|
||||
}
|
||||
|
||||
|
||||
@@ -83,9 +88,10 @@ try {
|
||||
'driver' => 'pdo',
|
||||
'dsn' => 'sqlite2::memory:',
|
||||
));
|
||||
echo '<p>Connected to Sqlite via PDO</p>';
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
echo '<pre>', $e, '</pre>';
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +104,8 @@ try {
|
||||
'username' => 'root',
|
||||
'password' => 'xxx',
|
||||
));
|
||||
echo '<p>Connected to MS SQL</p>';
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo 'DibiException: ', $e;
|
||||
echo '<pre>', $e, '</pre>';
|
||||
}
|
||||
|
Reference in New Issue
Block a user