Class Db

Description

TPLN Database Plugin

Located in /plugin/db/db.class.php (line 6)

Image
   |
   --Rss
      |
      --Mail
         |
         --Form
            |
            --Db
Variable Summary
 mixed $cons_query
 mixed $Count
 mixed $db
 mixed $DBLastError
 mixed $db_index
 mixed $First
 mixed $Last
 mixed $last_header
 mixed $NavColor
 mixed $NbResults
 mixed $PageCount
 mixed $PageNumber
 mixed $query_count
 mixed $req
 mixed $req_index
 mixed $T_first
 mixed $T_i
 mixed $T_id
 mixed $url
 mixed $url_var
Method Summary
 boolean applyPrivateVar ()
 boolean changeConnection (int $db_index)
 void changeQuery ( $req_index)
 int checkQuotes (int $value)
 boolean createFieldVars (array $path, array $fields)
 string date2Db (string $date)
 string db2Date (string $date)
 void dbClose ()
 void dbConnect ([string $db_type = ''], [string $host = ''], [string $login = ''], [string $password = ''], [string $base = ''], [string $port = ''], [boolean $new_connection = ''])
 boolean dbDelete (string $table, [string $where = ''])
 void dbError ( $err_no, [ $msg = ''], [ $exit = 1])
 array dbFetch ()
 array dbFetchArray ()
 array dbFetchAssoc ()
 void dbFreeResult ()
 void dbGetConnectionObject ([int $db_index = ''])
 array dbGetData ()
 string dbGetError ()
 string dbGetFieldName (int $field_no)
 array dbGetFields ()
 int dbGetMaxID (string $table, [string $ID = 'ID'])
 int dbGetOne ()
 int dbGetQueryID ()
 int dbGetQueryNb ()
 array dbGetTableList ()
 boolean dbInsert (string $table, array $arr, [array $exlude_fields = array()], [bool $return_last_id = false])
 boolean dbIsConnected ()
 int dbNumRows ()
 array dbProtection (array $array)
 boolean dbReplace (string $table, array $arr, [array $exlude_fields = array()])
 void dbSelect (string $sql, array $values)
 void dbSetConnectionID (int $db_index)
 void dbSetProtection (boolean $bool)
 void dbSetQueryID (int $req_index)
 boolean dbUpdate (string $table, array $arr, [string $where = ''], [array $exlude_fields = array()])
 boolean doQuery ( $sql, [ $FETCH_MODE = PDO::FETCH_BOTH], string $query, int $fetch_mode)
 void getConnectionID ()
 array getData ()
 array getDbList ()
 string getFieldName (int $field_no)
 array getFields ()
 int getMaxID (string $table, [string $ID = 'ID'])
 int getNumFields ()
 int getOne ()
 void getQueryID ()
 void getQueryNb ()
 int getRowsCount ()
 void getTableList ()
 void getTotalCount ()
 void parseDbField (string $bloc, [string $func = ''])
 void parseDbRow (string $bloc, [string $msg = ''], [string $func = ''])
 void rewriteUrl (string $patterns, string $replace)
 void setConnectionID ( $db_index)
 void setNavColor (string $color1, string $color2)
 void setQuery (string $query)
 void setQueryID ( $req_index)
 void setQueryLimit ()
 void setUrl (string $url)
 int showRecords (string $query, [int $nb_result_per_page = 0], [string $func_data = ''])
 void showRecordsOrderBy (array $fields, [array $img_dir = ''])
 string SRgetUrl ([string $t_pg = ''])
 int stripQuotes (int $value)
 void trtShowRecords (array $row, string $func_data)
 void urlAddVar (string $url_add)
Variables
mixed $breaker_name (line 1813)
mixed $cons_query = array() (line 16)
  • access: protected
mixed $Count = 0 (line 28)
  • access: protected
mixed $db = array() (line 11)
  • access: public
mixed $DBLastError = '' (line 13)
  • access: protected
mixed $dbProtectionMode = true (line 38)
  • access: protected
mixed $db_index = -1 (line 9)
  • access: public
mixed $First = 0 (line 30)
  • access: protected
mixed $header_count (line 1814)
mixed $Last = 0 (line 31)
  • access: protected
mixed $last_header (line 1812)
mixed $NavColor = '' (line 34)
  • access: protected
mixed $NavColorFirst = '' (line 17)
  • access: protected
mixed $NavColorSecond = '' (line 18)
  • access: protected
mixed $NbRecordPerPage = 0 (line 26)
  • access: protected
mixed $NbResults = 0 (line 27)
  • access: protected
mixed $OrderByFields = array() (line 35)
  • access: protected
mixed $OrderByImgsPath = '' (line 36)
  • access: protected
mixed $PageCount = 0 (line 33)
  • access: protected
mixed $PageNumber = 0 (line 32)
  • access: protected
mixed $query_count = 0 (line 14)
  • access: protected
mixed $req = array() (line 12)
  • access: protected
mixed $req_index = -1 (line 10)
  • access: public
mixed $T_first = 0 (line 29)
  • access: protected
mixed $T_i = 0 (line 1810)
mixed $T_id = 0 (line 1811)
mixed $url = '' (line 19)
  • access: protected
mixed $UrlRgxPatterns = '' (line 21)
  • access: protected
mixed $UrlRgxReplace = '' (line 22)
  • access: protected
mixed $url_var = '' (line 20)
  • access: protected
mixed $user_resulset = array() (line 23)
  • access: protected

Inherited Variables

Inherited from Form

Form::$captcha
Form::$captcha_max
Form::$custom_msg
Form::$error_display_mode
Form::$formErrorColor
Form::$formErrorLang
Form::$formInputHtmlEntitiesCharset
Form::$formInputProtectionException
Form::$formName
Form::$formXEntitiesPostDone
Form::$init
Form::$last_obj
Form::$msg_err
Form::$new_objects_name
Form::$objError
Form::$objErrorMsg
Form::$row_val

Inherited from Mail

Mail::$bcc
Mail::$body
Mail::$cc
Mail::$charset
Mail::$confirm
Mail::$files
Mail::$format
Mail::$from
Mail::$fromLabel
Mail::$mailErr
Mail::$replyTo
Mail::$subject
Mail::$to
Mail::$urgent

Inherited from Image

Image::$new_name
Image::$obj
Image::$path
Methods
applyPrivateVar (line 1215)
  • author: H2LSOFT
  • access: protected
boolean applyPrivateVar ()
changeConnection (line 101)

this method allows to change connection.

boolean changeConnection (int $db_index)
  • int $db_index
changeQuery (line 173)
  • author: H2LSOFT
  • see: dbsetQueryId
  • deprecated:
  • since: 2.2.5
  • access: public
void changeQuery ( $req_index)
  • $req_index
checkQuotes (line 268)

verify quotes

  • author: H2LSOFT
  • access: public
int checkQuotes (int $value)
  • int $value
createFieldVars (line 1441)

this method allows to create field variables

  • author: H2LSOFT
  • access: public
boolean createFieldVars (array $path, array $fields)
  • array $path
  • array $fields
date2Db (line 2012)

This method allows to convert a date in mysql format:

DD-MM-YYYY becomes YYYY-MM-DD DD-MM-YYYY HH:MM becomes YYYY-MM-DD HH:MM:SS

string date2Db (string $date)
  • string $date
db2Date (line 2044)

This method allows you to convert a date in mysql format to:

YYYY-MM-DD becomes DD-MM-YYYY YYYY-MM-DD HH:MM:SS becomes DD-MM-YYYY HH:MM

string db2Date (string $date)
  • string $date
dbClose (line 257)

method allows you to close database connection.

  • author: H2LSOFT
  • see: DbConnect()
  • access: public
void dbClose ()
dbConnect (line 55)

this method allows you to connect to your MySQL database.

  • author: H2LSOFT
  • access: public
void dbConnect ([string $db_type = ''], [string $host = ''], [string $login = ''], [string $password = ''], [string $base = ''], [string $port = ''], [boolean $new_connection = ''])
  • string $db_type
  • string $host
  • string $login
  • string $password
  • string $base
  • string $port
  • boolean $new_connection
dbDelete (line 631)

This method allows you to generate and execute delete query from an associative array.

  • author: H2LSOFT
  • since: 2.8
  • access: public
boolean dbDelete (string $table, [string $where = ''])
  • string $table
  • string $where
dbError (line 1893)
  • access: protected
void dbError ( $err_no, [ $msg = ''], [ $exit = 1])
  • $err_no
  • $msg
  • $exit
dbFetch (line 695)

allows to obtain in structured array form database query results.

It is different in the array created which has the fields as keys in the array.

The array depends by DoQuery() parameter by default associative array is created.

  • author: H2LSOFT
  • access: public
array dbFetch ()
dbFetchArray (line 714)

method allows to obtain as array form database query results.

  • author: H2LSOFT
  • see: DBFetch()
  • since: 2.8
  • access: public
array dbFetchArray ()
dbFetchAssoc (line 735)

allows to obtain in structured array form database query results.

It is different in the array created which has the fields as keys in the array.

  • author: H2LSOFT
  • since: 2.8
  • access: public
array dbFetchAssoc ()
dbFreeResult (line 752)

allows to release memory allocated for your server.

For example, you can to use this method after long treatments.

  • author: H2LSOFT
  • access: public
void dbFreeResult ()
dbGetConnectionID (line 163)

this method allows to change connection.

  • author: H2LSOFT
  • see: setConnectionId
  • since: 2.9
  • access: public
int dbGetConnectionID ()
dbGetConnectionObject (line 116)

return db connection object to share with framework

  • access: public
void dbGetConnectionObject ([int $db_index = ''])
  • int $db_index: dbIndex
dbGetData (line 789)

This method allows to get your recorset in one time

  • author: H2LSOFT
  • since: 2.8
  • access: public
array dbGetData ()
dbGetDatabaseList (line 946)

this method allows to obtain the database names of the server.

  • author: H2LSOFT
  • access: public
array dbGetDatabaseList ()
dbGetError (line 649)

This method returns the last SQL error

string dbGetError ()
dbGetFieldName (line 912)

allows to return the field name from the database query.

  • author: H2LSOFT
  • access: public
string dbGetFieldName (int $field_no)
  • int $field_no
dbGetFields (line 870)

this method allows to return the database query fields name.

  • author: H2LSOFT
  • access: public
array dbGetFields ()
dbGetMaxID (line 332)

This method returns the maximum value for a ID, it is useful to know the value of an id after an insertion in a table.

  • author: H2LSOFT
  • access: public
int dbGetMaxID (string $table, [string $ID = 'ID'])
  • string $table
  • string $ID: default ID
dbGetNumFields (line 847)

allows you to return the database query fields number

  • author: H2LSOFT
  • access: public
int dbGetNumFields ()
dbGetOne (line 818)

method allows to return the first result of a database query.

This method is useful for a count database query for exemple.

  • author: H2LSOFT
  • access: public
int dbGetOne ()
dbGetQueryID (line 247)

This method allows you to retriece the index of the current query.

  • author: H2LSOFT
  • see: setQueryId
  • since: 2.9
  • access: public
int dbGetQueryID ()
dbGetQueryNb (line 224)

This method allows to retriece the index of the current query.

int dbGetQueryNb ()
dbGetTableList (line 976)

this method allows to obtain arrays name of the database.

  • author: H2LSOFT
  • access: public
array dbGetTableList ()
dbInsert (line 393)

This method allows to generate and execute insert query from an associative array.

You can exlude some fields from your insert query

  • author: H2LSOFT
  • since: 2.8
  • access: public
boolean dbInsert (string $table, array $arr, [array $exlude_fields = array()], [bool $return_last_id = false])
  • string $table
  • array $arr
  • array $exlude_fields
  • bool $return_last_id
dbIsConnected (line 616)

This method allows to know if the database connection is active

  • author: H2LSOFT
  • since: 2.9.2
  • access: public
boolean dbIsConnected ()
dbNumRows (line 681)

this method allows to return database query results count.

  • author: H2LSOFT
  • since: 2.9
  • access: public
int dbNumRows ()
dbProtection (line 2085)

Protect data agains xss attack

  • since: 3.2
  • access: protected
array dbProtection (array $array)
  • array $array
dbReplace (line 540)

This method allows to generate and execute REPALCE query from an associative array.

You can exlude some fields from your update query, use * character to exclude a name generically mce*

will exclude all name in the array that begins with mce.

  • author: H2LSOFT
  • since: 2.9.1
  • access: public
boolean dbReplace (string $table, array $arr, [array $exlude_fields = array()])
  • string $table
  • array $arr
  • array $exlude_fields
dbSelect (line 602)

This method allows you to execute a query SELECT with parameters,

each parameter is protected. This method uses like the php function vsprintf

  • author: H2LSOFT
  • access: public
void dbSelect (string $sql, array $values)
  • string $sql
  • array $values
dbSetConnectionID (line 141)

method allows you to change connection.

void dbSetConnectionID (int $db_index)
  • int $db_index
dbSetProtection (line 2073)

Enable protection mode for input data recommended true

  • since: 3.2
  • access: public
void dbSetProtection (boolean $bool)
  • boolean $bool
dbSetQueryID (line 201)

This method allows to change queries resultset.

  • author: H2LSOFT
  • see: getQueryId
  • since: 2.2.5
  • access: public
void dbSetQueryID (int $req_index)
  • int $req_index
dbUpdate (line 472)

This method allows you to generate and execute update query from an associative array.

You can exlude some fields from your update query

  • author: H2LSOFT
  • since: 2.8, 2.9
  • access: public
boolean dbUpdate (string $table, array $arr, [string $where = ''], [array $exlude_fields = array()])
  • string $table
  • array $arr
  • string $where
  • array $exlude_fields
doQuery (line 350)

this method allows to execute database query.

If second parameter is filled, the array structure for data is different

  • author: H2LSOFT
  • since: 2.4, 2.8
  • access: public
boolean doQuery ( $sql, [ $FETCH_MODE = PDO::FETCH_BOTH], string $query, int $fetch_mode)
  • string $query
  • int $fetch_mode
  • $sql
  • $FETCH_MODE
getConnectionID (line 151)
  • author: H2LSOFT
  • see: dbGetConnectionId
  • deprecated:
  • since: 2.9
  • access: public
void getConnectionID ()
getData (line 770)

This method allows to get your recorset in one time

array getData ()
getDbList (line 924)

this method allows to obtain the database names of the server.

array getDbList ()
getFieldName (line 883)

allows to return the field name from your database query.

string getFieldName (int $field_no)
  • int $field_no
getFields (line 860)

this method allows to return the database query fields name.

array getFields ()
getMaxID (line 317)

This method returns the maximum value for a ID, it is useful to know the value of an id after an insertion in a table.

  • author: H2LSOFT
  • since: 2.5
  • access: public
int getMaxID (string $table, [string $ID = 'ID'])
  • string $table
  • string $ID
getNumFields (line 830)

this method allows to return the database query fields number.

int getNumFields ()
getOne (line 800)
int getOne ()
getQueryID (line 234)
  • author: H2LSOFT
  • see: dbGetQueryId
  • deprecated:
  • since: 2.9
  • access: public
void getQueryID ()
getQueryNb (line 211)
void getQueryNb ()
getRowsCount (line 662)

this method allows to return database query results count.

  • author: H2LSOFT
  • see: DBNumRows
  • deprecated:
  • access: public
int getRowsCount ()
getTableList (line 956)

this method allows to obtain arrays name of the database.

void getTableList ()
getTotalCount (line 1172)

en commentaire

  • author: H2LSOFT
  • access: protected
void getTotalCount ()
parseDbField (line 1965)

this method allows to parse all the variables of a block by the database query field returned values.

  • author: H2LSOFT
  • see: ParseDBField().
  • since: 2.3, 2.9
  • access: public
void parseDbField (string $bloc, [string $func = ''])
  • string $bloc
  • string $func
parseDbRow (line 1914)

this method allows to parse all the variables of a block by the database query returned values.

The parse_function is Parse() method parameter, you could add php methods inside this method.

  • author: H2LSOFT
  • access: public
void parseDbRow (string $bloc, [string $msg = ''], [string $func = ''])
  • string $bloc
  • string $msg
  • string $func
rewriteUrl (line 1150)

apply rewrite rule in URL

  • author: H2LSOFT
  • access: public
void rewriteUrl (string $patterns, string $replace)
  • string $patterns
  • string $replace
setConnectionID (line 129)
  • author: H2LSOFT
  • see: DbSetConnectionId().
  • deprecated:
  • since: 2.9
  • access: public
void setConnectionID ( $db_index)
  • $db_index
setNavColor (line 1162)

asign color alternation

  • author: H2LSOFT
  • access: public
void setNavColor (string $color1, string $color2)
  • string $color1
  • string $color2
setQuery (line 986)

en commentaire

  • author: H2LSOFT
  • access: protected
void setQuery (string $query)
  • string $query
setQueryID (line 189)
  • author: H2LSOFT
  • see: dbSetQueryId
  • deprecated:
  • since: 2.9
  • access: public
void setQueryID ( $req_index)
  • $req_index
setQueryLimit (line 1048)
  • author: H2LSOFT
  • access: protected
void setQueryLimit ()
setUrl (line 1419)

change URL

  • author: H2LSOFT
  • access: public
void setUrl (string $url)
  • string $url
showRecords (line 1535)

allows to parse automatically the datas from your databasse,

you have only to create your template and this method make all the tasks for you!

  • author: H2LSOFT
  • since: TPLN 1.5
  • access: public
int showRecords (string $query, [int $nb_result_per_page = 0], [string $func_data = ''])
  • string $query
  • int $nb_result_per_page
  • string $func_data
showRecordsOrderBy (line 1505)

This method will manage your filter automatically.

You have to put a preformatted variable in your template {_order_by::my_field}.

  • author: H2LSOFT
  • since: 2.8
  • access: public
void showRecordsOrderBy (array $fields, [array $img_dir = ''])
  • array $fields
  • array $img_dir
SRgetUrl (line 1135)

return the correct formatted url

  • author: H2LSOFT
  • access: protected
string SRgetUrl ([string $t_pg = ''])
  • string $t_pg
stripQuotes (line 294)

strip slashes

  • author: H2LSOFT
  • access: public
int stripQuotes (int $value)
  • int $value
trtShowRecords (line 1820)
  • author: H2LSOFT
  • access: protected
void trtShowRecords (array $row, string $func_data)
  • array $row
  • string $func_data
urlAddVar (line 1429)

add variable in URL

  • author: H2LSOFT
  • access: public
void urlAddVar (string $url_add)
  • string $url_add

Inherited Methods

Inherited From Form

 Form::addError()
 Form::alpha()
 Form::alphaNumeric()
 Form::autoVerifyCaptcha()
 Form::charLength()
 Form::date()
 Form::delCaptcha()
 Form::email()
 Form::equal()
 Form::errorCustom()
 Form::fileControl()
 Form::formGetTotalError()
 Form::formGetUserObjectName()
 Form::formInit()
 Form::formIsValid()
 Form::formParse()
 Form::formSetDisplayMode()
 Form::formSetLang()
 Form::formSetName()
 Form::formSetObjectNames()
 Form::formXEntities()
 Form::generateCaptcha()
 Form::getCaptcha()
 Form::getMessage()
 Form::imgControlHeight()
 Form::imgControlWidth()
 Form::imgStrictDimension()
 Form::inList()
 Form::isDate()
 Form::isEqual()
 Form::isInList()
 Form::maxLength()
 Form::minLength()
 Form::notEmpty()
 Form::onlyDigit()
 Form::onlyLetter()
 Form::regexControl()
 Form::rules()
 Form::setCaptchaMax()
 Form::setMessage()
 Form::url()

Inherited From Mail

 Mail::isMail()
 Mail::mailAttachFile()
 Mail::mailBCC()
 Mail::mailBody()
 Mail::mailCC()
 Mail::mailCharset()
 Mail::mailConfirm()
 Mail::mailError()
 Mail::mailFrom()
 Mail::mailReplyTo()
 Mail::mailSend()
 Mail::mailSubject()
 Mail::mailTo()
 Mail::mailUrgent()

Inherited From Rss

 Rss::rssWrite()

Inherited From Image

 Image::fileUpload()
 Image::imgThumbnail()
 Image::imgThumbnailSetOriginal()

Documentation generated on Sat, 06 Mar 2010 21:33:47 +0100 by phpDocumentor 1.4.3