[ Index ]
 

Code source de PHP PEAR 1.4.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/DB/ -> sqlite.php (sommaire)

The PEAR DB driver for PHP's sqlite extension for interacting with SQLite databases PHP versions 4 and 5

Author: Urs Gehrig <urs@circle.ch>
Author: Mika Tuupola <tuupola@appelsiini.net>
Author: Daniel Convissor <danielc@php.net>
Copyright: 1997-2005 The PHP Group
License: http://www.php.net/license/3_0.txt PHP License 3.0 3.0
Version: CVS: $Id: sqlite.php,v 1.114 2007/01/12 02:41:07 aharvey Exp $
Poids: 949 lignes (30 kb)
Inclus ou requis:0 fois
Référencé: 3 fois
Nécessite: 1 fichier
 DB/common.php

Définit 1 class

DB_sqlite:: (22 méthodes):
  DB_sqlite()
  connect()
  disconnect()
  simpleQuery()
  nextResult()
  fetchInto()
  freeResult()
  numCols()
  numRows()
  affectedRows()
  dropSequence()
  createSequence()
  nextId()
  getDbFileStats()
  escapeSimple()
  modifyLimitQuery()
  modifyQuery()
  sqliteRaiseError()
  errorNative()
  errorCode()
  tableInfo()
  getSpecialQuery()


Classe: DB_sqlite  - X-Ref

The methods PEAR DB uses to interact with PHP's sqlite extension
for interacting with SQLite databases

These methods overload the ones declared in DB_common.

NOTICE:  This driver needs PHP's track_errors ini setting to be on.
It is automatically turned on when connecting to the database.
Make sure your scripts don't turn it off.

DB_sqlite()   X-Ref
This constructor calls <kbd>$this->DB_common()</kbd>

return: void

connect($dsn, $persistent = false)   X-Ref
Connect to the database server, log in and open the database

Don't call this method directly.  Use DB::connect() instead.

PEAR DB's sqlite driver supports the following extra DSN options:
+ mode  The permissions for the database file, in four digit
chmod octal format (eg "0600").

Example of connecting to a database in read-only mode:
<code>
require_once 'DB.php';

$dsn = 'sqlite:///path/and/name/of/db/file?mode=0400';
$options = array(
'portability' => DB_PORTABILITY_ALL,
);

$db =& DB::connect($dsn, $options);
if (PEAR::isError($db)) {
die($db->getMessage());
}
</code>

param: array $dsn         the data source name
param: bool  $persistent  should the connection be persistent?
return: int  DB_OK on success. A DB_Error object on failure.

disconnect()   X-Ref
Disconnects from the database server

return: bool  TRUE on success, FALSE on failure

simpleQuery($query)   X-Ref
Sends a query to the database server

NOTICE:  This method needs PHP's track_errors ini setting to be on.
It is automatically turned on when connecting to the database.
Make sure your scripts don't turn it off.

param: string  the SQL query string
return: mixed  + a PHP result resrouce for successful SELECT queries

nextResult($result)   X-Ref
Move the internal sqlite result pointer to the next available result

param: resource $result  the valid sqlite result resource
return: bool  true if a result is available otherwise return false

fetchInto($result, &$arr, $fetchmode, $rownum = null)   X-Ref
Places a row from the result set into the given array

Formating of the array and the data therein are configurable.
See DB_result::fetchInto() for more information.

This method is not meant to be called directly.  Use
DB_result::fetchInto() instead.  It can't be declared "protected"
because DB_result is a separate object.

param: resource $result    the query result resource
param: array    $arr       the referenced array to put the data in
param: int      $fetchmode how the resulting array should be indexed
param: int      $rownum    the row number to fetch (0 = first row)
return: mixed  DB_OK on success, NULL when the end of a result set is

freeResult(&$result)   X-Ref
Deletes the result set and frees the memory occupied by the result set

This method is not meant to be called directly.  Use
DB_result::free() instead.  It can't be declared "protected"
because DB_result is a separate object.

param: resource $result  PHP's query result resource
return: bool  TRUE on success, FALSE if $result is invalid

numCols($result)   X-Ref
Gets the number of columns in a result set

This method is not meant to be called directly.  Use
DB_result::numCols() instead.  It can't be declared "protected"
because DB_result is a separate object.

param: resource $result  PHP's query result resource
return: int  the number of columns.  A DB_Error object on failure.

numRows($result)   X-Ref
Gets the number of rows in a result set

This method is not meant to be called directly.  Use
DB_result::numRows() instead.  It can't be declared "protected"
because DB_result is a separate object.

param: resource $result  PHP's query result resource
return: int  the number of rows.  A DB_Error object on failure.

affectedRows()   X-Ref
Determines the number of rows affected by a data maniuplation query

0 is returned for queries that don't manipulate data.

return: int  the number of rows.  A DB_Error object on failure.

dropSequence($seq_name)   X-Ref
Deletes a sequence

param: string $seq_name  name of the sequence to be deleted
return: int  DB_OK on success.  A DB_Error object on failure.

createSequence($seq_name)   X-Ref
Creates a new sequence

param: string $seq_name  name of the new sequence
return: int  DB_OK on success.  A DB_Error object on failure.

nextId($seq_name, $ondemand = true)   X-Ref
Returns the next free id in a sequence

param: string  $seq_name  name of the sequence
param: boolean $ondemand  when true, the seqence is automatically
return: int  the next id number in the sequence.

getDbFileStats($arg = '')   X-Ref
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
0 and 12.

param: string $arg  the array key for stats()
return: mixed  an array on an unspecified key, integer on a passed

escapeSimple($str)   X-Ref
Escapes 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
{@link http://php.net/sqlite_escape_string PHP manual} for more info.

param: string $str  the string to be escaped
return: string  the escaped string

modifyLimitQuery($query, $from, $count, $params = array()   X-Ref
Adds LIMIT clauses to a query string according to current DBMS standards

param: string $query   the query to modify
param: int    $from    the row to start to fetching (0 = the first row)
param: int    $count   the numbers of rows to fetch
param: mixed  $params  array, string or numeric data to be used in
return: string  the query string with LIMIT clauses added

modifyQuery($query)   X-Ref
Changes a query string for various DBMS specific reasons

This little hack lets you know how many rows were deleted
when running a "DELETE FROM table" query.  Only implemented
if the DB_PORTABILITY_DELETE_COUNT portability option is on.

param: string $query  the query string to modify
return: string  the modified query string

sqliteRaiseError($errno = null)   X-Ref
Produces a DB_Error object regarding the current problem

param: int $errno  if the error is being manually raised pass a
return: object  the DB_Error object

errorNative()   X-Ref
Gets the DBMS' native error message produced by the last query

{@internal This is used to retrieve more meaningfull error messages
because sqlite_last_error() does not provide adequate info.}}

return: string  the DBMS' error message

errorCode($errormsg)   X-Ref
Determines PEAR::DB error code from the database's text error message

param: string $errormsg  the error message returned from the database
return: integer  the DB error number

tableInfo($result, $mode = null)   X-Ref
Returns information about a table

param: string         $result  a string containing the name of a table
param: int            $mode    a valid tableInfo mode
return: array  an associative array with the information requested.

getSpecialQuery($type, $args = array()   X-Ref
Obtains the query string needed for listing a given type of objects

param: string $type  the kind of objects you want to retrieve
param: array  $args  SQLITE DRIVER ONLY: a private array of arguments
return: string  the SQL query string or null if the driver doesn't



Généré le : Sun Feb 25 14:08:00 2007 par Balluche grâce à PHPXref 0.7