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

Class: MDB2_Driver_Datatype_Common

Source Location: /MDB2-2.0.0beta5/MDB2/Driver/Datatype/Common.php

Class Overview


MDB2_Driver_Common: Base class that is extended by each MDB2 driver


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 62]
MDB2_Driver_Common: Base class that is extended by each MDB2 driver


[ Top ]


Class Variables

$db_index =

[line 76]


Type:   mixed


[ Top ]

$lobs = array()

[line 83]

contains all LOB objects created with this MDB2 instance
  • Access: protected

Type:   array


[ Top ]

$valid_types = array(
        'text'      => true,
        'boolean'   => true,
        'integer'   => true,
        'decimal'   => true,
        'float'     => true,
        'date'      => true,
        'time'      => true,
        'timestamp' => true,
        'clob'      => true,
        'blob'      => true,
    )

[line 64]


Type:   mixed


[ Top ]



Method Detail

MDB2_Driver_Datatype_Common (Constructor)   [line 95]

MDB2_Driver_Datatype_Common MDB2_Driver_Datatype_Common( mixed $db_index)


[ Top ]

compareDefinition   [line 599]

array compareDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied
  • Return: containg all changes that will need to be applied
  • Access: public

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

convertResult   [line 200]

mixed convertResult( mixed $value, int $type)

convert a value to a RDBMS indepdenant MDB2 type
  • Return: converted value or a MDB2 error on failure
  • Access: public

Parameters:

mixed   $value     value to be converted
int   $type     constant that specifies which type to convert to

[ Top ]

convertResultRow   [line 220]

mixed convertResultRow( mixed $types, array $row, resource $result)

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

Parameters:

resource   $result     result identifier
array   $row     array with data

[ Top ]

destroyLOB   [line 1201]

void destroyLOB( resource $lob)

Free any resources allocated during the lifetime of the large object handler object.
  • Access: public

Parameters:

resource   $lob     stream handle

[ Top ]

getDeclaration   [line 254]

string getDeclaration( string $type, string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare of the given type
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Parameters:

string   $type     type to which the value should be converted to
string   $name     name the field to be declared.
string   $field     definition of the field

[ Top ]

implodeArray   [line 1242]

string implodeArray( array $array, [string $type = false])

apply a type to all values of an array and return as a comma seperated string useful for generating IN statements
  • Return: comma seperated values
  • Access: public

Parameters:

array   $array     data array
string   $type     determines type of the field

[ Top ]

quote   [line 825]

string quote( string $value, [string $type = null], [mixed $quote = true])

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: public

Parameters:

string   $value     text string value that is intended to be converted.
string   $type     type to which the value should be converted to

[ Top ]

setResultTypes   [line 123]

mixed setResultTypes( resource &$result, string $types)

Define the list of types to be associated with the columns of a given result set.

This function may be called before invoking fetchRow(), fetchOne() fetchCole() and fetchAll() so that the necessary data type conversions are performed on the data to be retrieved by them. If this function is not called, the type of all result set columns is assumed to be text, thus leading to not perform any conversions.

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

Parameters:

resource   $result     result identifier
string   $types     array variable that lists the data types to be expected in the result set columns. If this array contains less types than the number of columns that are returned in the result set, the remaining columns are assumed to be of the type text. Currently, the types clob and blob are not fully supported.

[ Top ]

writeLOBToFile   [line 1119]

mixed writeLOBToFile( resource $lob, string $file)

retrieve LOB from the database
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: protected

Parameters:

resource   $lob     stream handle
string   $file     name of the file into which the LOb should be fetched

[ Top ]

_baseConvertResult   [line 149]

object a _baseConvertResult( mixed $value, int $type)

general type conversion method
  • Return: MDB2 error on failure
  • Access: protected

Parameters:

mixed   $value     refernce to a value to be converted
int   $type     constant that specifies which type to convert to

[ Top ]

_compareBLOBDefinition   [line 711]

array _compareBLOBDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an BLOB field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_compareBooleanDefinition   [line 775]

array _compareBooleanDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an boolean field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_compareCLOBDefinition   [line 695]

array _compareCLOBDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an CLOB field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_compareDateDefinition   [line 727]

array _compareDateDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an date field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_compareDecimalDefinition   [line 807]

array _compareDecimalDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an decimal field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_compareFloatDefinition   [line 791]

array _compareFloatDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an float field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_compareIntegerDefinition   [line 649]

array _compareIntegerDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an integer field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_compareTextDefinition   [line 672]

array _compareTextDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an text field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_compareTimeDefinition   [line 743]

array _compareTimeDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an time field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_compareTimestampDefinition   [line 759]

array _compareTimestampDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied to an timestamp field
  • Return: containg all changes that will need to be applied
  • Access: protected

Parameters:

array   $current     new definition
array   $previous     old definition

[ Top ]

_endOfLOB   [line 1186]

mixed _endOfLOB( resource $lob)

Determine whether it was reached the end of the large object and therefore there is no more data to be read for the its input stream.
  • Return: true or false on success, a MDB2 error on failure
  • Access: protected

Parameters:

resource   $lob     stream handle

[ Top ]

_getBLOBDeclaration   [line 394]

string _getBLOBDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare an binary large object type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

length Integer value that determines the maximum length of the large object field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS.

notnull Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_getBooleanDeclaration   [line 424]

string _getBooleanDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare a boolean type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Boolean value to be used as default for this field.

notnullL Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_getCLOBDeclaration   [line 362]

string _getCLOBDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare an character large object type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

length Integer value that determines the maximum length of the large object field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS.

notnull Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_getDateDeclaration   [line 455]

string _getDateDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare a date type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Date value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_getDecimalDeclaration   [line 579]

string _getDecimalDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare a decimal type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Decimal value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_getFloatDeclaration   [line 548]

string _getFloatDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare a float type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Float value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_getIntegerDeclaration   [line 289]

string _getIntegerDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare an integer type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

unsigned Boolean flag that indicates whether the field should be declared as unsigned integer if possible.

default Integer value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_getTextDeclaration   [line 328]

string _getTextDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare an text type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

length Integer value that determines the maximum length of the text field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS.

default Text value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_getTimeDeclaration   [line 517]

string _getTimeDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare a time field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Time value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_getTimestampDeclaration   [line 486]

string _getTimestampDeclaration( string $name, array $field)

Obtain DBMS specific SQL code portion needed to declare a timestamp field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: protected

Parameters:

string   $name     name the field to be declared.
array   $field     

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Timestamp value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to null.


[ Top ]

_quoteBLOB   [line 1001]

string _quoteBLOB( $value $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

$value   $value     

[ Top ]

_quoteBoolean   [line 1018]

string _quoteBoolean( string $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

string   $value     text string value that is intended to be converted.

[ Top ]

_quoteCLOB   [line 984]

string _quoteCLOB( $value $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

$value   $value     

[ Top ]

_quoteDate   [line 1035]

string _quoteDate( string $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

string   $value     text string value that is intended to be converted.

[ Top ]

_quoteDecimal   [line 1103]

string _quoteDecimal( string $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

string   $value     text string value that is intended to be converted.

[ Top ]

_quoteFloat   [line 1086]

string _quoteFloat( string $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

string   $value     text string value that is intended to be converted.

[ Top ]

_quoteInteger   [line 893]

string _quoteInteger( string $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

string   $value     text string value that is intended to be converted.

[ Top ]

_quoteLOB   [line 966]

string _quoteLOB( $value $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

$value   $value     

[ Top ]

_quoteText   [line 910]

string _quoteText( string $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that already contains any DBMS specific escaped character sequences.
  • Access: protected

Parameters:

string   $value     text string value that is intended to be converted.

[ Top ]

_quoteTime   [line 1069]

string _quoteTime( string $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

string   $value     text string value that is intended to be converted.

[ Top ]

_quoteTimestamp   [line 1052]

string _quoteTimestamp( string $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

string   $value     text string value that is intended to be converted.

[ Top ]

_readFile   [line 928]

string _readFile( $value $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: protected

Parameters:

$value   $value     

[ Top ]

_readLOB   [line 1170]

mixed _readLOB( resource $lob, integer $length, string $data)

Read data from large object input stream.
  • Return: the effective number of bytes read from the large object input stream on sucess or an MDB2 error object.
  • See: endOfLOB()
  • Access: public

Parameters:

resource   $lob     stream handle
string   $data     reference to a variable that will hold data to be read from the large object input stream
integer   $length     value that indicates the largest ammount ofdata to be read from the large object input stream.

[ Top ]

_retrieveLOB   [line 1146]

mixed _retrieveLOB( resource &$lob)

retrieve LOB from the database
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: protected

Parameters:

resource   $lob     stream handle

[ Top ]


Documentation generated on Wed, 08 Jun 2005 09:30:23 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.