1
0
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:
David Grudl
2007-09-29 07:53:25 +00:00
parent 0d8478d1d3
commit d35a850311
26 changed files with 689 additions and 703 deletions

View File

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