Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

git-svn-id: svn://dklab.ru/lib/DbSimple/trunk@150 78bb956b-1e24-0410-…

…b8d0-c528fdc9eae3
  • Loading branch information...
commit eec188f83cd62e815d2bda89b1d8285590045c80 1 parent e9f2e88
dk authored
Showing with 3 additions and 17 deletions.
  1. +3 −17 test/DbSimple/connect.php
View
20 test/DbSimple/connect.php
@@ -1,26 +1,12 @@
<?php ## Ïîäêëþ÷åíèå ê ÁÄ.
require_once "../../lib/config.php";
-require_once "DbSimple/DSN.php";
-
-// Ïîëó÷àåì ïàðîëü äëÿ äîñòóïà ê ÁÄ èç âíåøíåãî ôàéëà,
-// ÷òîáû íå ïîäñìàòðèâàëè.
-@include "{$_SERVER['DOCUMENT_ROOT']}/../forum/dbconfig.php";
-if (!empty($dbpasswd)) {
- // Ýòî ïàðàìåòðû ïîäêëþ÷åíèÿ äëÿ dklab.
- $dsn = "mysql://$dbuser:$dbpasswd@localhost/$dbname";
-} else {
- // À ýòî - äëÿ âàñ. Âû æå íå dklab...
- $dsn = "mysql://Ëîãèí:Ïàðîëü@Õîñò/Áàçà";
-}
+require_once "DbSimple/Generic.php";
// Ïîäêëþ÷àåìñÿ ê ÁÄ.
-$DATABASE = DbSimple_DSN::connect($dsn);
+$DATABASE = DbSimple_Generic::connect('mysql://test:test@localhost/non-existed-db');
// Óñòàíàâëèâàåì îáðàáîò÷èê îøèáîê.
-$DATABASE->set_error_handler('databaseErrorHandler');
-
-// Ñòàðòóåì íîâóþ òðàíçàêöèþ.
-$DB = $DATABASE->transaction();
+$DATABASE->setErrorHandler('databaseErrorHandler');
// Êîä îáðàáîò÷èêà îøèáîê SQL.
function databaseErrorHandler($message, $info)
Please sign in to comment.
Something went wrong with that request. Please try again.