[ PHPXref.com ] [ Generated: Sun Jul 20 19:56:00 2008 ] [ phpSQLiteAdmin 0.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> SPSQLite.class.php (summary)

(no description)

File Size: 1035 lines (22 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SPSQLite:: (39 methods):
  SPSQLite()
  setWaitingTime()
  turboMode()
  alterTable()
  _createColsQuery()
  _setTableInfo()
  getTableInfo()
  _setColsType()
  getColsType()
  encodeBinary()
  decodeBinary()
  optimizeDatabase()
  addFunction()
  query()
  returnRows()
  selectRows()
  _setType()
  lastInsertId()
  affectedRows()
  numRows()
  beginTransaction()
  commitTransaction()
  _rollbackTransaction()
  addQuery()
  escapeString()
  libEncoding()
  libVersion()
  classVersion()
  _showError()
  close()
  _filterName()
  _filterType()
  _filterTrim()
  _colsTypeCombine()
  listTables()
  getIndexesInfo()
  dbInfo()
  fetchArray()
  vacuum()


Class: SPSQLite  - X-Ref

Simple Power SQLite class: Class in PHP for easy SQLite operation.
Tested on PHP 4.3.3 (Win XP) - PHP5.0.0b2dev (Win XP).

SPSQLite($file, $persistent = false, $showError = true, $rememberType = true)   X-Ref
Set the properties $file, $persistent and $showMessage.
Connect to database.

param: string  $file            filename (the SQLite database)
param: bool    $persistent        true or false
param: bool    $showError        true or false
param: bool    $rememberType    true or false
return: void

setWaitingTime($milliseconds)   X-Ref
Set the waiting time to busy

param: int        $milliseconds    number of missiseconds
return: void

turboMode()   X-Ref
Increase the performance of SQLite

return: void

alterTable($tableName, $newDefinition, $sourceCols = null, $targetCols = null)   X-Ref
Alter the structure of table

param: string        $tablename        name of table
param: array        $newDefinition    array that it define a columns name and type.
param: array        $sourceCols        array that define a columns name of table source
param: array        $targetCols        array that define destination columns
return: void

_createColsQuery($colsDefinition, $onlyName = false)   X-Ref
This method create a fragment of query (process the array whith columns definition)

param: array        $colsfinition    array that it define a columns name or columns name and type
return: string

_setTableInfo($tablename)   X-Ref
This method set _tableInfo

param: string        $tablename    the name of table
return: void

getTableInfo($tablename, $type = '')   X-Ref
This method return an array of table info or a specific info

param: string        $tablename    the name of table
param: string        $type        specific the typo of information to obtain
return: array or string

_setColsType()   X-Ref
Set the array _colsType with columns information

return: void

getColsType($colname = '')   X-Ref
This method return an array with columns name and type of the current table

param: string        $colname    a specific column name
return: array or string

encodeBinary($file)   X-Ref
This method return encoded binary data

param: string        $file    name/path of file
return: string

decodeBinary($content)   X-Ref
This method return decoded binary data

param: string        $content    binary data
return: string

optimizeDatabase($indexOrTable)   X-Ref
Optimize dimension of database with the SQLite statemant VACUUM

param: string        $indexOrTable    an index of a name of table
return: void

addFunction($name, $originalFunction, $args)   X-Ref
This method expand the SQLite ability

The functions added with this method, can be used in the sql query.
The functgion of PHP, they can be called with the sintax:
php('functionName', param, param, ...)

param: string        $name                name of SQLite function
param: string        $originalFunction    name of the original funtion to call
param: int            $args                number of aguments
return: void

query($query, $buffer = true)   X-Ref
Submit a SQL query to database

param: string    $query        query SQL SQLite compatible        
param: bool    $buffer        true or false (If you only need sequential access to
return: bool

returnRows($type = null, $return_one_row = false)   X-Ref
Get rows !!

param: string    $type        'both', 'assoc' or 'num'
return: mixed

selectRows($index01, $index02 = null, $type = null)   X-Ref
Select a portion of rowset

param: int        $index01        first row number
param: int        $index02        last row number
param: string    $type            type of index
return: mixed

_setType($type)   X-Ref
This method set a type-index of the array rows

param: string        $type    'both', 'num' or 'assoc'
return: void

lastInsertId()   X-Ref
Return the last insert id (column declared INTEGER PRIMARY KEY )

return: int

affectedRows()   X-Ref
Return how many lines are changed

return: int

numRows($table = "")   X-Ref
Return the number of rows

return: int

beginTransaction()   X-Ref
Start transaction process

return: void

commitTransaction($stop = false)   X-Ref
Finish the transaction process

param: bool $stop        true or false, if $stop is true
return: void

_rollbackTransaction()   X-Ref
If a query fails in a transaction, this method it takes part

return: void

addQuery($query)   X-Ref
Add a query to transaction

param: string $query
return: void

escapeString($string)   X-Ref
Prepare a string with special characters

param: string $string
return: string

libEncoding()   X-Ref
The encoding of library

return: string

libVersion()   X-Ref
The version of library

return: string

classVersion()   X-Ref
The version of class

return: string

_showError($message = '')   X-Ref
Print the last error

param: string $message        the error message
return: void

close()   X-Ref
Close a connection to database

return: void

_filterName($col)   X-Ref
Accessory method

return: string

_filterType($col)   X-Ref
Accessory method

return: string

_filterTrim($col)   X-Ref
Accessory method

return: string

_colsTypeCombine($name, $type)   X-Ref
Accessory method

return: array

listTables()   X-Ref
No description

getIndexesInfo($tbl_name = "")   X-Ref
No description

dbInfo()   X-Ref
No description

fetchArray($type = 'num')   X-Ref
No description

vacuum()   X-Ref
No description



[ Powered by PHPXref - Served by Debian GNU/Linux ]