Changeset 589 for trunk/Common/Database.php
- Timestamp:
- Nov 1, 2013, 4:22:59 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Database.php
r571 r589 28 28 { 29 29 var $Prefix = ''; 30 var $Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()');31 var $Type = 'mysql'; // mysql, pgsql30 var $Functions; 31 var $Type; 32 32 var $PDO; 33 33 var $Error = ''; 34 34 var $insert_id; 35 35 var $LastQuery = ''; 36 var $ShowSQLError = false;37 var $ShowSQLQuery = false;36 var $ShowSQLError; 37 var $ShowSQLQuery; 38 38 39 39 function __construct() 40 { 40 { 41 $this->Type = 'mysql'; // mysql, pgsql 42 $this->ShowSQLError = false; 43 $this->ShowSQLQuery = false; 44 $this->Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()'); 41 45 } 42 46 … … 46 50 else if($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host; 47 51 else $ConnectionString = ''; 48 $this->PDO = new PDO($ConnectionString, $User, $Password); 52 try { 53 $this->PDO = new PDO($ConnectionString, $User, $Password); 54 55 } catch (Exception $E) 56 { 57 unset($this->PDO); 58 throw new Exception($E->getMessage()); 59 } 60 } 61 62 function Disconnect() 63 { 64 unset($this->PDO); 65 } 66 67 function Connected() 68 { 69 return(isset($this->PDO)); 49 70 } 50 71
Note:
See TracChangeset
for help on using the changeset viewer.