ActiveRecord_Connection extends PDO to provide some additional functionality required by ActiveRecord that may vary by database.
Per-database implementations may be provided by extending ActiveRecord_Connection or ActiveRecord_Connection_Default. Extensions are located by naming convention. A database-specific extension is expected to have the class name ActiveRecord_Connection_<Driver> where <Driver> is the name of the driver specified in the connection string with an initial capital letter (e.g. ActiveRecord_Connection_Oci for an OCI extension). If no database-specific extension is found, ActiveRecord_Connection_Default is used.
Located in /activerecord/lib/ActiveRecord/Connection.php (line 37)
PDO | --ActiveRecord_Connection
Class | Description |
---|---|
ActiveRecord_Connection_Default | Default implementation of ActiveRecord_Connection |
Factory-type method for creating a new ActiveRecord_Connection (this must be used instead of constructing a new instance).
Constructor
Do not call this method directly. Call create instead.
Append a LIMIT clause to a SQL statement
Return an array of ActiveRecordColumn objects for the named table.
Return the sequence name that would be used to generated the
next value for the named key on the given table. Even if this connection does not support sequences or the resulting sequence does not exist, the name of what that sequence would be is returned.
Returns the next value from the named sequence. This function throws ActiveRecord_SequencesNotSupportedError if the connection does not support sequences.
Used to test whether this connection uses sequences to generate
primary keys for the given table. If a new primary key value should be fetched prior to inserting a new record into the named table, true is returned. Otherwise false is returned, and the caller can assume it is safe to invoke lastInsertId following the execution of the insert statement.
Accepts a string or array containing an SQL statement or
fragment an performs parameter substitution. When a string is provided, it is returned verbatim, however, when an array is provide, is is assumed that the first item in the array is the SQL statement (or fragment) containing parameter placeholders (in the form of question marks) and that all subsequent items in the array are ordered parameters to be used for substituion.
For example, passing in the following:
Of course, this is actually more useful when passing in variables with unknown values as the parameters instead of literals, since sanitizeSQL handles any necessary escaping of the values.
Runs the select query provided in the $sql parameter, then fetches all rows into an array. Each individual row is fetched using the mode parameter provided.
For example, if you have a table named users containing the following:
Empty data sets return an empty array.
This is a convenience method for running select queries which
return a single row containing only a single column. This method runs the provided query and returns the value from the first column of the first row of the results. Any other values in the result set are discarded. Empty result sets return NULL.
Returns an array of table names in the database
Inherited From PDO (Internal Class)
constructor __construct ( $dsn, $username, $passwd, [$options = ] )
beginTransaction ( )
commit ( )
errorCode ( )
errorInfo ( )
exec ( $query )
getAttribute ( $attribute )
getAvailableDrivers ( )
inTransaction ( )
lastInsertId ( [$seqname = ] )
prepare ( $statment, [$options = ] )
query ( )
quote ( $string, [$paramtype = ] )
rollBack ( )
setAttribute ( $attribute, $value )
__sleep ( )
__wakeup ( )
Inherited from PDO (Internal Class)
ATTR_AUTOCOMMIT = 0
ATTR_CASE = 8
ATTR_CLIENT_VERSION = 5
ATTR_CONNECTION_STATUS = 7
ATTR_CURSOR = 10
ATTR_CURSOR_NAME = 9
ATTR_DEFAULT_FETCH_MODE = 19
ATTR_DRIVER_NAME = 16
ATTR_EMULATE_PREPARES = 20
ATTR_ERRMODE = 3
ATTR_FETCH_CATALOG_NAMES = 15
ATTR_FETCH_TABLE_NAMES = 14
ATTR_MAX_COLUMN_LEN = 18
ATTR_ORACLE_NULLS = 11
ATTR_PERSISTENT = 12
ATTR_PREFETCH = 1
ATTR_SERVER_INFO = 6
ATTR_SERVER_VERSION = 4
ATTR_STATEMENT_CLASS = 13
ATTR_STRINGIFY_FETCHES = 17
ATTR_TIMEOUT = 2
CASE_LOWER = 2
CASE_NATURAL = 0
CASE_UPPER = 1
CURSOR_FWDONLY = 0
CURSOR_SCROLL = 1
ERRMODE_EXCEPTION = 2
ERRMODE_SILENT = 0
ERRMODE_WARNING = 1
ERR_NONE = '00000'
FETCH_ASSOC = 2
FETCH_BOTH = 4
FETCH_BOUND = 6
FETCH_CLASS = 8
FETCH_CLASSTYPE = 262144
FETCH_COLUMN = 7
FETCH_FUNC = 10
FETCH_GROUP = 65536
FETCH_INTO = 9
FETCH_KEY_PAIR = 12
FETCH_LAZY = 1
FETCH_NAMED = 11
FETCH_NUM = 3
FETCH_OBJ = 5
FETCH_ORI_ABS = 4
FETCH_ORI_FIRST = 2
FETCH_ORI_LAST = 3
FETCH_ORI_NEXT = 0
FETCH_ORI_PRIOR = 1
FETCH_ORI_REL = 5
FETCH_PROPS_LATE = 1048576
FETCH_SERIALIZE = 524288
FETCH_UNIQUE = 196608
MYSQL_ATTR_DIRECT_QUERY = 1003
MYSQL_ATTR_FOUND_ROWS = 1004
MYSQL_ATTR_IGNORE_SPACE = 1005
MYSQL_ATTR_INIT_COMMAND = 1002
MYSQL_ATTR_LOCAL_INFILE = 1001
MYSQL_ATTR_SSL_CA = 1008
MYSQL_ATTR_SSL_CAPATH = 1009
MYSQL_ATTR_SSL_CERT = 1007
MYSQL_ATTR_SSL_CIPHER = 1010
MYSQL_ATTR_SSL_KEY = 1006
MYSQL_ATTR_USE_BUFFERED_QUERY = 1000
NULL_EMPTY_STRING = 1
NULL_NATURAL = 0
NULL_TO_STRING = 2
PARAM_BOOL = 5
PARAM_EVT_ALLOC = 0
PARAM_EVT_EXEC_POST = 3
PARAM_EVT_EXEC_PRE = 2
PARAM_EVT_FETCH_POST = 5
PARAM_EVT_FETCH_PRE = 4
PARAM_EVT_FREE = 1
PARAM_EVT_NORMALIZE = 6
PARAM_INPUT_OUTPUT = 2147483648
PARAM_INT = 1
PARAM_LOB = 3
PARAM_NULL = 0
PARAM_STMT = 4
PARAM_STR = 2
Documentation generated on Wed, 25 Apr 2012 09:46:42 -0700 by phpDocumentor 1.4.3