diff --git a/dibi/dibi.php b/dibi/dibi.php index 349a9c8a..90a7d7dc 100644 --- a/dibi/dibi.php +++ b/dibi/dibi.php @@ -71,7 +71,7 @@ interface DibiVariableInterface * * @version $Revision$ $Date$ */ -class dibi +class dibi extends NClass { /** * Column type in relation to PHP native type @@ -157,13 +157,6 @@ class dibi - /** - * Monostate class - */ - final private function __construct() - {} - - /** * Creates a new DibiDriver object and connects it to specified database * diff --git a/dibi/libs/DibiResult.php b/dibi/libs/DibiResult.php index 110b13f5..b3e96c59 100644 --- a/dibi/libs/DibiResult.php +++ b/dibi/libs/DibiResult.php @@ -453,28 +453,24 @@ abstract class DibiResult extends NObject implements IteratorAggregate, Countabl */ public function dump() { - echo '
#row | '; + echo "\n
---|
#row | \n"; + foreach ($this->getFields() as $field) { - echo '' . htmlSpecialChars($field) . ' | '; + echo "\t\t" . htmlSpecialChars($field) . " | \n"; } - echo '
---|---|---|
', $row, ' | '; + echo "\t||
", $row, " | \n"; foreach ($fields as $field) { //if (is_object($field)) $field = $field->__toString(); - echo '', htmlSpecialChars($field), ' | '; + echo "\t\t", htmlSpecialChars($field), " | \n"; } - echo '
Connected to Sqlite
'; + echo 'OK'; } catch (DibiException $e) { - echo '', $e, ''; + echo get_class($e), ': ', $e->getMessage(); } +echo "\n"; + // connects to MySQL using DSN +echo '
Connecting to MySQL: '; try { dibi::connect('driver=mysql&host=localhost&username=root&password=xxx&database=test&charset=utf8'); - echo '
Connected to MySQL
'; + echo 'OK'; } catch (DibiException $e) { - echo '', $e, ''; + echo get_class($e), ': ', $e->getMessage(); } +echo "\n"; // connects to MySQLi using array +echo '
Connecting to MySQL: '; try { dibi::connect(array( 'driver' => 'mysqli', @@ -40,16 +46,18 @@ try { 'database' => 'dibi', 'charset' => 'utf8', )); - echo '
Connected to MySQL
'; + echo 'OK'; } catch (DibiException $e) { - echo '', $e, ''; + echo get_class($e), ': ', $e->getMessage(); } +echo "\n"; // connects to ODBC +echo '
Connecting to ODBC: '; try { dibi::connect(array( 'driver' => 'odbc', @@ -57,46 +65,52 @@ try { 'password' => '***', 'database' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq='.dirname(__FILE__).'/sample.mdb', )); - echo '
Connected to ODBC
'; + echo 'OK'; } catch (DibiException $e) { - echo '', $e, ''; + echo get_class($e), ': ', $e->getMessage(); } +echo "\n"; // connects to PostgreSql +echo '
Connecting to PostgreSql: '; try { dibi::connect(array( 'driver' => 'postgre', 'string' => 'host=localhost port=5432 dbname=mary', 'persistent' => TRUE, )); - echo '
Connected to PostgreSql
'; + echo 'OK'; } catch (DibiException $e) { - echo '', $e, ''; + echo get_class($e), ': ', $e->getMessage(); } +echo "\n"; // connects to PDO +echo '
Connecting to Sqlite via PDO: '; try { dibi::connect(array( 'driver' => 'pdo', 'dsn' => 'sqlite2::memory:', )); - echo '
Connected to Sqlite via PDO
'; + echo 'OK'; } catch (DibiException $e) { - echo '', $e, ''; + echo get_class($e), ': ', $e->getMessage(); } +echo "\n"; // connects to MS SQL +echo '
Connecting to MS SQL: '; try { dibi::connect(array( 'driver' => 'mssql', @@ -104,15 +118,17 @@ try { 'username' => 'root', 'password' => 'xxx', )); - echo '
Connected to MS SQL
'; + echo 'OK'; } catch (DibiException $e) { - echo '', $e, ''; + echo get_class($e), ': ', $e->getMessage(); } +echo "\n"; // connects to Oracle +echo '
Connecting to Oracle: '; try { dibi::connect(array( 'driver' => 'oracle', @@ -120,8 +136,9 @@ try { 'password' => 'xxx', 'database' => 'db', )); - echo '
Connected to Oracle
'; + echo 'OK'; } catch (DibiException $e) { - echo '', $e, ''; + echo get_class($e), ': ', $e->getMessage(); } +echo "\n"; \ No newline at end of file diff --git a/examples/date.type.demo.php b/examples/date.type.demo.php index 2a54f8ee..a8afd2e8 100644 --- a/examples/date.type.demo.php +++ b/examples/date.type.demo.php @@ -1,4 +1,4 @@ -
', $e, ''; + echo '
', get_class($e), ': ', $e->getMessage(), '
'; }