MDB2
[ class tree: MDB2 ] [ index: MDB2 ] [ all elements ]

Class: MDB2_Driver_sqlite

Source Location: /MDB2_Driver_sqlite-1.5.0b4/MDB2/Driver/sqlite.php

Class Overview

MDB2_Driver_Common
   |
   --MDB2_Driver_sqlite

MDB2 SQLite driver


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 56]
MDB2 SQLite driver


[ Top ]


Class Variables

$fix_assoc_fields_names =  false

[line 65]


Type:   mixed


[ Top ]

$identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"')

[line 61]


Type:   mixed


[ Top ]

$string_quoting = array('start' => "'", 'end' => "'", 'escape' => "'", 'escape_pattern' => false)

[line 59]


Type:   mixed


[ Top ]



Method Detail

__construct (Constructor)   [line 73]

MDB2_Driver_sqlite __construct( )

Constructor

[ Top ]

beginTransaction   [line 195]

mixed beginTransaction( [string $savepoint = null])

Start a transaction or set a savepoint.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $savepoint   —  name of a savepoint to set

[ Top ]

commit   [line 232]

mixed commit( [string $savepoint = null])

Commit the database changes done during a transaction that is in progress or release a savepoint. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after committing the pending changes.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $savepoint   —  name of a savepoint to release

[ Top ]

connect   [line 354]

true connect( )

Connect to the database
  • Return: on success, MDB2 Error Object on failure

[ Top ]

currID   [line 857]

mixed currID( string $seq_name)

Returns the current id of a sequence
  • Return: MDB2 Error Object or id
  • Access: public

Parameters:

string   $seq_name   —  name of the sequence

[ Top ]

databaseExists   [line 452]

mixed databaseExists( string $name)

check if given database name is exists?
  • Return: true/false on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $name   —  name of the database that should be checked

[ Top ]

disconnect   [line 471]

mixed disconnect( [boolean $force = true])

Log out and disconnect from the database.
  • Return: true on success, false if not connected and error object on error
  • Access: public

Parameters:

boolean   $force   —  if the disconnect should be forced even if the connection is opened persistently

[ Top ]

errorInfo   [line 121]

array errorInfo( [integer $error = null])

This method is used to collect information about an error
  • Access: public

Parameters:

integer   $error   — 

[ Top ]

escape   [line 178]

string escape( string $text, [bool $escape_wildcards = false])

Quotes a string so it can be safely used in a query. It will quote the text so it can safely be used within a query.
  • Return: quoted string
  • Access: public

Parameters:

string   $text   —  the input string to quote
bool   $escape_wildcards   —  escape wildcards

[ Top ]

getServerVersion   [line 629]

mixed getServerVersion( [bool $native = false])

return version information about the server
  • Return: array/string with version information or MDB2 error object
  • Access: public

Parameters:

bool   $native   —  determines if the raw version string should be returned

[ Top ]

lastInsertID   [line 833]

mixed lastInsertID( [string $table = null], [string $field = null])

Returns the autoincrement ID if supported or $id or fetches the current ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
  • Return: MDB2 Error Object or id
  • Access: public

Parameters:

string   $table   —  name of the table into which a new row was inserted
string   $field   —  name of the field into which a new row was inserted

[ Top ]

nextID   [line 787]

mixed nextID( string $seq_name, [boolean $ondemand = true])

Returns the next free id of a sequence
  • Return: MDB2 Error Object or id
  • Access: public

Parameters:

string   $seq_name   —  name of the sequence
boolean   $ondemand   —  when true the sequence is automatic created, if it not exists

[ Top ]

replace   [line 724]

mixed replace( string $table, array $fields)

Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT query, except that if there is already a row in the table with the same key field values, the old row is deleted before the new row is inserted.

The REPLACE type of query does not make part of the SQL standards. Since practically only SQLite implements it natively, this type of query is emulated through this method for other DBMS using standard types of queries inside a transaction to assure the atomicity of the operation.

  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $table   —  name of the table on which the REPLACE query will be executed.
array   $fields   — 

associative array that describes the fields and the values that will be inserted or updated in the specified table. The indexes of the array are the names of all the fields of the table. The values of the array are also associative arrays that describe the values and other properties of the table fields.

Here follows a list of field properties that need to be specified:

value: Value to be assigned to the specified field. This value may be of specified in database independent type format as this function can perform the necessary datatype conversions.

Default: this property is required unless the Null property is set to 1.

type Name of the type of the field. Currently, all types Metabase are supported except for clob and blob.

Default: no type conversion

null Boolean property that indicates that the value for this field should be set to null.

The default value for fields missing in INSERT queries may be specified the definition of a table. Often, the default value is already null, but since the REPLACE may be emulated using an UPDATE query, make sure that all fields of the table are listed in this function argument array.

Default: 0

key Boolean property that indicates that this field should be handled as a primary key or at least as part of the compound unique index of the table that will determine the row that will updated if it exists or inserted a new row otherwise.

This function will fail if no key field is specified or if the value of a key field is set to null because fields that are part of unique index they may not be null.

Default: 0


[ Top ]

rollback   [line 267]

mixed rollback( [string $savepoint = null])

Cancel any database changes done during a transaction or since a specific savepoint that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after canceling the pending changes.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $savepoint   —  name of a savepoint to rollback to

[ Top ]

setTransactionIsolation   [line 308]

mixed setTransactionIsolation( string $isolation, [array $options = array()])

Set the transacton isolation level.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Since: 2.1.1
  • Access: public

Parameters:

string   $isolation   —  standard isolation level READ UNCOMMITTED (allows dirty reads) READ COMMITTED (prevents dirty reads) REPEATABLE READ (prevents nonrepeatable reads) SERIALIZABLE (prevents phantom reads)
array   $options   —  some transaction options: 'wait' => 'WAIT' | 'NO WAIT' 'rw' => 'READ WRITE' | 'READ ONLY'

[ Top ]

_doQuery   [line 508]

result _doQuery( string $query, [boolean $is_manip = false], [resource $connection = null], [string $database_name = null])

Execute a query
  • Return: or error object
  • Access: protected

Parameters:

string   $query   —  query
boolean   $is_manip   —  if the query is a manipulation query
resource   $connection   — 
string   $database_name   — 

[ Top ]

_getDatabaseFile   [line 338]

string _getDatabaseFile( $database_name)

Builds the string with path+dbname+extension
  • Return: full database path+file
  • Access: protected

Parameters:

   $database_name   — 

[ Top ]

_modifyQuery   [line 595]

string _modifyQuery( string $query, boolean $is_manip, integer $limit, integer $offset)

Changes a query string for various DBMS specific reasons
  • Return: modified query
  • Access: protected

Parameters:

string   $query   —  query to modify
boolean   $is_manip   —  if it is a DML query
integer   $limit   —  limit the number of rows
integer   $offset   —  start reading from given offset

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:51:27 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.