Changeset 2166

Show
Ignore:
Timestamp:
02/25/2008 11:11:19 AM (11 months ago)
Author:
zombor
Message:

merging changes for release

Location:
releases/2.1.2/system/libraries
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • releases/2.1.2/system/libraries/Database.php

    r1961 r2166  
    10571057 
    10581058        /** 
     1059         * Escapes a table name for a query. 
     1060         * 
     1061         * @param   string  string to escape 
     1062         * @return  string 
     1063         */ 
     1064        public function escape_table($table) 
     1065        { 
     1066                return $this->driver->escape_table($table); 
     1067        } 
     1068 
     1069        /** 
     1070         * Escapes a column name for a query. 
     1071         * 
     1072         * @param   string  string to escape 
     1073         * @return  string 
     1074         */ 
     1075        public function escape_column($table) 
     1076        { 
     1077                return $this->driver->escape_column($table); 
     1078        } 
     1079 
     1080        /** 
    10591081         * Returns table prefix of current configuration. 
    10601082         * 
  • releases/2.1.2/system/libraries/drivers/Database/Pdosqlite.php

    r1906 r2166  
    257257                } 
    258258                else 
    259                 { 
    260                         return 'PRAGMA table_info('.$this->escape_table($table).')'; 
     259                {  
     260                        $result = $this->link->query( 'PRAGMA table_info('.$this->escape_table($table).')' ); 
     261                         
     262                        foreach($result as $row) 
     263                        { 
     264                                $tables[$table][$row['name']] = $this->sql_type($row['type']); 
     265                        }        
     266 
     267                        return $tables[$table];  
    261268                } 
    262269        } 
  • releases/2.1.2/system/libraries/drivers/Database/Pgsql.php

    r2109 r2166  
    8888        public function escape_table($table) 
    8989        { 
    90                 return '\''.str_replace('.', '"."', $table).'\''; 
     90                return '"'.str_replace('.', '"."', $table).'"'; 
    9191        } 
    9292 
     
    351351                if (is_resource($result)) 
    352352                { 
    353                         $this->current_row = 0; 
    354                         $this->total_rows  = pg_num_rows($this->result); 
    355                         $this->fetch_type = ($object === TRUE) ? 'pg_fetch_object' : 'pg_fetch_array'; 
    356                 } 
    357                 elseif (is_bool($result)) 
    358                 { 
    359                         if ($result == FALSE) 
    360                         { 
    361                                 // SQL error 
    362                                 throw new Kohana_Database_Exception('database.error', pg_last_error().' - '.$sql); 
     353                        // Its an DELETE, INSERT, REPLACE, or UPDATE query 
     354                        if (preg_match('/^(?:delete|insert|replace|update)\s+/i', trim($sql), $matches)) 
     355                        { 
     356                                $this->insert_id  = (strtolower($matches[0]) == 'insert') ? $this->get_insert_id($link) : FALSE; 
     357                                $this->total_rows = pg_affected_rows($link); 
    363358                        } 
    364359                        else 
    365360                        { 
    366                                 // Its an DELETE, INSERT, REPLACE, or UPDATE query 
    367                                 $this->insert_id  = $this->get_insert_id($link); 
    368                                 $this->total_rows = pg_affected_rows($link); 
    369                         } 
    370                 } 
     361                                $this->current_row = 0; 
     362                                $this->total_rows  = pg_num_rows($this->result); 
     363                                $this->fetch_type = ($object === TRUE) ? 'pg_fetch_object' : 'pg_fetch_array'; 
     364                        } 
     365                } 
     366                else 
     367                        throw new Kohana_Database_Exception('database.error', pg_last_error().' - '.$sql); 
    371368 
    372369                // Set result type