Ignore:
Timestamp:
Aug 27, 2015, 4:58:13 PM (11 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
master
Children:
db38696
Parents:
8c356c1
Message:
  • Translated more messages
    • Stripped out test externals, because they are not needed
    • Improved Setup class, to create all needed database tables
    • Smaller general improvements on the test classes
    • Extended the SetupTest extent
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/webservice/htdocs/SiWeather/Webservice/DatabaseHandler.php

    r8c356c1 rb38cc03  
    6666                        return true;
    6767                }
    68                 if(is_null($this->_databaseFile)){
     68                if(is_null($this->_databaseFile) || empty($this->_databaseFile)){
    6969                        $this->_lastErrorMessage = "No database file given";
    7070                        error_log("Could not connect to the database: "+ $this->lastErrorMessage());
    … …  
    7272                }
    7373                try {
    74                         $db = new \SQLite3($this->_databaseFile);
     74                        $db = new \SQLite3($this->_databaseFile, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
    7575                }
    76                 catch(PDOException $exception){
     76                catch(\Exception $exception){
    7777                        $this->_lastErrorMessage = $exception->getMessage();
    7878                        error_log("Could not connect to the database: "+ $this->lastErrorMessage());
    7979                        return false;
    8080                }
    81                 # loading SpatiaLite as an extension
     81                // loading SpatiaLite as an extension
    8282                $extension = $this->_config->getConfig("spatialiteExtension");
    8383                if(empty($extension)){
    … …  
    111111        public function exec($query)
    112112        {
     113                if(is_null($this->_database)){
     114                        return false;
     115                }
    113116                if(!$this->connect()){
    114117                        return false;
    … …  
    119122        public function prepare($query)
    120123        {
     124                if(is_null($this->_database)){
     125                        return false;
     126                }
    121127                if(!$this->connect()){
    122128                        return false;
    … …  
    127133        public function versionSpatialite(){
    128134                if(is_null($this->_database)){
    129                         $this->_lastErrorMessage("Unknown (No database connection)");
     135                        $this->_lastErrorMessage = "Unknown (No database connection)";
    130136                        return 0;
    131137                }
    … …  
    142148        public function versionSqlite(){
    143149                if(is_null($this->_database)){
    144                         $this->_lastErrorMessage("Unknown (No database connection)");
     150                        $this->_lastErrorMessage = "Unknown (No database connection)";
    145151                        return 0;
    146152                }
Note: See TracChangeset for help on using the changeset viewer.