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

Class: database

Source Location: /system/databases/mssql.class.php

Class Overview


This file is the mssql implementation of the Geeklog abstraction layer.


Variables

Methods



Class Details

[line 40]
This file is the mssql implementation of the Geeklog abstraction layer.

Unfortunately the Geeklog abstraction layer isn't 100% abstract because a few key functions use MySQL's REPLACE INTO syntax which is not a SQL standard. This issue will need to be resolved some time ...




[ Top ]


Class Variables

$_fastForwardRows = array()

[line 83]


Type:   mixed


[ Top ]

$_lastInsertID = array()

[line 82]


Type:   mixed


[ Top ]

$_NoArraylastInsertID = ''

[line 84]


Type:   mixed


[ Top ]

$_numberOfRowsAskedFor = array()

[line 81]


Type:   mixed


[ Top ]



Class Methods


constructor database [line 156]

database database( string $dbhost, string $dbname, sring $dbuser, $dbpass, [string $errorlogfn = ''], [string $charset = ''], string $pass)

constructor for database

This initializes an instance of the database object




Parameters:

string   $dbhost   Database host
string   $dbname   Name of database
sring   $dbuser   User to make connection as
string   $pass   Password for dbuser
string   $errorlogfn   Name of the errorlog function
string   $charset   character set to use
   $dbpass  

[ Top ]

method array_push_associative [line 1084]

void array_push_associative( &$arr)



Parameters:

   &$arr  

[ Top ]

method changeDESCRIBE [line 320]

void changeDESCRIBE( $sql)



Parameters:

   $sql  

[ Top ]

method cleanseSQL [line 229]

void cleanseSQL( $originalsql, [ $skipQuoteReplacement = 0])



Parameters:

   $originalsql  
   $skipQuoteReplacement  

[ Top ]

method cleanse_date_sub [line 1020]

string cleanse_date_sub( string $sql)

returns a sql string that has the pesky date_sub removed from it



Tags:

return:  return sql string


Parameters:

string   $sql   SQL that needs conversion

[ Top ]

method dbAffectedRows [line 920]

int dbAffectedRows( object $recordset)

Retrieves returns the number of effected rows for last query

Retrieves returns the number of effected rows for last query




Tags:

return:  Number of rows affected by last query


Parameters:

object   $recordset   The recordset to operate on

[ Top ]

method dbChange [line 650]

boolean dbChange( string $table, string $item_to_set, string $value_to_set, array|string $id, array|string $value, [boolean $supress_quotes = false])

Changes records in a table

This will change the data in the given table that meet the given criteria and will redirect user to another page if told to do so




Tags:

return:  Returns true on success otherwise false


Parameters:

string   $table   Table to perform change on
string   $item_to_set   field name of unique ID field for table
string   $value_to_set   Value for id
array|string   $id   additional field name used in where clause
array|string   $value   additional values used in where clause
boolean   $supress_quotes   if false it will not use '<value>' in where clause

[ Top ]

method dbCopy [line 775]

void dbCopy( $table, $fields, $values, $tablefrom, $id, $value)



Parameters:

   $table  
   $fields  
   $values  
   $tablefrom  
   $id  
   $value  

[ Top ]

method dbCount [line 711]

boolean dbCount( string $table, [array|string $id = ''], [array|string $value = ''])

Returns the number of records for a query that meets the given criteria

This will build a SELECT count(*) statement with the given criteria and return the result




Tags:

return:  returns count on success otherwise false


Parameters:

string   $table   Table to perform count on
array|string   $id   field name(s) of fields to use in where clause
array|string   $value   Value(s) to use in where clause

[ Top ]

method dbDelete [line 593]

boolean dbDelete( string $table, array|string $id, array|string $value)

Deletes data from the database

This will delete some data from the given table where id = value. If id and value are arrays then it will traverse the arrays setting $id[curval] = $value[curval].




Tags:

return:  Returns true on success otherwise false


Parameters:

string   $table   Table to delete data from
array|string   $id   field name(s) to include in where clause
array|string   $value   field value(s) corresponding to field names

[ Top ]

method dbError [line 987]

string dbError( [string $sql = ''])

this does not have any use in mssql. but kept here for reference returns a database error string

Returns an database error message




Tags:

return:  Text for error message


Parameters:

string   $sql   SQL that may have caused the error

[ Top ]

method dbFetchArray [line 936]

array dbFetchArray( object $recordset, [boolean $both = false])

Retrieves record from a recordset

Gets the next record in a recordset and returns in array




Tags:

return:  Returns data array of current row from recordset


Parameters:

object   $recordset   The recordset to operate on
boolean   $both   get both assoc and numeric indices

[ Top ]

method dbFieldName [line 906]

string dbFieldName( object $recordset, int $fnumber)

Retrieves returns the field name for a field

Returns the field name for a given field number




Tags:

return:  Returns name of specified field


Parameters:

object   $recordset   The recordset to operate on
int   $fnumber   field number to return the name of

[ Top ]

method dbGetVersion [line 1157]

string dbGetVersion( )



Tags:

return:  the version of the database application


[ Top ]

method dbInsertId [line 964]

int dbInsertId( [resource $link_identifier = ''], [ $sequence = ''])

Returns the last ID inserted

Returns the last auto_increment ID generated




Tags:

return:  

Returns last auto-generated ID

please note that this is a dangerous function to use without providing the proper resource identifier your code should ALWAYS call this function with its resource identifier otherwise you'll just pull off the last insertted ID which MAY or MAY NOT be the one from YOUR specific insert. You've been warned!



Parameters:

resource   $link_identifier   identifier for opened link
   $sequence  

[ Top ]

method dbLockTable [line 1113]

void dbLockTable( string $table)

Lock a table

Locks a table for write operations




Tags:



Parameters:

string   $table   Table to lock

[ Top ]

method dbNumFields [line 891]

int dbNumFields( object $recordset)

Retrieves the number of fields in a recordset

This returns the number of fields in a recordset




Tags:

return:  Returns number of rows from query


Parameters:

object   $recordset   The recordset to operate on

[ Top ]

method dbNumRows [line 825]

int dbNumRows( object $recordset)

Retrieves the number of rows in a recordset

This returns the number of rows in a recordset




Tags:

return:  Returns number of rows otherwise false (0)


Parameters:

object   $recordset   The recordset to operate one

[ Top ]

method dbQuery [line 354]

object Returns dbQuery( string $sql, [ $ignore_errors = 0], [ $skipQuoteReplacement = 0], boolean $ignore_error)

Executes a query on the server

This executes the passed SQL and returns the recordset or errors out




Tags:

return:  results of query


Parameters:

string   $sql   SQL to be executed
boolean   $ignore_error   If 1 this function supresses any error messages
   $ignore_errors  
   $skipQuoteReplacement  

[ Top ]

method dbResult [line 868]

(depends dbResult( object $recordset, int $row, [string $field = 0])

Returns the contents of one cell from a mssql result set



Tags:

return:  on field content)


Parameters:

object   $recordset   The recordset to operate on
int   $row   row to get data from
string   $field   field to return

[ Top ]

method dbSave [line 532]

void dbSave( string $table, string $fields, string $values)

Saves information to the database

This mimicks the Replace Into mysql call to save a record into the database




Parameters:

string   $table   The table to save to
string   $fields   string Comma demlimited list of fields to save
string   $values   Values to save to the database table

[ Top ]

method dbUnlockTable [line 1139]

void dbUnlockTable( string $table)

Unlock a table

Unlocks a table after a dbLockTable (actually, unlocks all tables)




Tags:



Parameters:

string   $table   Table to unlock (ignored)

[ Top ]

method isVerbose [line 205]

boolean isVerbose( )

Checks to see if debug mode is on

Returns value of $_verbose




Tags:

return:  true if in verbose mode otherwise false


[ Top ]

method setDisplayError [line 192]

void setDisplayError( boolean $flag)

Turns detailed error reporting on

If set to true, this will display detailed error messages on the site. Otherwise, it will only that state an error occurred without going into details. The complete error message (including the offending SQL request) is always available from error.log.




Parameters:

boolean   $flag   true or false

[ Top ]

method setErrorFunction [line 222]

void setErrorFunction( string $functionname)

Sets the function this class should call to log debug messages



Parameters:

string   $functionname   Function name

[ Top ]

method setVerbose [line 176]

void setVerbose( boolean $flag)

Turns debug mode on

Set this to true to see debug messages




Parameters:

boolean   $flag   true or false

[ Top ]


Documentation generated on Sat, 11 Feb 2012 02:08:38 -0500 by phpDocumentor 1.4.3