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

Class: DB_sqlite

Source Location: /DB-1.6.2/DB/sqlite.php

Class Overview

PEAR
   |
   --DB_common
      |
      --DB_sqlite

Database independent query interface definition for the SQLite PECL extension.


Author(s):

Version:

  • $Id: sqlite.php,v 1.65 2004/04/07 04:56:58 danielc Exp $

Variables

Methods


Inherited Variables

Inherited Methods

Class: DB_common

DB_common::DB_common()
Constructor
DB_common::affectedRows()
Returns the affected rows of a query
DB_common::autoCommit()
enable automatic Commit
DB_common::autoExecute()
Automaticaly generate an insert or update query and call prepare() and execute() with it
DB_common::autoPrepare()
Automaticaly generate an insert or update query and pass it to prepare()
DB_common::buildManipSQL()
Make automaticaly an sql query for prepare()
DB_common::commit()
starts a Commit
DB_common::createSequence()
Creates a new sequence
DB_common::dropSequence()
Deletes a sequence
DB_common::errorCode()
Map native error codes to DB's portable ones
DB_common::errorMessage()
Map a DB error code to a textual message. This is actually just a wrapper for DB::errorMessage()
DB_common::errorNative()
Returns an errormessage, provides by the database
DB_common::escapeSimple()
Escape a string according to the current DBMS's standards
DB_common::execute()
Executes a DB statement prepared with prepare()
DB_common::executeMultiple()
This function does several execute() calls on the same statement handle
DB_common::freePrepared()
Free the resource used in a prepared query
DB_common::getAll()
Fetch all the rows returned from a query
DB_common::getAssoc()
Fetch the entire result set of a query and return it as an associative array using the first column as the key
DB_common::getCol()
Fetch a single column from a result set and return it as an indexed array
DB_common::getListOf()
list internal DB info valid values for $type are db dependent, often: databases, users, view, functions
DB_common::getOne()
Fetch the first column of the first row of data returned from a query
DB_common::getOption()
Returns the value of an option
DB_common::getRow()
Fetch the first row of data returned from a query
DB_common::getSpecialQuery()
Returns the query needed to get some backend info
DB_common::getTables()
DB_common::limitQuery()
Generates a limited query
DB_common::nextId()
Returns the next free id in a sequence
DB_common::numRows()
Returns the number of rows in a result object
DB_common::prepare()
Prepares a query for multiple execution with execute()
DB_common::provides()
Tell whether a DB implementation or its backend extension supports a given feature
DB_common::query()
Send a query to the database and return any results with a DB_result object
DB_common::quote()
DEPRECATED: Quotes a string so it can be safely used in a query
DB_common::quoteIdentifier()
Quote a string so it can be safely used as a table or column name
DB_common::quoteSmart()
Format input so it can be safely used in a query
DB_common::quoteString()
DEPRECATED: Quotes a string so it can be safely used within string delimiters in a query
DB_common::raiseError()
Communicate an error and invoke error callbacks, etc
DB_common::rollback()
starts a rollback
DB_common::setFetchMode()
Sets which fetch mode should be used by default on queries on this connection
DB_common::setOption()
Set run-time configuration options for PEAR DB
DB_common::tableInfo()
Returns information about a table or a result set

Class Details

[line 35]
Database independent query interface definition for the SQLite PECL extension.


[ Top ]


Class Variables

$connection =

[line 39]


Type:   mixed


[ Top ]

$dbsyntax =

[line 40]


Type:   mixed


[ Top ]

$phptype =

[line 40]


Type:   mixed
Overrides:   Array


[ Top ]

$prepare_tokens = array()

[line 41]


Type:   mixed
Overrides:   Array


[ Top ]

$prepare_types = array()

[line 42]


Type:   mixed
Overrides:   Array


[ Top ]



Method Detail

DB_sqlite (Constructor)   [line 58]

DB_sqlite DB_sqlite( )

Constructor for this class.

Error codes according to sqlite_exec. Error Codes specification is in the online manual.

This errorhandling based on sqlite_exec is not yet implemented.

  • Access: public

[ Top ]

affectedRows   [line 342]

number affectedRows( )

Gets the number of rows affected by a query.
  • Return: of rows affected by the last query

Overrides DB_common::affectedRows() (Returns the affected rows of a query)
[ Top ]

connect   [line 107]

int connect( $dsn $dsninfo, [$persistent $persistent = false])

Connect to a database represented by a file.
  • Return: DB_OK on success, a DB error on failure
  • Access: public

Parameters:

$dsn   $dsninfo   —  the data source name; the file is taken as database; "sqlite://root:@host/test.db?mode=0644"
$persistent   $persistent   —  (optional) whether the connection should be persistent

[ Top ]

createSequence   [line 429]

int createSequence( string $seq_name)

Creates a new sequence

Overrides DB_common::createSequence() (Creates a new sequence)

Parameters:

string   $seq_name   —  name of the new sequence

[ Top ]

disconnect   [line 163]

bool disconnect( )

Log out and disconnect from the database.
  • Return: true on success, false if not connected.
  • Todo: fix return values
  • Access: public

[ Top ]

dropSequence   [line 411]

int dropSequence( string $seq_name)

Deletes a sequence

Overrides DB_common::dropSequence() (Deletes a sequence)

Parameters:

string   $seq_name   —  name of the sequence to be deleted

[ Top ]

errorCode   [line 373]

integer errorCode( string $errormsg)

Determine PEAR::DB error code from the database's text error message.
  • Return: an error number from a DB error constant

Overrides DB_common::errorCode() (Map native error codes to DB's portable ones)

Parameters:

string   $errormsg   —  error message returned from the database

[ Top ]

errorNative   [line 359]

string errorNative( )

Get the native error string of the last error (if any) that occured on the current connection.

This is used to retrieve more meaningfull error messages DB_pgsql way since sqlite_last_error() does not provide adequate info.

  • Return: native SQLite error message

Overrides DB_common::errorNative() (Returns an errormessage, provides by the database)
[ Top ]

escapeSimple   [line 622]

string escapeSimple( string $str)

Escape a string according to the current DBMS's standards

In SQLite, this makes things safe for inserts/updates, but may cause problems when performing text comparisons against columns containing binary data. See the PHP manual for more info.


Overrides DB_common::escapeSimple() (Escape a string according to the current DBMS's standards)

Parameters:

string   $str   —  the string to be escaped

[ Top ]

freeResult   [line 290]

bool freeResult( $result &$result)

Free the internal resources associated with $result.
  • Return: true on success, false if $result is invalid
  • Access: public

Parameters:

$result   &$result   —  SQLite result identifier

[ Top ]

getDbFileStats   [line 583]

mixed getDbFileStats( [string $arg = ''])

Get the file stats for the current database.

Possible arguments are dev, ino, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, blocks or a numeric key between

  1. and 12.

  • Return: array on an unspecified key, integer on a passed arg and false at a stats error.

Parameters:

string   $arg   —  Array key for stats()

[ Top ]

getSpecialQuery   [line 504]

string getSpecialQuery( string $type, [ $args = array()])

Returns the query needed to get some backend info.

Refer to the online manual at http://sqlite.org/sqlite.html.

  • Return: The SQL query string

Overrides DB_common::getSpecialQuery() (Returns the query needed to get some backend info)

Parameters:

string   $type   —  What kind of info you want to retrieve
   $args   — 

[ Top ]

modifyLimitQuery   [line 629]

void modifyLimitQuery( $query, $from, $count, [ $params = array()])


Parameters:

   $query   — 
   $from   — 
   $count   — 
   $params   — 

[ Top ]

nextId   [line 464]

int nextId( string $seq_name, [boolean $ondemand = true])

Returns the next free id in a sequence
  • Return: the next id number in the sequence. DB_Error if problem.
  • See: DB_common::nextID()
  • Access: public

Overrides DB_common::nextId() (Returns the next free id in a sequence)

Parameters:

string   $seq_name   —  name of the sequence
boolean   $ondemand   —  when true, the seqence is automatically created if it does not exist

[ Top ]

nextResult   [line 221]

true nextResult( a $result)

Move the internal sqlite result pointer to the next available result.
  • Return: if a result is available otherwise return false
  • Access: public

Parameters:

a   $result   —  valid sqlite result resource

[ Top ]

numCols   [line 308]

number numCols( $result)

Gets the number of columns in a result set.
  • Return: of columns in a result set

Parameters:

   $result   — 

[ Top ]

numRows   [line 325]

number numRows( $result)

Gets the number of rows affected by a query.
  • Return: of rows affected by the last query

Overrides DB_common::numRows() (Returns the number of rows in a result object)

Parameters:

   $result   — 

[ Top ]

simpleQuery   [line 183]

mixed simpleQuery( the $query)

Send a query to SQLite and returns the results as a SQLite resource identifier.
  • Return: returns a valid SQLite result for successful SELECT queries, DB_OK for other successful queries. A DB error is returned on failure.
  • Access: public

Parameters:

the   $query   —  SQL query

[ Top ]

sqliteRaiseError   [line 671]

object DB sqliteRaiseError( [integer $errno = null])

Gather information about an error, then use that info to create a DB error object and finally return that object.

Parameters:

integer   $errno   —  PEAR error number (usually a DB constant) if manually raising an error

[ Top ]


Documentation generated on Mon, 11 Mar 2019 10:14:55 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.