Changeset 897 for trunk/Packages/Common/Database.php
- Timestamp:
- Jan 22, 2021, 12:04:30 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Database.php
r890 r897 44 44 public bool $LogSQLQuery; 45 45 public string $LogFile; 46 public string $Database; 46 47 47 48 function __construct() … … 56 57 $this->LogSQLQuery = false; 57 58 $this->LogFile = dirname(__FILE__).'/../../Query.log'; 59 $this->Database = ''; 58 60 } 59 61 … … 63 65 else if ($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host; 64 66 else $ConnectionString = ''; 67 $this->Database = $Database; 65 68 try { 66 69 $this->PDO = new PDO($ConnectionString, $User, $Password); 67 68 70 } catch (Exception $E) 69 71 { … … 235 237 $this->PDO->commit(); 236 238 } 239 240 public function TableExists(string $Name): bool 241 { 242 $DbResult = $this->query('SELECT * FROM information_schema.tables WHERE table_schema = "'.$this->Database. 243 '" AND table_name = "'.$Name.'" LIMIT 1'); 244 return $DbResult->num_rows != 0; 245 } 237 246 } 238 247
Note:
See TracChangeset
for help on using the changeset viewer.