[ Index ]
 

Code source de PHP PEAR 1.4.5

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

title

Body

[fermer]

/DB/ -> mssql.php (sommaire)

The PEAR DB driver for PHP's mssql extension for interacting with Microsoft SQL Server databases PHP versions 4 and 5

Author: Sterling Hughes <sterling@php.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
Version: CVS: $Id: mssql.php,v 1.90 2007/01/12 05:16:22 aharvey Exp $
Poids: 963 lignes (29 kb)
Inclus ou requis:0 fois
Référencé: 3 fois
Nécessite: 1 fichier
 DB/common.php

Définit 1 class

DB_mssql:: (24 méthodes):
  DB_mssql()
  connect()
  disconnect()
  simpleQuery()
  nextResult()
  fetchInto()
  freeResult()
  numCols()
  numRows()
  autoCommit()
  commit()
  rollback()
  affectedRows()
  nextId()
  createSequence()
  dropSequence()
  quoteIdentifier()
  mssqlRaiseError()
  errorNative()
  errorCode()
  tableInfo()
  _mssql_field_flags()
  _add_flag()
  getSpecialQuery()


Classe: DB_mssql  - X-Ref

The methods PEAR DB uses to interact with PHP's mssql extension
for interacting with Microsoft SQL Server databases

These methods overload the ones declared in DB_common.

DB's mssql driver is only for Microsfoft SQL Server databases.

If you're connecting to a Sybase database, you MUST specify "sybase"
as the "phptype" in the DSN.

This class only works correctly if you have compiled PHP using
--with-mssql=[dir_to_FreeTDS].

DB_mssql()   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.

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

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

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

param: a valid fbsql result resource
return: 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.

autoCommit($onoff = false)   X-Ref
Enables or disables automatic commits

param: bool $onoff  true turns it on, false turns it off
return: int  DB_OK on success.  A DB_Error object if the driver

commit()   X-Ref
Commits the current transaction

return: int  DB_OK on success.  A DB_Error object on failure.

rollback()   X-Ref
Reverts the current transaction

return: int  DB_OK on success.  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.

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.

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.

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.

quoteIdentifier($str)   X-Ref
Quotes a string so it can be safely used as a table or column name

param: string $str  identifier name to be quoted
return: string  quoted identifier string

mssqlRaiseError($code = 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 code produced by the last query

return: int  the DBMS' error code

errorCode($nativecode = null, $msg = '')   X-Ref
Determines PEAR::DB error code from mssql's native codes.

If <var>$nativecode</var> isn't known yet, it will be looked up.

param: mixed  $nativecode  mssql error code, if known
return: integer  an error number from a DB error constant

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

NOTE: only supports 'table' and 'flags' if <var>$result</var>
is a table name.

param: object|string  $result  DB_result object from a query or a
param: int            $mode    a valid tableInfo mode
return: array  an associative array with the information requested.

_mssql_field_flags($table, $column)   X-Ref
Get a column's flags

Supports "not_null", "primary_key",
"auto_increment" (mssql identity), "timestamp" (mssql timestamp),
"unique_key" (mssql unique index, unique check or primary_key) and
"multiple_key" (multikey index)

mssql timestamp is NOT similar to the mysql timestamp so this is maybe
not useful at all - is the behaviour of mysql_field_flags that primary
keys are alway unique? is the interpretation of multiple_key correct?

author: Joern Barthel <j_barthel@web.de>
param: string $table   the table name
param: string $column  the field name
return: string  the flags

_add_flag(&$array, $value)   X-Ref
Adds a string to the flags array if the flag is not yet in there
- if there is no flag present the array is created

author: Joern Barthel <j_barthel@web.de>
param: array  &$array  the reference to the flag-array
param: string $value   the flag value
return: void

getSpecialQuery($type)   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
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