- Timestamp:
- Aug 27, 2015, 4:58:13 PM (11 years ago)
- Branches:
- master
- Children:
- db38696
- Parents:
- 8c356c1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/webservice/htdocs/SiWeather/Webservice/DatabaseHandler.php
r8c356c1 rb38cc03 66 66 return true; 67 67 } 68 if(is_null($this->_databaseFile) ){68 if(is_null($this->_databaseFile) || empty($this->_databaseFile)){ 69 69 $this->_lastErrorMessage = "No database file given"; 70 70 error_log("Could not connect to the database: "+ $this->lastErrorMessage()); … … 72 72 } 73 73 try { 74 $db = new \SQLite3($this->_databaseFile );74 $db = new \SQLite3($this->_databaseFile, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE); 75 75 } 76 catch( PDOException $exception){76 catch(\Exception $exception){ 77 77 $this->_lastErrorMessage = $exception->getMessage(); 78 78 error_log("Could not connect to the database: "+ $this->lastErrorMessage()); 79 79 return false; 80 80 } 81 #loading SpatiaLite as an extension81 // loading SpatiaLite as an extension 82 82 $extension = $this->_config->getConfig("spatialiteExtension"); 83 83 if(empty($extension)){ … … 111 111 public function exec($query) 112 112 { 113 if(is_null($this->_database)){ 114 return false; 115 } 113 116 if(!$this->connect()){ 114 117 return false; … … 119 122 public function prepare($query) 120 123 { 124 if(is_null($this->_database)){ 125 return false; 126 } 121 127 if(!$this->connect()){ 122 128 return false; … … 127 133 public function versionSpatialite(){ 128 134 if(is_null($this->_database)){ 129 $this->_lastErrorMessage ("Unknown (No database connection)");135 $this->_lastErrorMessage = "Unknown (No database connection)"; 130 136 return 0; 131 137 } … … 142 148 public function versionSqlite(){ 143 149 if(is_null($this->_database)){ 144 $this->_lastErrorMessage ("Unknown (No database connection)");150 $this->_lastErrorMessage = "Unknown (No database connection)"; 145 151 return 0; 146 152 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/siweather/chrome/site/your_project_logo.png)