

Public Member Functions | |
| db_connect () | |
| Non-persistent database connection. | |
| db_pconnect () | |
| Persistent database connection. | |
| db_select () | |
| Select the database. | |
| db_set_charset ($charset, $collation) | |
| Set client character set. | |
| _version () | |
| Version number query string. | |
| _execute ($sql) | |
| Execute the query. | |
| _prep_query ($sql) | |
| Prep the query. | |
| trans_begin ($test_mode=FALSE) | |
| Begin Transaction. | |
| trans_commit () | |
| Commit Transaction. | |
| trans_rollback () | |
| Rollback Transaction. | |
| escape_str ($str) | |
| Escape String. | |
| affected_rows () | |
| Affected Rows. | |
| insert_id () | |
| Insert ID. | |
| count_all ($table= '') | |
| "Count All" query | |
| _list_tables ($prefix_limit=FALSE) | |
| List table query. | |
| _list_columns ($table= '') | |
| Show column query. | |
| _field_data ($table) | |
| Field data query. | |
| _error_message () | |
| The error message string. | |
| _error_number () | |
| The error message number. | |
| _escape_identifiers ($item) | |
| Escape the SQL Identifiers. | |
| _from_tables ($tables) | |
| From Tables. | |
| _insert ($table, $keys, $values) | |
| Insert statement. | |
| _update ($table, $values, $where, $orderby=array(), $limit=FALSE) | |
| Update statement. | |
| _truncate ($table) | |
| Truncate statement. | |
| _delete ($table, $where=array(), $like=array(), $limit=FALSE) | |
| Delete statement. | |
| _limit ($sql, $limit, $offset) | |
| Limit string. | |
| _close ($conn_id) | |
| Close DB Connection. | |
Public Attributes | |
| $dbdriver = 'sqlite' | |
| $_escape_char = '' | |
| $_count_string = "SELECT COUNT(*) AS " | |
| The syntax to count rows is slightly different across different database engines, so this string appears in each driver and is used for the count_all() and count_all_results() functions. | |
| $_random_keyword = ' Random()' | |
Definition at line 33 of file sqlite_driver.php.
| CI_DB_sqlite_driver::_close | ( | $ | conn_id | ) |
Close DB Connection.
public
| resource |
Definition at line 591 of file sqlite_driver.php.
| CI_DB_sqlite_driver::_delete | ( | $ | table, | |
| $ | where = array(), |
|||
| $ | like = array(), |
|||
| $ | limit = FALSE | |||
| ) |
Delete statement.
Generates a platform-specific delete string from the supplied data
public
| string | the table name | |
| array | the where clause | |
| string | the limit clause |
Definition at line 534 of file sqlite_driver.php.
Referenced by _truncate().
00535 { 00536 $conditions = ''; 00537 00538 if (count($where) > 0 OR count($like) > 0) 00539 { 00540 $conditions = "\nWHERE "; 00541 $conditions .= implode("\n", $this->ar_where); 00542 00543 if (count($where) > 0 && count($like) > 0) 00544 { 00545 $conditions .= " AND "; 00546 } 00547 $conditions .= implode("\n", $like); 00548 } 00549 00550 $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; 00551 00552 return "DELETE FROM ".$table.$conditions.$limit; 00553 }

| CI_DB_sqlite_driver::_error_message | ( | ) |
| CI_DB_sqlite_driver::_error_number | ( | ) |
| CI_DB_sqlite_driver::_escape_identifiers | ( | $ | item | ) |
Escape the SQL Identifiers.
This function escapes column and table names
private
| string |
Definition at line 407 of file sqlite_driver.php.
00408 { 00409 if ($this->_escape_char == '') 00410 { 00411 return $item; 00412 } 00413 00414 if (strpos($item, '.') !== FALSE) 00415 { 00416 $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; 00417 } 00418 else 00419 { 00420 $str = $this->_escape_char.$item.$this->_escape_char; 00421 } 00422 00423 // remove duplicates if the user already included the escape 00424 return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); 00425 }
| CI_DB_sqlite_driver::_execute | ( | $ | sql | ) |
Execute the query.
private called by the base class
| string | an SQL query |
Definition at line 147 of file sqlite_driver.php.
References _prep_query().
00148 { 00149 $sql = $this->_prep_query($sql); 00150 return @sqlite_query($this->conn_id, $sql); 00151 }

| CI_DB_sqlite_driver::_field_data | ( | $ | table | ) |
Field data query.
Generates a platform-specific query so that the column data can be retrieved
public
| string | the table name |
Definition at line 365 of file sqlite_driver.php.
| CI_DB_sqlite_driver::_from_tables | ( | $ | tables | ) |
From Tables.
This function implicitly groups FROM tables so there is no confusion about operator precedence in harmony with SQL standards
public
| type |
Definition at line 439 of file sqlite_driver.php.
00440 { 00441 if ( ! is_array($tables)) 00442 { 00443 $tables = array($tables); 00444 } 00445 00446 return '('.implode(', ', $tables).')'; 00447 }
| CI_DB_sqlite_driver::_insert | ( | $ | table, | |
| $ | keys, | |||
| $ | values | |||
| ) |
Insert statement.
Generates a platform-specific insert string from the supplied data
public
| string | the table name | |
| array | the insert keys | |
| array | the insert values |
Definition at line 462 of file sqlite_driver.php.
00463 { 00464 return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; 00465 }
| CI_DB_sqlite_driver::_limit | ( | $ | sql, | |
| $ | limit, | |||
| $ | offset | |||
| ) |
Limit string.
Generates a platform-specific LIMIT clause
public
| string | the sql query string | |
| integer | the number of rows to limit the query to | |
| integer | the offset value |
Definition at line 568 of file sqlite_driver.php.
00569 { 00570 if ($offset == 0) 00571 { 00572 $offset = ''; 00573 } 00574 else 00575 { 00576 $offset .= ", "; 00577 } 00578 00579 return $sql."LIMIT ".$offset.$limit; 00580 }
| CI_DB_sqlite_driver::_list_columns | ( | $ | table = '' |
) |
Show column query.
Generates a platform-specific query string so that the column names can be fetched
public
| string | the table name |
Definition at line 348 of file sqlite_driver.php.
| CI_DB_sqlite_driver::_list_tables | ( | $ | prefix_limit = FALSE |
) |
List table query.
Generates a platform-specific query string so that the table names can be fetched
private
| boolean |
Definition at line 326 of file sqlite_driver.php.
00327 { 00328 $sql = "SELECT name from sqlite_master WHERE type='table'"; 00329 00330 if ($prefix_limit !== FALSE AND $this->dbprefix != '') 00331 { 00332 $sql .= " AND 'name' LIKE '".$this->dbprefix."%'"; 00333 } 00334 return $sql; 00335 }
| CI_DB_sqlite_driver::_prep_query | ( | $ | sql | ) |
Prep the query.
If needed, each database adapter can prep the query string
private called by execute()
| string | an SQL query |
Definition at line 164 of file sqlite_driver.php.
Referenced by _execute().

| CI_DB_sqlite_driver::_truncate | ( | $ | table | ) |
Truncate statement.
Generates a platform-specific truncate string from the supplied data If the database does not support the truncate() command This function maps to "DELETE FROM table"
public
| string | the table name |
Definition at line 516 of file sqlite_driver.php.
References _delete().
00517 { 00518 return $this->_delete($table); 00519 }

| CI_DB_sqlite_driver::_update | ( | $ | table, | |
| $ | values, | |||
| $ | where, | |||
| $ | orderby = array(), |
|||
| $ | limit = FALSE | |||
| ) |
Update statement.
Generates a platform-specific update string from the supplied data
public
| string | the table name | |
| array | the update data | |
| array | the where clause | |
| array | the orderby clause | |
| array | the limit clause |
Definition at line 482 of file sqlite_driver.php.
00483 { 00484 foreach($values as $key => $val) 00485 { 00486 $valstr[] = $key." = ".$val; 00487 } 00488 00489 $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; 00490 00491 $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; 00492 00493 $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); 00494 00495 $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; 00496 00497 $sql .= $orderby.$limit; 00498 00499 return $sql; 00500 }
| CI_DB_sqlite_driver::_version | ( | ) |
Version number query string.
public
Definition at line 133 of file sqlite_driver.php.
| CI_DB_sqlite_driver::affected_rows | ( | ) |
| CI_DB_sqlite_driver::count_all | ( | $ | table = '' |
) |
"Count All" query
Generates a platform-specific query string that counts all records in the specified database
public
| string |
Definition at line 301 of file sqlite_driver.php.
00302 { 00303 if ($table == '') 00304 return '0'; 00305 00306 $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); 00307 00308 if ($query->num_rows() == 0) 00309 return '0'; 00310 00311 $row = $query->row(); 00312 return $row->numrows; 00313 }
| CI_DB_sqlite_driver::db_connect | ( | ) |
Non-persistent database connection.
private called by the base class
Definition at line 54 of file sqlite_driver.php.
References log_message().
00055 { 00056 if ( ! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error)) 00057 { 00058 log_message('error', $error); 00059 00060 if ($this->db_debug) 00061 { 00062 $this->display_error($error, '', TRUE); 00063 } 00064 00065 return FALSE; 00066 } 00067 00068 return $conn_id; 00069 }

| CI_DB_sqlite_driver::db_pconnect | ( | ) |
Persistent database connection.
private called by the base class
Definition at line 79 of file sqlite_driver.php.
References log_message().
00080 { 00081 if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) 00082 { 00083 log_message('error', $error); 00084 00085 if ($this->db_debug) 00086 { 00087 $this->display_error($error, '', TRUE); 00088 } 00089 00090 return FALSE; 00091 } 00092 00093 return $conn_id; 00094 }

| CI_DB_sqlite_driver::db_select | ( | ) |
Select the database.
private called by the base class
Definition at line 104 of file sqlite_driver.php.
| CI_DB_sqlite_driver::db_set_charset | ( | $ | charset, | |
| $ | collation | |||
| ) |
Set client character set.
public
| string | ||
| string |
Definition at line 119 of file sqlite_driver.php.
| CI_DB_sqlite_driver::escape_str | ( | $ | str | ) |
Escape String.
public
| string |
Definition at line 258 of file sqlite_driver.php.
| CI_DB_sqlite_driver::insert_id | ( | ) |
| CI_DB_sqlite_driver::trans_begin | ( | $ | test_mode = FALSE |
) |
Begin Transaction.
public
Definition at line 177 of file sqlite_driver.php.
00178 { 00179 if ( ! $this->trans_enabled) 00180 { 00181 return TRUE; 00182 } 00183 00184 // When transactions are nested we only begin/commit/rollback the outermost ones 00185 if ($this->_trans_depth > 0) 00186 { 00187 return TRUE; 00188 } 00189 00190 // Reset the transaction failure flag. 00191 // If the $test_mode flag is set to TRUE transactions will be rolled back 00192 // even if the queries produce a successful result. 00193 $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; 00194 00195 $this->simple_query('BEGIN TRANSACTION'); 00196 return TRUE; 00197 }
| CI_DB_sqlite_driver::trans_commit | ( | ) |
Commit Transaction.
public
Definition at line 207 of file sqlite_driver.php.
00208 { 00209 if ( ! $this->trans_enabled) 00210 { 00211 return TRUE; 00212 } 00213 00214 // When transactions are nested we only begin/commit/rollback the outermost ones 00215 if ($this->_trans_depth > 0) 00216 { 00217 return TRUE; 00218 } 00219 00220 $this->simple_query('COMMIT'); 00221 return TRUE; 00222 }
| CI_DB_sqlite_driver::trans_rollback | ( | ) |
Rollback Transaction.
public
Definition at line 232 of file sqlite_driver.php.
00233 { 00234 if ( ! $this->trans_enabled) 00235 { 00236 return TRUE; 00237 } 00238 00239 // When transactions are nested we only begin/commit/rollback the outermost ones 00240 if ($this->_trans_depth > 0) 00241 { 00242 return TRUE; 00243 } 00244 00245 $this->simple_query('ROLLBACK'); 00246 return TRUE; 00247 }
| CI_DB_sqlite_driver::$_count_string = "SELECT COUNT(*) AS " |
The syntax to count rows is slightly different across different database engines, so this string appears in each driver and is used for the count_all() and count_all_results() functions.
Definition at line 45 of file sqlite_driver.php.
| CI_DB_sqlite_driver::$_escape_char = '' |
Definition at line 38 of file sqlite_driver.php.
| CI_DB_sqlite_driver::$_random_keyword = ' Random()' |
Definition at line 46 of file sqlite_driver.php.
| CI_DB_sqlite_driver::$dbdriver = 'sqlite' |
Definition at line 35 of file sqlite_driver.php.