| Amiro.CMS API Reference [beta] (available from v5.10) | Amiro.Ru / Manual |
|
Packages:
DB Debug Driver_PaymentSystem Environment Library Module ModuleComponent Module_Articles Module_Blog Module_Catalog Module_FAQ Module_FAQCat Module_Files Module_KnowledgeBase Module_News Module_Pages Module_PhotoGallery Module_Portfolio Module_Sample Module_Search Module_SearchHistory Module_Stickers Module_Users Plugin Plugin_AJAXResponder Plugin_Sample Service Template
Interfaces:
|
The DB_Query class• IntroductionDatabase query constructor. • Class synopsis
DB_Query
{
/* Methods */
// Returns INSERT query.
public
static
getInsertQuery ( string $table, $aRecord, [ bool $lowPriority = false ] ) returns DB_Snippet;
// Returns REPLACE query.
public
static
getReplaceQuery ( string $table, $aRecord, [ bool $lowPriority = false ] ) returns DB_Snippet;
// Returns query template object.
// Returns UPDATE query.
public
static
getUpdateQuery ( string $table, $aRecord, [ DB_Stniplet|string $condition = '' ], [ bool $lowPriority = false ] ) returns DB_Snippet;
// Constructor.
// Adds expression to selection.
// Adds field to SELECT query.
// Adds several fields.
public
addFields ( $aNames, [ string $prefix = '' ], [ string $aliasPrefix = '' ] ) returns DB_Query;
// Adds grouping.
// Adds having definition.
// Adds joined table.
public
addJoinedTable ( string $name, string $alias, string $joinCondition, [ string $joinType = 'LEFT JOIN' ] ) returns DB_Query;
// Adds order.
// Adds where definition.
// Returns query string.
// Returns fields as array.
// Returns fields as string.
// Returns main table name.
// Returns main table name.
// Resets field list.
// Sets having definition.
// Sets limit parameters.
// Sets main table alias.
// Sets main table name.
// Sets SELECT query prefix.
// Sets where definition.
// Converts object to query string.
}
• Class DetailsContains functionality to construct SELECT, INSERT and UPDATE queries. Tags:
• Class Methods// Returns INSERT query.
public
static
getInsertQuery ( string $table, $aRecord, [ bool $lowPriority = false ] ) returns DB_Snippet;
Example:
INSERT INTO visit
(`date`,`id_user`,`id_page`,`ip`)
VALUES
(NOW(),'1','2',INET_ATON('192.168.0.1'))// Returns REPLACE query.
public
static
getReplaceQuery ( string $table, $aRecord, [ bool $lowPriority = false ] ) returns DB_Snippet;
Tags:
// Returns query template object.
Tags:
// Returns UPDATE query.
public
static
getUpdateQuery ( string $table, $aRecord, [ DB_Stniplet|string $condition = '' ], [ bool $lowPriority = false ] ) returns DB_Snippet;
Example:
UPDATE ami_sample_plugin
SET `name`=name + '...', `about`=name + ' + about'
WHERE id IN ('1','2','3','4')// Constructor.
// Adds expression to selection.
Expression cannot contain any quotes. Use DB_Query::getSnippet() to pass complex data. Example:
// Adds field to SELECT query.
Example:
// Adds several fields.
Example:
Tags:
// Adds grouping.
Expression cannot contain any quotes. Use DB_Query::getSnippet() to pass complex data. Affects "GROUP BY" query snippet.
// Adds having definition.
Expression cannot contain any quotes. Use DB_Query::getSnippet() to pass complex data. Example:
// Adds joined table.
public
addJoinedTable ( string $name, string $alias, string $joinCondition, [ string $joinType = 'LEFT JOIN' ] ) returns DB_Query;
Example:
// Adds order.
// Adds where definition.
Expression cannot contain any quotes. Use DB_Query::getSnippet() to pass complex data. Example:
// Returns query string.
// Returns fields as array.
// Returns fields as string.
// Returns main table name.
// Returns main table name.
// Resets field list.
// Sets having definition.
Expression cannot contain any quotes. Use DB_Query::getSnippet() to pass complex data. Example:
// Sets limit parameters.
// Sets main table alias.
// Sets main table name.
// Sets where definition.
Expression cannot contain any quotes. Use DB_Query::getSnippet() to pass complex data. Example:
// Converts object to query string.
Tags:
|