Changeset 2165 for trunk/system/libraries/drivers/Database/Pgsql.php
- Timestamp:
- 02/25/2008 09:37:34 AM (11 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/drivers/Database/Pgsql.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/drivers/Database/Pgsql.php
r2162 r2165 351 351 if (is_resource($result)) 352 352 { 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); 363 358 } 364 359 else 365 360 { 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); 371 368 372 369 // Set result type
