SqliteAdapter
class SqliteAdapter extends Connection (View source)
Adapter for SQLite.
Constants
DATETIME_TRANSLATE_FORMAT |
The DateTime format to use when translating other DateTime-compatible objects. NOTE!: The DateTime "format" used must not include a time-zone (name, abbreviation, etc) or offset. Including one will cause PHP to ignore the passed in time-zone in the 3rd argument. See bug: https://bugs.php.net/bug.php?id=61022 |
Properties
mixed | $connection | The PDO connection object. | from Connection |
string | $last_query | The last query run. | from Connection |
string | $protocol | The name of the protocol that is used. | from Connection |
static string | $date_format | Database's date format | from Connection |
static | $datetime_format | ||
static array | $PDO_OPTIONS | Default PDO options to set for each connection. | from Connection |
static string | $QUOTE_CHARACTER | The quote character for stuff like column and field names. | from Connection |
static int | $DEFAULT_PORT | Default port. | from Connection |
Methods
Retrieve a database connection.
Use this for any adapters that can take connection info in the form below to set the adapters connection info.
Class Connection is a singleton. Access it via instance().
Retrieve the insert id of the last model saved.
Execute a raw SQL query on the database.
Execute a query that returns maximum of one row with one field and return it.
Return a default sequence name for the specified table.
Return SQL for getting the next value in a sequence.
Return a date time formatted into the database's datetime format.
Converts a string representation of a datetime into a DateTime object.
Adds a limit clause to the SQL query.
Query for column meta info and return statement handle.
Query for all tables in the current database. The result must only contain one column which has the name of the table.
Executes query to specify the character set for this connection.
No description
Specifies whether or not adapter can use LIMIT/ORDER clauses with DELETE & UPDATE operations
No description
Details
in Connection at line 102
static Connection
instance(string $connection_string_or_connection_name = null)
Retrieve a database connection.
in Connection at line 176
static object
parse_connection_url(string $connection_url)
Use this for any adapters that can take connection info in the form below to set the adapters connection info.
protocol://username:password@host[:port]/dbname
protocol://urlencoded%20username:urlencoded%20password@host[:port]/dbname?decode=true
protocol://username:password@unix(/some/file/path)/dbname
Sqlite has a special syntax, as it does not need a database name or user authentication:
sqlite://file.db
sqlite://../relative/path/to/file.db
sqlite://unix(/absolute/path/to/file.db)
sqlite://windows(c%2A/absolute/path/to/file.db)
at line 19
protected Connection
__construct(array $info)
Class Connection is a singleton. Access it via instance().
in Connection at line 272
array
columns(string $table)
Retrieves column meta data for the specified table.
in Connection at line 290
string
escape(string $string)
Escapes quotes in a string.
in Connection at line 301
int
insert_id(string $sequence = null)
Retrieve the insert id of the last model saved.
in Connection at line 313
mixed
query(string $sql, array $values = array())
Execute a raw SQL query on the database.
in Connection at line 348
string
query_and_fetch_one(string $sql, array $values = array())
Execute a query that returns maximum of one row with one field and return it.
in Connection at line 361
query_and_fetch(string $sql, Closure $handler)
Execute a raw SQL query and fetch the results.
in Connection at line 374
array
tables()
Returns all tables for the current database.
in Connection at line 388
transaction()
Starts a transaction.
in Connection at line 397
commit()
Commits the current transaction.
in Connection at line 406
rollback()
Rollback a transaction.
in Connection at line 417
boolean
supports_sequences()
Tells you if this adapter supports sequences or not.
in Connection at line 429
string
get_sequence_name(string $table, string $column_name)
Return a default sequence name for the specified table.
in Connection at line 440
string
next_sequence_value(string $sequence_name)
Return SQL for getting the next value in a sequence.
in Connection at line 451
string
quote_name(string $string)
Quote a name like table names and field names.
in Connection at line 463
string
date_to_string(DateTime $datetime)
Return a date time formatted into the database's date format.
in Connection at line 474
string
datetime_to_string(DateTime $datetime)
Return a date time formatted into the database's datetime format.
in Connection at line 485
object
string_to_datetime(string $string)
Converts a string representation of a datetime into a DateTime object.
at line 27
string
limit(string $sql, int $offset, int $limit)
Adds a limit clause to the SQL query.
at line 34
PDOStatement
query_column_info(string $table)
Query for column meta info and return statement handle.
at line 39
PDOStatement
query_for_tables()
Query for all tables in the current database. The result must only contain one column which has the name of the table.
at line 87
set_encoding($charset)
Executes query to specify the character set for this connection.
at line 94
native_database_types()
at line 92
accepts_limit_and_order_for_update_and_delete()
Specifies whether or not adapter can use LIMIT/ORDER clauses with DELETE & UPDATE operations