Xataface 2.0
Xataface Application Framework
Public Member Functions | Data Fields
Dataface_QueryBuilder Class Reference

Public Member Functions

 Dataface_QueryBuilder ($tablename, $query='')
 _opt ($code, $isText=true)
 search ($queryStr, $columns='', $queryParams=array(), $nolimit=false)
 select ($columns='', $query=array(), $nolimit=false, $tablename=null, $preview=false)
 select_num_rows ($query=array(), $tablename=null)
 update (&$record, $key_vals=null, $tablename=null)
 insert (&$record, $tablename=null)
 prepareValue ($fieldname, $value, $serialize=false)
 delete ($query=array(), $nolimit=false, $tablename=null)
 wc ($tablename, $colname)
 _fieldWhereClause (&$field, $value, &$use_where, $tableAlias=null)
 _where ($query=array(), $merge=true)
 _from ($tablename=null)
 _select ($columns='', $query=array(), $preview=false, $previewLen=null)
 _limit ($query=array(), $nolimit=false)
 _orderby ($query=array())
 _mysql_quote_idents ($matches)
 _match ($queryStr)
 omitBlobs ()
 includeBlobs ()
 addSecurityConstraint ($key, $value)
 addSecurityConstraints ($constraints)
 removeSecurityConstraint ($key)
 setSecurityConstraints ($constraints)
 _secure ($where)
 addRelatedRecord (&$relatedRecord, $sql=null)
 addExistingRelatedRecord (&$relatedRecord)
 tablename ($tablename=null)

Data Fields

 $_query
 $_tablename
 $_table
 $_fields
 $_mutableFields
 $_exactMatches = false
 $_omitBlobs = true
 $_omitPasswords = true
 $_security = array()
 $_serializer
 $errors = array()
 $selectMetaData = false
 $metadata = false
 $action = null

Detailed Description

Definition at line 39 of file QueryBuilder.php.


Member Function Documentation

_fieldWhereClause ( &$  field,
value,
&$  use_where,
tableAlias = null 
)

Definition at line 486 of file QueryBuilder.php.

_from ( tablename = null)

Returns the from clause for the SQL query. eg: FROM users

Definition at line 778 of file QueryBuilder.php.

_limit ( query = array(),
nolimit = false 
)

Returns the limit portion of the sql query. eg: LIMIT 1,2

Definition at line 902 of file QueryBuilder.php.

_match ( queryStr)

Generates a MATCH() clause to match against a full-text index.

Parameters:
$queryStrA boolean search string to search for. See MySQL full-text boolean searches for the syntax of this string. string
$tablesOptional array of table names from which to match array([Table name] => [Table alias])
$useIndexOnlyOptional parameter specifying if we should only match against columns with a full text index. If false then all char and text colums will be used in the search. boolean
Returns:
string Match clause for an SQL query.

Definition at line 974 of file QueryBuilder.php.

_mysql_quote_idents ( matches)

Definition at line 949 of file QueryBuilder.php.

_opt ( code,
isText = true 
)

Definition at line 159 of file QueryBuilder.php.

_orderby ( query = array())

Returns the ORDER BY clause of the SQL query.

Definition at line 933 of file QueryBuilder.php.

_secure ( where)

Definition at line 1052 of file QueryBuilder.php.

_select ( columns = '',
query = array(),
preview = false,
previewLen = null 
)

Returns the select portion of the sql query. eg: SELECT foo, bar

Parameters:
columnsAn option list of columns to select.

Definition at line 845 of file QueryBuilder.php.

_where ( query = array(),
merge = true 
)

Returns the where clause for the sql query. eg: WHERE foo = 'bar' and moo = 'cow'

Parameters:
fieldsTable fields that are used in the where clause

Definition at line 638 of file QueryBuilder.php.

addExistingRelatedRecord ( &$  relatedRecord)

Definition at line 1113 of file QueryBuilder.php.

addRelatedRecord ( &$  relatedRecord,
sql = null 
)

Returns an array of SQL statements that should be executed sequentially to add a related record.

Definition at line 1076 of file QueryBuilder.php.

addSecurityConstraint ( key,
value 
)

Definition at line 1032 of file QueryBuilder.php.

addSecurityConstraints ( constraints)

Definition at line 1038 of file QueryBuilder.php.

Dataface_QueryBuilder ( tablename,
query = '' 
)

Creates a new Dataface_QueryBuilder object.

Parameters:
tablenameThe name of the table to query.
tableReference to the table for the table.
queryAssociative array with keys = column names and values equal query values for that column.

Definition at line 130 of file QueryBuilder.php.

delete ( query = array(),
nolimit = false,
tablename = null 
)

Definition at line 445 of file QueryBuilder.php.

includeBlobs ( )

Definition at line 1027 of file QueryBuilder.php.

insert ( &$  record,
tablename = null 
)

Definition at line 367 of file QueryBuilder.php.

omitBlobs ( )

Definition at line 1022 of file QueryBuilder.php.

prepareValue ( fieldname,
value,
serialize = false 
)

Definition at line 430 of file QueryBuilder.php.

removeSecurityConstraint ( key)

Definition at line 1044 of file QueryBuilder.php.

search ( queryStr,
columns = '',
queryParams = array(),
nolimit = false 
)

Generates SQL to perform a full text search.

Parameters:
$queryStrA query string that can be used in an AGAINST clause of a MySQL full text search. Eg: 'foo bar', '+foo -bar', '"foo bar"' string
$columnsOptional array of column names to select. array(string)
$queryParamsAn array of query parameters. array([Paramname]->[Paramval])
$nolimitIndicate whether there should be no limit.
boolean
Returns:
string SQL query.

Definition at line 192 of file QueryBuilder.php.

select ( columns = '',
query = array(),
nolimit = false,
tablename = null,
preview = false 
)

Returns the select sql query as a string. eg: SELECT foo,bar from table1 where bar='1'

Parameters:
columnsAn optional list of columns to select.

Definition at line 215 of file QueryBuilder.php.

select_num_rows ( query = array(),
tablename = null 
)

Returns the sql query to find the number of rows of the select query. eg: SELECT COUNT(*) from foo where bar='1'

Definition at line 252 of file QueryBuilder.php.

setSecurityConstraints ( constraints)

Definition at line 1048 of file QueryBuilder.php.

tablename ( tablename = null)

Definition at line 1197 of file QueryBuilder.php.

update ( &$  record,
key_vals = null,
tablename = null 
)

Generates a string SQL statement to update the given record.

Parameters:
$recordReference to the Dataface_Record object to be updated.
$key_valsOptional override of key values to be used in the where clause. Alternatively, this method will use the key values from the record's snapshot in the where clause if this parameter is left out (or is null).

Definition at line 276 of file QueryBuilder.php.

wc ( tablename,
colname 
)

Definition at line 478 of file QueryBuilder.php.


Field Documentation

$_exactMatches = false

If true then queries will use '=' instead of 'LIKE' for matching.

Definition at line 72 of file QueryBuilder.php.

$_fields

Convenience array.. holds references to $_table->fields()

Definition at line 65 of file QueryBuilder.php.

$_mutableFields

Definition at line 67 of file QueryBuilder.php.

$_omitBlobs = true

If true we will omit blob columns from the result.

Definition at line 77 of file QueryBuilder.php.

$_omitPasswords = true

We usually don't want to be loading password fields.

Definition at line 82 of file QueryBuilder.php.

$_query

Associative array containing the query. Keys are column names to match. Values are column values. Keys beginning with hyphen are ignored in query and treated as special. Special keys. -skip : Skip the first N records. -limit : The max records to return.

Definition at line 50 of file QueryBuilder.php.

$_security = array()

Key-value pairs of column name - column value to be used as security limitations on select queries. These constraints are added automatically added to queries to hide rows from the user that he doesn't have access to. This should be seamless.

Definition at line 90 of file QueryBuilder.php.

$_serializer

Definition at line 93 of file QueryBuilder.php.

$_table

Dataface_Table . The table of the table to query.

Definition at line 60 of file QueryBuilder.php.

$_tablename

The name of the table to query.

Definition at line 55 of file QueryBuilder.php.

$action = null

Definition at line 117 of file QueryBuilder.php.

$errors = array()

Definition at line 95 of file QueryBuilder.php.

$metadata = false

Boolean flag indicating whether we should include metadatas in the queries.

Definition at line 108 of file QueryBuilder.php.

$selectMetaData = false

Definition at line 103 of file QueryBuilder.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations