本文整理汇总了PHP中QQCondition类的典型用法代码示例。如果您正苦于以下问题:PHP QQCondition类的具体用法?PHP QQCondition怎么用?PHP QQCondition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QQCondition类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: BuildQueryStatement
/**
* Internally called method to assist with calling Qcodo Query for this class
* on load methods.
* @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
* @param QQCondition $objConditions any conditions on the query, itself
* @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
* @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
* @param boolean $blnCountOnly only select a rowcount
* @return string the query statement
*/
protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly)
{
// Get the Database Object for this Class
$objDatabase = SkuDateQtyHistory::GetDatabase();
// Create/Build out the QueryBuilder object with InventoryLocation-specific SELET and FROM fields
$objQueryBuilder = new QQueryBuilder($objDatabase, 'sku_date_qty_history');
SkuDateQtyHistory::GetSelectFields($objQueryBuilder);
$objQueryBuilder->AddFromItem('`sku_date_qty_history` AS `sku_date_qty_history`');
// Set "CountOnly" option (if applicable)
if ($blnCountOnly) {
$objQueryBuilder->SetCountOnlyFlag();
}
// Apply Any Conditions
if ($objConditions) {
$objConditions->UpdateQueryBuilder($objQueryBuilder);
}
// Iterate through all the Optional Clauses (if any) and perform accordingly
if ($objOptionalClauses) {
if (!is_array($objOptionalClauses)) {
throw new QCallerException('Optional Clauses must be a QQ::Clause() or an array of QQClause objects');
}
foreach ($objOptionalClauses as $objClause) {
$objClause->UpdateQueryBuilder($objQueryBuilder);
}
}
// Get the SQL Statement
$strQuery = $objQueryBuilder->GetStatement();
//var_dump($strQuery);
// Prepare the Statement with the Query Parameters (if applicable)
if ($mixParameterArray) {
if (is_array($mixParameterArray)) {
if (count($mixParameterArray)) {
$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
}
// Ensure that there are no other Unresolved Named Parameters
if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false) {
throw new QCallerException('Unresolved named parameters in the query');
}
} else {
throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
}
}
// Return the Objects
return $strQuery;
}
开发者ID:heshuai64,项目名称:einv2,代码行数:55,代码来源:SkuDateQtyHistoryGen.class.php
示例2: BuildQueryStatement
/**
* Internally called method to assist with calling Qcodo Query for this class
* on load methods.
* @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
* @param QQCondition $objConditions any conditions on the query, itself
* @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for this query
* @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
* @param boolean $blnCountOnly only select a rowcount
* @return string the query statement
*/
protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly)
{
// Get the Database Object for this Class
$objDatabase = AssetCustomFieldHelper::GetDatabase();
// Create/Build out the QueryBuilder object with AssetCustomFieldHelper-specific SELET and FROM fields
$objQueryBuilder = new QQueryBuilder($objDatabase, 'asset_custom_field_helper');
AssetCustomFieldHelper::GetSelectFields($objQueryBuilder);
$objQueryBuilder->AddFromItem('asset_custom_field_helper');
// Set "CountOnly" option (if applicable)
if ($blnCountOnly) {
$objQueryBuilder->SetCountOnlyFlag();
}
// Apply Any Conditions
if ($objConditions) {
try {
$objConditions->UpdateQueryBuilder($objQueryBuilder);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
// Iterate through all the Optional Clauses (if any) and perform accordingly
if ($objOptionalClauses) {
if ($objOptionalClauses instanceof QQClause) {
$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
} else {
if (is_array($objOptionalClauses)) {
foreach ($objOptionalClauses as $objClause) {
$objClause->UpdateQueryBuilder($objQueryBuilder);
}
} else {
throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
}
}
}
// Get the SQL Statement
$strQuery = $objQueryBuilder->GetStatement();
// Prepare the Statement with the Query Parameters (if applicable)
if ($mixParameterArray) {
if (is_array($mixParameterArray)) {
if (count($mixParameterArray)) {
$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
}
// Ensure that there are no other Unresolved Named Parameters
if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false) {
throw new QCallerException('Unresolved named parameters in the query');
}
} else {
throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
}
}
// Return the Objects
return $strQuery;
}
开发者ID:proxymoron,项目名称:tracmor,代码行数:64,代码来源:AssetCustomFieldHelperGen.class.php
示例3: AddJoinCustomItem
public function AddJoinCustomItem($strJoinTableName, $strJoinTableAlias, QQCondition $objJoinCondition)
{
$strJoinItem = sprintf('LEFT JOIN %s%s%s AS %s%s%s ON ', $this->strEscapeIdentifierBegin, $strJoinTableName, $this->strEscapeIdentifierEnd, $this->strEscapeIdentifierBegin, $this->GetTableAlias($strJoinTableAlias), $this->strEscapeIdentifierEnd);
try {
if ($strConditionClause = $objJoinCondition->GetWhereClause($this->objDatabase, $this->strRootTableName, true)) {
$strJoinItem .= ' AND ' . $strConditionClause;
}
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
$this->strJoinArray[$strJoinItem] = $strJoinItem;
}
开发者ID:qcodo,项目名称:qcodo,代码行数:13,代码来源:QQuery.class.php
示例4: BuildQueryStatement
/**
* Internally called method to assist with calling Qcubed Query for this class
* on load methods.
* @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
* @param QQCondition $objConditions any conditions on the query, itself
* @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
* @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
* @param boolean $blnCountOnly only select a rowcount
* @return string the query statement
*/
protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly)
{
// Get the Database Object for this Class
$objDatabase = DleMailLog::GetDatabase();
// Create/Build out the QueryBuilder object with DleMailLog-specific SELET and FROM fields
$objQueryBuilder = new QQueryBuilder($objDatabase, 'dle_mail_log');
$blnAddAllFieldsToSelect = true;
if ($objDatabase->OnlyFullGroupBy) {
// see if we have any group by or aggregation clauses, if yes, don't add the fields to select clause
if ($objOptionalClauses instanceof QQClause) {
if ($objOptionalClauses instanceof QQAggregationClause || $objOptionalClauses instanceof QQGroupBy) {
$blnAddAllFieldsToSelect = false;
}
} else {
if (is_array($objOptionalClauses)) {
foreach ($objOptionalClauses as $objClause) {
if ($objClause instanceof QQAggregationClause || $objClause instanceof QQGroupBy) {
$blnAddAllFieldsToSelect = false;
break;
}
}
}
}
}
if ($blnAddAllFieldsToSelect) {
DleMailLog::GetSelectFields($objQueryBuilder, null, QQuery::extractSelectClause($objOptionalClauses));
}
$objQueryBuilder->AddFromItem('dle_mail_log');
// Set "CountOnly" option (if applicable)
if ($blnCountOnly) {
$objQueryBuilder->SetCountOnlyFlag();
}
// Apply Any Conditions
if ($objConditions) {
try {
$objConditions->UpdateQueryBuilder($objQueryBuilder);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
// Iterate through all the Optional Clauses (if any) and perform accordingly
if ($objOptionalClauses) {
if ($objOptionalClauses instanceof QQClause) {
$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
} else {
if (is_array($objOptionalClauses)) {
foreach ($objOptionalClauses as $objClause) {
$objClause->UpdateQueryBuilder($objQueryBuilder);
}
} else {
throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
}
}
}
// Get the SQL Statement
$strQuery = $objQueryBuilder->GetStatement();
// Prepare the Statement with the Query Parameters (if applicable)
if ($mixParameterArray) {
if (is_array($mixParameterArray)) {
if (count($mixParameterArray)) {
$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
}
// Ensure that there are no other Unresolved Named Parameters
if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false) {
throw new QCallerException('Unresolved named parameters in the query');
}
} else {
throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
}
}
// Return the Objects
return $strQuery;
}
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:84,代码来源:DleMailLogGen.class.php
示例5: BuildQueryStatement
/**
* Takes a query builder object and outputs the sql query that corresponds to its structure and the given parameters.
*
* @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
* @param QQCondition $objConditions any conditions on the query, itself
* @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for this query
* @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
* @param boolean $blnCountOnly only select a rowcount
* @return string the query statement
* @throws QCallerException
* @throws Exception
*/
protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly)
{
// Get the Database Object for this Class
$objDatabase = static::GetDatabase();
$strTableName = static::GetTableName();
// Create/Build out the QueryBuilder object with class-specific SELECT and FROM fields
$objQueryBuilder = new QQueryBuilder($objDatabase, $strTableName);
$blnAddAllFieldsToSelect = true;
if ($objDatabase->OnlyFullGroupBy) {
// see if we have any group by or aggregation clauses, if yes, don't add all the fields to select clause by default
// because these databases post an error instead of just choosing a value to return when a select item could
// have multiple values
if ($objOptionalClauses instanceof QQClause) {
if ($objOptionalClauses instanceof QQAggregationClause || $objOptionalClauses instanceof QQGroupBy) {
$blnAddAllFieldsToSelect = false;
}
} else {
if (is_array($objOptionalClauses)) {
foreach ($objOptionalClauses as $objClause) {
if ($objClause instanceof QQAggregationClause || $objClause instanceof QQGroupBy) {
$blnAddAllFieldsToSelect = false;
break;
}
}
}
}
}
$objSelectClauses = QQuery::ExtractSelectClause($objOptionalClauses);
if ($objSelectClauses || $blnAddAllFieldsToSelect) {
static::BaseNode()->PutSelectFields($objQueryBuilder, null, $objSelectClauses);
}
$objQueryBuilder->AddFromItem($strTableName);
// Set "CountOnly" option (if applicable)
if ($blnCountOnly) {
$objQueryBuilder->SetCountOnlyFlag();
}
// Apply Any Conditions
if ($objConditions) {
try {
$objConditions->UpdateQueryBuilder($objQueryBuilder);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
$objExc->IncrementOffset();
throw $objExc;
}
}
// Iterate through all the Optional Clauses (if any) and perform accordingly
if ($objOptionalClauses) {
if ($objOptionalClauses instanceof QQClause) {
try {
$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
$objExc->IncrementOffset();
throw $objExc;
}
} else {
if (is_array($objOptionalClauses)) {
foreach ($objOptionalClauses as $objClause) {
try {
$objClause->UpdateQueryBuilder($objQueryBuilder);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
$objExc->IncrementOffset();
throw $objExc;
}
}
} else {
throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
}
}
}
// Get the SQL Statement
$strQuery = $objQueryBuilder->GetStatement();
// Substitute the correct sql variable names for the placeholders specified in the query, if any.
if ($mixParameterArray) {
if (is_array($mixParameterArray)) {
if (count($mixParameterArray)) {
$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
}
// Ensure that there are no other Unresolved Named Parameters
if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false) {
throw new QCallerException('Unresolved named parameters in the query');
}
} else {
throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
}
}
//.........这里部分代码省略.........
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:101,代码来源:QModelTrait.trait.php
注:本文中的QQCondition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论