本文整理汇总了PHP中make_db_value函数的典型用法代码示例。如果您正苦于以下问题:PHP make_db_value函数的具体用法?PHP make_db_value怎么用?PHP make_db_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_db_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: StrWhereAdv
/**
* construct SQL WHERE clause for Advanced search
* @intellisense
*/
function StrWhereAdv($strField, $SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
{
global $strTableName;
$pSet = new ProjectSettings($strTableName, PAGE_SEARCH);
$cipherer = new RunnerCipherer($strTableName);
$type = $pSet->getFieldType($strField);
$isOracle = false;
$ismssql=false;
$isdb2=false;
$btexttype=IsTextType($type);
$btexttype=false;
$isMysql = true;
if(IsBinaryType($type))
return "";
if($strSearchOption=='Empty')
{
if(IsCharType($type) && (!$ismssql || !$btexttype) && !$isOracle)
{
return "(".GetFullFieldNameForInsert($pSet, $strField)." is null or ".GetFullFieldNameForInsert($pSet, $strField)."='')";
}
elseif ($ismssql && $btexttype)
{
return "(".GetFullFieldNameForInsert($pSet, $strField)." is null or ".GetFullFieldNameForInsert($pSet, $strField)." LIKE '')";
}
else
{
return GetFullFieldNameForInsert($pSet, $strField)." is null";
}
}
$like="like";
if($pSet->getEditFormat($strField) == EDIT_FORMAT_LOOKUP_WIZARD)
{
if($pSet->multiSelect($strField))
$SearchFor=splitvalues($SearchFor);
else
$SearchFor=array($SearchFor);
$ret="";
foreach($SearchFor as $searchValue)
{
$value = $searchValue;
if(!($value=="null" || $value=="Null" || $value==""))
{
if(strlen($ret))
$ret.=" or ";
if($strSearchOption=="Equals")
{
$value=make_db_value($strField,$value);
if(!($value=="null" || $value=="Null"))
$ret.=GetFullFieldName($strField, "", false).'='.$value;
}
elseif($isSuggest)
{
$ret.=" ".GetFullFieldName($strField, "", false)." ".$like." ".db_prepare_string('%'.$value.'%');
}
else
{
if(strpos($value,",")!==false || strpos($value,'"')!==false)
$value = '"'.str_replace('"','""',$value).'"';
if ($isMysql)
{
$value = str_replace('\\\\', '\\\\\\\\', $value);
}
//for search by multiply Lookup wizard field
$ret.=GetFullFieldName($strField, "", false)." = ".db_prepare_string($value);
$ret.=" or ".GetFullFieldName($strField, "", false)." ".$like." ".db_prepare_string("%,".$value.",%");
$ret.=" or ".GetFullFieldName($strField, "", false)." ".$like." ".db_prepare_string("%,".$value);
$ret.=" or ".GetFullFieldName($strField, "", false)." ".$like." ".db_prepare_string($value.",%");
}
}
}
if(strlen($ret))
$ret="(".$ret.")";
return $ret;
}
if($pSet->getEditFormat($strField) == EDIT_FORMAT_CHECKBOX)
{
if($SearchFor=="none")
return "";
if(NeedQuotes($type))
{
$isOracle = false;
if($SearchFor=="on")
{
$whereStr = "(".GetFullFieldName($strField)."<>'0' ";
//.........这里部分代码省略.........
示例2: array
} else {
$likeConditionField = $LookupType == LT_QUERY ? $displayFieldName : $f;
}
$likeWheres = array();
foreach ($values as $fieldValue) {
if ($LookupType == LT_QUERY) {
$likeWheres[] = $likeField . $lookupCipherer->GetLikeClause($likeConditionField, $fieldValue);
} else {
$likeWheres[] = $likeField . $cipherer->GetLikeClause($likeConditionField, $fieldValue);
}
}
$strLookupWhere .= implode(' OR ', $likeWheres);
if ($gSettings->useCategory($f) && ($isExistParent || postvalue('editMode') != MODE_SEARCH)) {
$arLookupWhere = array();
foreach ($lookupCategory as $arLookupCategory) {
$cvalue = make_db_value($gSettings->getCategoryControl($f), $arLookupCategory);
$arLookupWhere[] = $lookupConnection->addFieldWrappers($gSettings->getCategoryFilter($f)) . "=" . $cvalue;
}
$arLookupWhereToStr = count($arLookupWhere) == 1 ? $arLookupWhere[0] : "(" . implode(" OR ", $arLookupWhere) . ")";
if (count($arLookupWhere)) {
$strLookupWhere = whereAdd($strLookupWhere, $arLookupWhereToStr);
}
}
if (strlen($lookupOrderBy)) {
$lookupOrderBy = $lookupConnection->addFieldWrappers($lookupOrderBy);
if ($gSettings->isLookupDesc($f)) {
$lookupOrderBy .= ' DESC';
}
}
if ($LookupType == LT_QUERY) {
$LookupSQL = $lookupQueryObj->toSql(whereAdd($lookupQueryObj->m_where->toSql($lookupQueryObj), $strLookupWhere), strlen($lookupOrderBy) ? ' ORDER BY ' . $lookupOrderBy : null);
示例3: DisplayMasterTableInfo_Module
function DisplayMasterTableInfo_Module($params)
{
$detailtable = $params["detailtable"];
$keys = $params["keys"];
global $conn, $strTableName;
$xt = new Xtempl();
$oldTableName = $strTableName;
$strTableName = "dbo.Module";
//$strSQL = "SELECT ID, [Module Type], [Module Status], [Module Condition], [Serial Num], [Entry Date] FROM dbo.[Module]";
$sqlHead = "SELECT ID, [Module Type], [Module Status], [Module Condition], [Serial Num], [Entry Date]";
$sqlFrom = "FROM dbo.[Module]";
$sqlWhere = "";
$sqlTail = "";
$where = "";
global $page_styles, $page_layouts, $page_layout_names, $container_styles;
$layout = new TLayout("masterprint", "BoldOrange", "MobileOrange");
$layout->blocks["bare"] = array();
$layout->containers["0"] = array();
$layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1);
$layout->skins["0"] = "empty";
$layout->blocks["bare"][] = "0";
$layout->containers["mastergrid"] = array();
$layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1);
$layout->skins["mastergrid"] = "grid";
$layout->blocks["bare"][] = "mastergrid";
$page_layouts["Module_masterprint"] = $layout;
if ($detailtable == "dbo.Anomalies") {
$where .= GetFullFieldName("ID") . "=" . make_db_value("ID", $keys[1 - 1]);
}
if ($detailtable == "dbo.Customer Module Assignment") {
$where .= GetFullFieldName("ID") . "=" . make_db_value("ID", $keys[1 - 1]);
}
if ($detailtable == "dbo.Readings") {
$where .= GetFullFieldName("ID") . "=" . make_db_value("ID", $keys[1 - 1]);
}
if (!$where) {
$strTableName = $oldTableName;
return;
}
$str = SecuritySQL("Export");
if (strlen($str)) {
$where .= " and " . $str;
}
$strWhere = whereAdd($sqlWhere, $where);
if (strlen($strWhere)) {
$strWhere = " where " . $strWhere . " ";
}
$strSQL = $sqlHead . ' ' . $sqlFrom . $strWhere . $sqlTail;
// $strSQL=AddWhere($strSQL,$where);
LogInfo($strSQL);
$rs = db_query($strSQL, $conn);
$data = db_fetch_array($rs);
if (!$data) {
$strTableName = $oldTableName;
return;
}
$keylink = "";
$keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["ID"]));
// ID -
$value = "";
$value = ProcessLargeText(GetData($data, "ID", ""), "field=ID" . $keylink, "", MODE_PRINT);
$xt->assign("ID_mastervalue", $value);
// Module Type -
$value = "";
$value = DisplayLookupWizard("Module Type", $data["Module Type"], $data, $keylink, MODE_PRINT);
$xt->assign("Module_Type_mastervalue", $value);
// Module Status -
$value = "";
$value = DisplayLookupWizard("Module Status", $data["Module Status"], $data, $keylink, MODE_PRINT);
$xt->assign("Module_Status_mastervalue", $value);
// Module Condition -
$value = "";
$value = DisplayLookupWizard("Module Condition", $data["Module Condition"], $data, $keylink, MODE_PRINT);
$xt->assign("Module_Condition_mastervalue", $value);
// Serial Num -
$value = "";
$value = ProcessLargeText(GetData($data, "Serial Num", ""), "field=Serial+Num" . $keylink, "", MODE_PRINT);
$xt->assign("Serial_Num_mastervalue", $value);
// Entry Date - Short Date
$value = "";
$value = ProcessLargeText(GetData($data, "Entry Date", "Short Date"), "field=Entry+Date" . $keylink, "", MODE_PRINT);
$xt->assign("Entry_Date_mastervalue", $value);
$xt->display("Module_masterprint.htm");
$strTableName = $oldTableName;
}
示例4: while
// copy keys to session
$i = 1;
while (isset($_REQUEST["masterkey" . $i])) {
$_SESSION[$strTableName . "_masterkey" . $i] = $_REQUEST["masterkey" . $i];
$i++;
}
if (isset($_SESSION[$strTableName . "_masterkey" . $i])) {
unset($_SESSION[$strTableName . "_masterkey" . $i]);
}
} else {
$mastertable = $_SESSION[$strTableName . "_mastertable"];
}
//$strSQL = $gstrSQL;
if ($mastertable == "dbo.Module") {
$where = "";
$where .= GetFullFieldName("Module ID") . "=" . make_db_value("Module ID", $_SESSION[$strTableName . "_masterkey1"]);
}
$str = SecuritySQL("Search");
if (strlen($str)) {
$where .= " and " . $str;
}
$strSQL = gSQLWhere($where);
$strSQL .= " " . $gstrOrderBy;
$rowcount = gSQLRowCount($where);
$xt->assign("row_count", $rowcount);
if ($rowcount) {
$xt->assign("details_data", true);
$rs = db_query($strSQL, $conn);
$display_count = 10;
if ($mode == "inline") {
$display_count *= 2;
示例5: buildLookupWhereClause
function buildLookupWhereClause()
{
$arWhereClause = array();
foreach ($this->lookupCategory as $arLookupCategory) {
if ($this->cipherer != null) {
$lookupValue = $this->cipherer->MakeDBValue($this->categoryField, $arLookupCategory);
} else {
$lookupValue = make_db_value($this->categoryField, $arLookupCategory);
}
$arWhereClause[] = whereAdd($this->strWhereClause, $this->getFieldSQLDecrypt($this->categoryField) . "=" . $lookupValue);
}
if (count($arWhereClause) > 1) {
$this->strWhereClause = "(" . implode(" OR ", $arWhereClause) . ")";
} elseif (count($arWhereClause) == 1) {
$this->strWhereClause = $arWhereClause[0];
}
if (strlen($this->strLookupWhere)) {
$this->strWhereClause = whereAdd($this->strWhereClause, $this->strLookupWhere);
}
// add 1=0 if parent control contain empty value and no search used
if ($this->mainPSet->useCategory($this->mainField) && postvalue('editMode') != MODE_SEARCH && !count($this->lookupCategory)) {
$this->strWhereClause = whereAdd($this->strWhereClause, "1=0");
}
}
示例6: ProjectSettings
}
// set db connection
$_connection = $cman->byTable($strTableName);
$pSet = new ProjectSettings($strTableName, $pageType);
$denyChecking = $pSet->allowDuplicateValues($fieldName);
$denyChecking = $denyChecking && ($strTableName != "DashboardUsers" || $fieldName != $cUserNameField && $fieldName != $cEmailField);
if ($denyChecking) {
$returnJSON = array("success" => false, "error" => "Duplicated values are allowed");
echo printJSON($returnJSON);
return;
}
$cipherer = new RunnerCipherer($strTableName, $pSet);
if ($cipherer->isFieldEncrypted($fieldName)) {
$value = $cipherer->MakeDBValue($fieldName, $value, $fieldControlType, true);
} else {
$value = make_db_value($fieldName, $value, $fieldControlType, "", $strTableName);
}
if ($value == "null") {
$fieldSQL = RunnerPage::_getFieldSQL($fieldName, $_connection, $pSet);
} else {
$fieldSQL = RunnerPage::_getFieldSQLDecrypt($fieldName, $_connection, $pSet, $cipherer);
}
$where = $fieldSQL . ($value == "null" ? ' is ' : '=') . $value;
$sql = "SELECT count(*) from " . $_connection->addTableWrappers($pSet->getOriginalTableName()) . " where " . $where;
$qResult = $_connection->query($sql);
if (!$qResult || !($data = $qResult->fetchNumeric())) {
$returnJSON = array("success" => false, "error" => "Error: Wrong SQL query");
echo printJSON($returnJSON);
return;
}
$hasDuplicates = $data[0] ? true : false;
示例7: unset
$i++;
}
if (isset($_SESSION[$strTableName . "_masterkey" . $i])) {
unset($_SESSION[$strTableName . "_masterkey" . $i]);
}
} else {
$mastertable = $_SESSION[$strTableName . "_mastertable"];
}
//$strSQL = $gstrSQL;
if ($mastertable == "dbo.LU_Customer Type") {
$where = "";
$where .= GetFullFieldName("Customer Type") . "=" . make_db_value("Customer Type", $_SESSION[$strTableName . "_masterkey1"]);
}
if ($mastertable == "dbo.LU_Locations") {
$where = "";
$where .= GetFullFieldName("Location") . "=" . make_db_value("Location", $_SESSION[$strTableName . "_masterkey1"]);
}
$str = SecuritySQL("Search");
if (strlen($str)) {
$where .= " and " . $str;
}
$strSQL = gSQLWhere($where);
$strSQL .= " " . $gstrOrderBy;
$rowcount = gSQLRowCount($where);
$xt->assign("row_count", $rowcount);
if ($rowcount) {
$xt->assign("details_data", true);
$rs = db_query($strSQL, $conn);
$display_count = 10;
if ($mode == "inline") {
$display_count *= 2;
示例8: buildLookupSQL
function buildLookupSQL($field, $table, $parentVal, $childVal = "", $doCategoryFilter = true, $doValueFilter = false, $addCategoryField = false, $doWhereFilter = true, $oneRecordMode = false)
{
global $strTableName;
if (!strlen($table)) {
$table = $strTableName;
}
// read settings
$nLookupType = GetFieldData($table, $field, "LookupType", LT_LISTOFVALUES);
if ($nLookupType != LT_LOOKUPTABLE) {
return "";
}
$bUnique = GetFieldData($table, $field, "LookupUnique", false);
$strLookupWhere = LookupWhere($field, $table);
$strOrderBy = GetFieldData($table, $field, "LookupOrderBy", "");
$bDesc = GetFieldData($table, $field, "LookupDesc", false);
$strCategoryFilter = GetFieldData($table, $field, "CategoryFilter", "");
if ($doCategoryFilter) {
$parentVal = make_db_value(CategoryControl($field, $table), $parentVal);
}
if ($doValueFilter) {
$childVal = make_db_value($field, $childVal);
}
// build SQL string
$LookupSQL = "SELECT ";
if ($oneRecordMode) {
$LookupSQL .= "top 1 ";
}
if ($bUnique) {
$LookupSQL .= "DISTINCT ";
}
$LookupSQL .= GetLWLinkField($field, $table);
$LookupSQL .= "," . GetLWDisplayField($field, $table);
if ($addCategoryField && strlen($strCategoryFilter)) {
$LookupSQL .= "," . AddFieldWrappers($strCategoryFilter);
}
$LookupSQL .= " FROM " . AddTableWrappers(GetLookupTable($field, $table));
// build Where clause
$categoryWhere = "";
$childWhere = "";
if (UseCategory($field, $table) && $doCategoryFilter) {
$condition = "=" . $parentVal;
if ($childVal === "null") {
$condition = " is null";
}
$categoryWhere = AddFieldWrappers($strCategoryFilter) . $condition;
}
if ($doValueFilter) {
$condition = "=" . $childVal;
if ($childVal === "null") {
$condition = " is null";
}
$childWhere = AddFieldWrappers(GetLWLinkField($field, $table)) . $condition;
}
$strWhere = "";
if ($doWhereFilter && strlen($strLookupWhere)) {
$strWhere = "(" . $strLookupWhere . ")";
}
if (strlen($categoryWhere)) {
if (strlen($strWhere)) {
$strWhere .= " AND ";
}
$strWhere .= $categoryWhere;
}
if (strlen($childWhere)) {
if (strlen($strWhere)) {
$strWhere .= " AND ";
}
$strWhere .= $childWhere;
}
if (strlen($strWhere)) {
$LookupSQL .= " WHERE " . $strWhere;
}
// order by clause
if (strlen($strOrderBy)) {
$LookupSQL .= " ORDER BY " . AddTableWrappers(GetLookupTable($field, $table)) . "." . AddFieldWrappers($strOrderBy);
if ($bDesc) {
$LookupSQL .= " DESC";
}
}
return $LookupSQL;
}
示例9: countDetailsRecsNoSubQ
/**
* Use for count details recs number, if subQueryes not supported, or keys have different types
*
* @param integer $i
* @param array $detailid
*/
function countDetailsRecsNoSubQ($dInd, &$detailid)
{
global $tables_data;
global $masterTablesData;
global $detailsTablesData;
$dDataSourceTable = $this->allDetailsTablesArr[$dInd]['dDataSourceTable'];
$gQuery = GetTableData($dDataSourceTable, '.sqlquery', null);
$dObjHaving = $gQuery->Having();
$dSqlHaving = $dObjHaving->toSql($gQuery);
$dSqlGroupBy = $gQuery->GroupByToSql();
$dSqlHead = $this->allDetailsTablesArr[$dInd]['sqlHead'];
$dSqlFrom = $this->allDetailsTablesArr[$dInd]['sqlFrom'];
$dSqlWhere = $this->allDetailsTablesArr[$dInd]['sqlWhere'];
//$sqlTail = $detailTableInfo['sqlTail'];
$detailKeys = GetDetailKeysByMasterTable($this->tName, $dDataSourceTable);
$securityClause = SecuritySQL("Search", $dDataSourceTable);
// add where
if (strlen($securityClause)) {
$dSqlWhere = whereAdd($dSqlWhere, $securityClause);
}
$masterwhere = "";
foreach ($this->masterKeysByD[$dInd] as $idx => $val) {
if ($masterwhere) {
$masterwhere .= " and ";
}
$masterwhere .= GetFullFieldName($detailKeys[$idx], $dDataSourceTable) . "=" . make_db_value($detailKeys[$idx], $detailid[$idx]);
}
return gSQLRowCount_int($dSqlHead, $dSqlFrom, $dSqlWhere, $dSqlGroupBy, $dSqlHaving, $masterwhere, "");
}
示例10: SQLWhere
function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
{
if ($this->lookupType == LT_LISTOFVALUES) {
return parent::SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest);
}
$baseResult = $this->baseSQLWhere($strSearchOption);
if ($baseResult === false) {
return "";
}
if ($baseResult != "") {
return $baseResult;
}
$displayFieldType = $this->type;
if ($this->lookupType == LT_QUERY) {
$displayFieldType = $this->lookupPSet->getFieldType($this->field);
$this->btexttype = IsTextType($displayFieldType);
}
if ($this->multiselect) {
$SearchFor = splitvalues($SearchFor);
} else {
$SearchFor = array($SearchFor);
}
$ret = "";
if ($this->linkAndDisplaySame) {
$gstrField = GetFullFieldName($this->field, "", false);
} else {
$gstrField = GetFullFieldName($this->displayFieldName, $this->lookupTable, false);
}
if ($this->customDisplay) {
$gstrField = $this->lwDisplayFieldWrapped;
} else {
if (!$this->linkAndDisplaySame && $this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype && !$this->ciphererDisplay->isFieldPHPEncrypted($this->displayFieldName)) {
$gstrField = $this->lookupPSet->isEnableUpper(GetFullFieldName($this->displayFieldName, $this->lookupTable, false));
}
}
foreach ($SearchFor as $value) {
if (!($value == "null" || $value == "Null" || $value == "")) {
if (strlen(trim($ret))) {
$ret .= " or ";
}
if (!$this->multiselect) {
if ($strSearchOption == "Starts with") {
$value .= '%';
}
if ($isSuggest || $strSearchOption == "Contains") {
$value = '%' . $value . '%';
}
if ($isSuggest || $strSearchOption == "Contains" || $strSearchOption == "Starts with" || $strSearchOption == "More than" || $strSearchOption == "Less than" || $strSearchOption == "Equal or more than" || $strSearchOption == "Equal or less than" || $strSearchOption == "Between" || $strSearchOption == "Equals" && $this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
$value = $this->escapeSearchValForMySQL($value);
if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
$value = $this->lookupPSet->isEnableUpper(db_prepare_string($value));
} else {
$value = db_prepare_string($value);
}
} else {
if ($strSearchOption == "Equals") {
$value = make_db_value($this->field, $value);
}
}
}
if ($strSearchOption == "Equals") {
if (!($value == "null" || $value == "Null")) {
if ($this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
$condition = $gstrField . '=' . $value;
} else {
$condition = GetFullFieldName($this->field, "", false) . '=' . $value;
}
}
} else {
if ($strSearchOption == "Starts with" || $strSearchOption == "Contains" && !$this->multiselect) {
$condition = $gstrField . " " . $this->like . " " . $value;
} else {
if ($strSearchOption == "More than") {
$condition = $gstrField . " > " . $value;
} else {
if ($strSearchOption == "Less than") {
$condition = $gstrField . "<" . $value;
} else {
if ($strSearchOption == "Equal or more than") {
$condition = $gstrField . ">=" . $value1;
} else {
if ($strSearchOption == "Equal or less than") {
$condition = $gstrField . "<=" . $value1;
} else {
if ($strSearchOption == "Between") {
if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
$value2 = $this->lookupPSet->isEnableUpper(db_prepare_string($SearchFor2));
} else {
$value2 = db_prepare_string($SearchFor2);
}
$condition = $gstrField . ">=" . $value . " and ";
if (IsDateFieldType($this->type)) {
$timeArr = db2time($SearchFor2);
// for dates without time, add one day
if ($timeArr[3] == 0 && $timeArr[4] == 0 && $timeArr[5] == 0) {
$timeArr = adddays($timeArr, 1);
$SearchFor2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
$SearchFor2 = add_db_quotes($this->field, $SearchFor2, $this->pageObject->tName);
$condition .= $gstrField . "<" . $SearchFor2;
} else {
//.........这里部分代码省略.........
示例11: make_db_value
$where = "";
$where .= $pageObject->getFieldSQLDecrypt("GroupID") . "=" . make_db_value("GroupID", $_SESSION[$strTableName . "_masterkey1"]);
$where .= " and ";
$where .= $pageObject->getFieldSQLDecrypt("CompanyID") . "=" . make_db_value("CompanyID", $_SESSION[$strTableName . "_masterkey2"]);
}
if ($mastertable == "calendar_table") {
$where = "";
$where .= $pageObject->getFieldSQLDecrypt("TranDate") . "=" . make_db_value("TranDate", $_SESSION[$strTableName . "_masterkey1"]);
}
if ($mastertable == "DimDept") {
$where = "";
$where .= $pageObject->getFieldSQLDecrypt("TranDept") . "=" . make_db_value("TranDept", $_SESSION[$strTableName . "_masterkey1"]);
}
if ($mastertable == "DimArea") {
$where = "";
$where .= $pageObject->getFieldSQLDecrypt("TranArea") . "=" . make_db_value("TranArea", $_SESSION[$strTableName . "_masterkey1"]);
}
$str = SecuritySQL("Search", $strTableName);
if (strlen($str)) {
$where .= " and " . $str;
}
$strSQL = $gQuery->gSQLWhere($where);
$strSQL .= " " . $gstrOrderBy;
$rowcount = $gQuery->gSQLRowCount($where, $pageObject->connection);
$xt->assign("row_count", $rowcount);
if ($rowcount) {
$xt->assign("details_data", true);
$display_count = 10;
if ($mode == "inline") {
$display_count *= 2;
}
示例12: addWhereWithMasterTable
/**
* add where clause with foreign keys of current table and it's master table master keys
*
* @return string
*/
function addWhereWithMasterTable()
{
$where = "";
if (count($this->detailKeysByM)) {
for ($i = 0; $i < count($this->detailKeysByM); $i++) {
if ($i != 0) {
$where .= " and ";
}
$mValue = make_db_value($this->detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
if (!empty($mValue)) {
$where .= GetFullFieldName($this->detailKeysByM[$i]) . "=" . $mValue;
} else {
$where .= "1=0";
}
}
}
return $where;
}
示例13: GetLWWhere
$strLookupWhere = GetLWWhere($f, $pageType, $strTableName);
if ($strLookupWhere) {
$strLookupWhere = " (" . $strLookupWhere . ") AND ";
}
if ($LookupType == LT_QUERY) {
if ($gSettings->getCustomDisplay($f)) {
$strLookupWhere .= $displayFieldName;
} else {
$strLookupWhere .= GetFullFieldName($displayFieldName, $lookupTable, false);
}
} else {
$strLookupWhere .= $cipherer->GetFieldName($lwDisplayField, $f);
}
$strLookupWhere .= $cipherer->GetLikeClause($LookupType == LT_QUERY ? $displayFieldName : $f, $value);
if ($gSettings->useCategory($f) && (postvalue("category") != '' || postvalue('editMode') != MODE_SEARCH)) {
$cvalue = make_db_value($gSettings->getCategoryControl($f), postvalue("category"));
$strLookupWhere .= " AND " . AddFieldWrappers($gSettings->getCategoryFilter($f)) . "=" . $cvalue;
}
$lookupOrderBy = $gSettings->getLookupOrderBy($f);
if (strlen($lookupOrderBy)) {
$lookupOrderBy = GetFullFieldName($lookupOrderBy, $lookupTable);
if ($gSettings->isLookupDesc($f)) {
$lookupOrderBy .= ' DESC';
}
}
if ($LookupType == LT_QUERY) {
$LookupSQL = $lookupQueryObj->toSql(whereAdd($lookupQueryObj->m_where->toSql($lookupQueryObj), $strLookupWhere), strlen($lookupOrderBy) ? ' ORDER BY ' . $lookupOrderBy : null);
} else {
$LookupSQL = $LookupSQLTable . " where " . $strLookupWhere;
if (!$gSettings->isLookupUnique($f) || nDATABASE_Access != 4) {
if ($lookupOrderBy) {
示例14: buildLookupWhereClause
function buildLookupWhereClause()
{
if (strlen($this->lookupCategory)) {
$this->strWhereClause = whereAdd($this->strWhereClause, GetFullFieldName($this->categoryField) . "=" . make_db_value($this->categoryField, $this->lookupCategory));
}
if (strlen($this->strLookupWhere)) {
$this->strWhereClause = whereAdd($this->strWhereClause, $this->strLookupWhere);
}
// add 1=0 if parent control contain empty value and no search used
if (UseCategory($this->mainField, $this->mainTable) && postvalue('editMode') != MODE_SEARCH && !strlen($this->lookupCategory)) {
$this->strWhereClause = whereAdd($this->strWhereClause, "1=0");
}
}
示例15: DisplayMasterTableInfo_Customers
function DisplayMasterTableInfo_Customers($params)
{
$detailtable = $params["detailtable"];
$keys = $params["keys"];
global $conn, $strTableName;
$xt = new Xtempl();
$oldTableName = $strTableName;
$strTableName = "dbo.Customers";
//$strSQL = "SELECT ID, Name, [Father Name], Address, Contact, Location, [Customer Type] FROM dbo.Customers";
$sqlHead = "SELECT ID, Name, [Father Name], Address, Contact, Location, [Customer Type]";
$sqlFrom = "FROM dbo.Customers";
$sqlWhere = "";
$sqlTail = "";
$where = "";
$mKeys = array();
$showKeys = "";
global $page_styles, $page_layouts, $page_layout_names, $container_styles;
$layout = new TLayout("masterlist", "BoldOrange", "MobileOrange");
$layout->blocks["bare"] = array();
$layout->containers["0"] = array();
$layout->containers["0"][] = array("name" => "masterlistheader", "block" => "", "substyle" => 1);
$layout->skins["0"] = "empty";
$layout->blocks["bare"][] = "0";
$layout->containers["mastergrid"] = array();
$layout->containers["mastergrid"][] = array("name" => "masterlistfields", "block" => "", "substyle" => 1);
$layout->skins["mastergrid"] = "grid";
$layout->blocks["bare"][] = "mastergrid";
$page_layouts["Customers_masterlist"] = $layout;
if ($detailtable == "dbo.Customer Module Assignment") {
$where .= GetFullFieldName("ID") . "=" . make_db_value("ID", $keys[1 - 1]);
$showKeys .= " " . GetFieldLabel("dbo_Customers", "ID") . ": " . $keys[1 - 1];
$xt->assign('showKeys', $showKeys);
}
if (!$where) {
$strTableName = $oldTableName;
return;
}
$str = SecuritySQL("Search");
if (strlen($str)) {
$where .= " and " . $str;
}
$strWhere = whereAdd($sqlWhere, $where);
if (strlen($strWhere)) {
$strWhere = " where " . $strWhere . " ";
}
$strSQL = $sqlHead . ' ' . $sqlFrom . $strWhere . $sqlTail;
// $strSQL=AddWhere($strSQL,$where);
LogInfo($strSQL);
$rs = db_query($strSQL, $conn);
$data = db_fetch_array($rs);
if (!$data) {
$strTableName = $oldTableName;
return;
}
$keylink = "";
$keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["ID"]));
// ID -
$value = "";
$value = ProcessLargeText(GetData($data, "ID", ""), "field=ID" . $keylink);
$xt->assign("ID_mastervalue", $value);
// Name -
$value = "";
$value = ProcessLargeText(GetData($data, "Name", ""), "field=Name" . $keylink);
$xt->assign("Name_mastervalue", $value);
// Father Name -
$value = "";
$value = ProcessLargeText(GetData($data, "Father Name", ""), "field=Father+Name" . $keylink);
$xt->assign("Father_Name_mastervalue", $value);
// Address -
$value = "";
$value = ProcessLargeText(GetData($data, "Address", ""), "field=Address" . $keylink);
$xt->assign("Address_mastervalue", $value);
// Contact -
$value = "";
$value = ProcessLargeText(GetData($data, "Contact", ""), "field=Contact" . $keylink);
$xt->assign("Contact_mastervalue", $value);
// Location -
$value = "";
$value = DisplayLookupWizard("Location", $data["Location"], $data, $keylink, MODE_LIST);
$xt->assign("Location_mastervalue", $value);
// Customer Type -
$value = "";
$value = DisplayLookupWizard("Customer Type", $data["Customer Type"], $data, $keylink, MODE_LIST);
$xt->assign("Customer_Type_mastervalue", $value);
$xt->display("Customers_masterlist.htm");
$strTableName = $oldTableName;
}