Class: DB_QueryTool_Query
Source Location: /DB_QueryTool-1.0.2/QueryTool/Query.php
DB_QueryTool_Query class
Author(s):
Copyright:
- 2003-2006 Wolfram Kriesing, Paolo Panto, Lorenzo Alberton
|
|
|
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Method Detail
DB_QueryTool_Query (Constructor) [line 252]
DB_QueryTool_Query DB_QueryTool_Query(
[mixed
$dsn = false], [array
$options = array()])
|
|
Parameters:
add [line 633]
mixed add(
array
$newData)
|
|
add a new member in the DB
Parameters:
addHaving [line 1039]
void addHaving(
[string
$what = '*'], [string
$connectString = ' AND '])
|
|
Extend the current having clause. This is very useful, when you are building this clause from different places and don't want to overwrite the currently set having clause, but extend it.
Parameters:
addJoin [line 1201]
void addJoin(
string
$table, string
$where, [string
$type = 'default'])
|
|
adds a table and a where clause that shall be used for the join instead of calling setJoin(array(table1,table2),'<where clause1> AND <where clause2>') you can also call setJoin(table1,'<where clause1>') addJoin(table2,'<where clause2>') or where it makes more sense is to build a query which is made out of a left join and a standard join setLeftJoin(table1,'<where clause1>') // results in ... FROM $this->table LEFT JOIN table ON <where clause1> addJoin(table2,'<where clause2>') // results in ... FROM $this->table,table2 LEFT JOIN table ON <where clause1> WHERE <where clause2>
Parameters:
addLeftJoin [line 1111]
void addLeftJoin(
string
$table, string
$where, [string
$type = 'left'])
|
|
Parameters:
addMultiple [line 676]
mixed addMultiple(
array
$data)
|
|
adds multiple new members in the DB
Parameters:
addOrder [line 970]
void addOrder(
[string
$orderCondition = ''], [boolean
$desc = false])
|
|
Add a order parameter to the query.
Parameters:
addSelect [line 1308]
void addSelect(
[string
$what = '*'], [string
$connectString = ','])
|
|
add a string to the select part of the query add a string to the select-part of the query and connects it to an existing string using the $connectString, which by default is a comma. (SELECT xxx FROM - xxx is the select-part of a query)
Parameters:
addWhere [line 901]
void addWhere(
string
$where, [string
$condition = 'AND'])
|
|
only adds a string to the where clause
Parameters:
addWhereSearch [line 926]
void addWhereSearch(
string
$column, string
$string, [
$condition = 'AND'])
|
|
add a where-like clause which works like a search for the given string i.e. calling it like this: $this->addWhereSearch('name', 'otto hans') produces a where clause like this one LOWER(name) LIKE "%otto%hans%" so the search finds the given string
Parameters:
connect [line 289]
void connect(
mixed
$dsn, [array
$options = array()])
|
|
use this method if you want to connect manually
Parameters:
debug [line 1483]
void debug(
string
$string)
|
|
overwrite this method and i.e. print the query $string to see the final query
Parameters:
execute [line 2044]
boolean execute(
[string
$query = null], [
$method = 'getAll'])
|
|
Parameters:
get [line 350]
mixed get(
integer
$id, [string
$column = ''])
|
|
get the data of a single entry if the second parameter is only one column the result will be returned directly not as an array!
Parameters:
getAll [line 412]
mixed getAll(
[int
$from = 0], [int
$count = 0], [string
$method = 'getAll'])
|
|
get all entries from the DB for sorting use setOrder!!!, the last 2 parameters are deprecated
Parameters:
getCol [line 443]
mixed getCol(
[string
$column = null], [int
$from = 0], [int
$count = 0])
|
|
this method only returns one column, so the result will be a one dimensional array this does also mean that using setSelect() should be set to *one* column, the one you want to have returned a most common use case for this could be: $table->setSelect('id'); $ids = $table->getCol(); OR $ids = $table->getCol('id'); so ids will be an array with all the id's
Parameters:
getCount [line 471]
get the number of entries
getDbInstance [line 310]
reference &getDbInstance(
)
|
|
getDefaultValues [line 516]
array getDefaultValues(
)
|
|
return an empty element where all the array elements do already exist corresponding to the columns in the DB
getDontSelect [line 1346]
getEmptyElement [line 534]
getGroup [line 1274]
gets the group condition which is used for the current instance
getHaving [line 1023]
gets the having definition which is used for the current instance
getIndex [line 2253]
getJoin [line 1150]
array getJoin(
[string
$what = null])
|
|
gets the join-condition
Parameters:
getLimit [line 849]
getMultiple [line 381]
mixed getMultiple(
array
$ids, [string
$column = ''])
|
|
gets the data of the given ids
Parameters:
getOption [line 1411]
string getOption(
$option)
|
|
Parameters:
getOrder [line 991]
gets the order condition which is used for the current instance
getQueryString [line 547]
Render the current query and return it as a string.
getSelect [line 1324]
getTable [line 1240]
gets the table this class is currently working on
getTableShortName [line 1642]
string getTableShortName(
string
$table)
|
|
this method gets the short name for a table get the short name for a table, this is needed to properly build the 'AS' parts in the select query
Parameters:
getTableSpec [line 1668]
array getTableSpec(
[array
$shortNameIndexed = true], [boolean
$tables = array()])
|
|
gets the tableSpec either indexed by the short name or the name returns the array for the tables given as parameter or if no parameter given for all tables that exist in the tableSpec
Parameters:
getWhere [line 883]
gets the where condition which is used for the current instance
metadata [line 1504]
void metadata(
[
$table = ''])
|
|
!!!! query COPIED FROM db_oci8.inc - from PHPLIB !!!!
Parameters:
remove [line 723]
boolean remove(
mixed
$data, [string
$whereCol = ''])
|
|
removes a member from the DB
Parameters:
removeAll [line 761]
removeMultiple [line 779]
void removeMultiple(
array
$ids, [
$colName = ''])
|
|
remove the datasets with the given ids
Parameters:
removePrimary [line 810]
boolean removePrimary(
integer
$id, string
$colName, object just
$atLeastOneObject)
|
|
removes a member from the DB and calls the remove methods of the given objects so all rows in another table that refer to this table are erased too
Parameters:
reset [line 1362]
void reset(
[
$what = array()])
|
|
reset all the set* settings; with no parameter given, it resets them all
Parameters:
returnResult [line 2145]
mixed returnResult(
object reference
$result)
|
|
Return the chosen result type
Parameters:
save [line 576]
save data, calls either update or add if the primaryCol is given in the data this method knows that the data passed to it are meant to be updated (call 'update'), otherwise it will call the method 'add'. If you dont like this behaviour simply stick with the methods 'add' and 'update' and ignore this one here. This method is very useful when you have validation checks that have to be done for both adding and updating, then you can simply overwrite this method and do the checks in here, and both cases will be validated first.
Parameters:
setDbInstance [line 326]
void setDbInstance(
object a
&$dbh)
|
|
Setup using an existing connection. this also sets the DB_FETCHMODE_ASSOC since this class needs this to be set!
Parameters:
setDontSelect [line 1335]
void setDontSelect(
[string
$what = ''])
|
|
Parameters:
setErrorCallback [line 2298]
void setErrorCallback(
[string
$param = ''])
|
|
set both callbacks
Parameters:
setErrorLogCallback [line 2310]
void setErrorLogCallback(
[string
$param = ''])
|
|
Parameters:
setErrorSetCallback [line 2322]
void setErrorSetCallback(
[string
$param = ''])
|
|
Parameters:
setGroup [line 1256]
void setGroup(
[string
$group = ''])
|
|
sets the group-by condition
Parameters:
setHaving [line 1007]
void setHaving(
[string
$having = ''])
|
|
sets the having definition
Parameters:
setIndex [line 2223]
void setIndex(
[
$key = null])
|
|
format the result to be indexed by $key NOTE: be careful, when using this you should be aware, that if you use an index which's value appears multiple times you may loose data since a key cant exist multiple times!! the result for a result to be indexed by a key(=columnName) (i.e. 'relationtoMe') which's values are 'brother' and 'sister' or alike normally returns this: $res['brother'] = array('name'=>'xxx') $res['sister'] = array('name'=>'xxx') but if the column 'relationtoMe' contains multiple entries for 'brother' then the returned dataset will only contain one brother, since the value from the column 'relationtoMe' is used and which 'brother' you get depends on a lot of things, like the sortorder, how the db saves the data, and whatever else you can also set indexes which depend on 2 columns, simply pass the parameters like 'table1.id,table2.id' it will be used as a string for indexing the result and the index will be built using the 2 values given, so a possible index might be '1,2' or '2108,29389' this way you can access data which have 2 primary keys. Be sure to remember that the index is a string!
Parameters:
setJoin [line 1061]
void setJoin(
[mixed
$table = null], [string
$where = null], [
$joinType = 'default'])
|
|
sets a join-condition
Parameters:
setLeftJoin [line 1098]
void setLeftJoin(
[string
$table = null], [string
$where = null])
|
|
if you do a left join on $this->table you will get all entries from $this->table, also if there are no entries for them in the joined table if both parameters are not given the left-join will be removed NOTE: be sure to only use either a right or a left join
Parameters:
setLimit [line 834]
void setLimit(
[integer
$from = 0], [integer
$count = 0])
|
|
Parameters:
setOption [line 1400]
void setOption(
string
$option, mixed
$value)
|
|
set mode the class shall work in currently we have the modes: 'raw' does not quote the data before building the query
Parameters:
setOrder [line 953]
void setOrder(
[string
$orderCondition = ''], [boolean
$desc = false])
|
|
sets the order condition which is used for the current instance
Parameters:
setRightJoin [line 1135]
void setRightJoin(
[string
$table = null], [string
$where = null])
|
|
see setLeftJoin for further explaination on what a left/right join is NOTE: be sure to only use either a right or a left join
Parameters:
setSelect [line 1286]
void setSelect(
[string
$what = '*'])
|
|
limit the result to return only the columns given in $what
Parameters:
setTable [line 1224]
void setTable(
string
$table)
|
|
sets the table this class is currently working on
Parameters:
setWhere [line 865]
void setWhere(
[string
$whereCondition = ''])
|
|
sets the where condition which is used for the current instance
Parameters:
update [line 597]
mixed update(
array
$newData)
|
|
update the member data of a data set
Parameters:
useResult [line 2270]
void useResult(
[string
$type = 'array'])
|
|
Choose the type of the returned result
Parameters:
writeLog [line 2084]
void writeLog(
[
$text = 'START'])
|
|
Write events to the logfile. It does some additional work, like time measuring etc. to see some additional info
Parameters:
_buildGroup [line 1908]
string _buildGroup(
void
0)
|
|
Build the group-clause, replace 'column' by 'table.column'.
Parameters:
_buildHaving [line 1931]
_buildOrder [line 1886]
_buildSelect [line 1695]
string _buildSelect(
[string
$what = null])
|
|
build the 'SELECT <what> FROM ... 'for a select
Parameters:
_buildSelectQuery [line 1956]
void _buildSelectQuery(
[array
$query = array()], [boolean
$isCalledViaGetCount = false])
|
|
Parameters:
_checkColumns [line 1447]
void _checkColumns(
string
$newData, [integer
$method = 'unknown'])
|
|
checks if the columns which are given as the array's indexes really exist if not it will be unset anyway
Parameters:
_errorLog [line 2341]
void _errorLog(
string
$msg, [integer
$line = 'unknown'])
|
|
sets error log and adds additional info
Parameters:
_makeIndexed [line 2172]
mixed &_makeIndexed(
mixed
&$data)
|
|
Parameters:
Documentation generated on Mon, 11 Mar 2019 14:35:50 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|