本文整理汇总了PHP中IsBinaryType函数的典型用法代码示例。如果您正苦于以下问题:PHP IsBinaryType函数的具体用法?PHP IsBinaryType怎么用?PHP IsBinaryType使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsBinaryType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: db_fetch_array
function db_fetch_array($rs, $assoc = 1)
{
global $mssql_dmy;
if ($rs->EOF()) {
return false;
}
try {
$ret = array();
for ($i = 0; $i < db_numfields($rs); $i++) {
if (IsBinaryType($rs->Fields[$i]->Type) && $rs->Fields[$i]->Type != 128) {
$str = "";
if ($rs->Fields[$i]->ActualSize) {
$val = $rs->Fields[$i]->GetChunk($rs->Fields[$i]->ActualSize);
$str = str_pad("", count($val));
$j = 0;
foreach ($val as $byte) {
$str[$j++] = chr($byte);
}
}
if ($assoc) {
$ret[$rs->Fields[$i]->Name] = $str;
} else {
$ret[$i] = $str;
}
} else {
$value = $rs->Fields[$i]->Value;
if (is_null($value)) {
$val = NULL;
} else {
if (isdatefieldtype($rs->Fields[$i]->Type)) {
$value = localdatetime2db((string) $rs->Fields[$i]->Value, $mssql_dmy);
}
if (IsNumberType($rs->Fields[$i]->Type)) {
$val = floatval($value);
} else {
$val = strval($value);
}
}
if ($assoc) {
$ret[$rs->Fields[$i]->Name] = $val;
} else {
$ret[$i] = $val;
}
}
}
$rs->MoveNext();
} catch (com_exception $e) {
trigger_error($e->getMessage(), E_USER_ERROR);
}
return $ret;
}
示例2: showDBValue
public function showDBValue(&$data, $keylink = "")
{
$value = $data[$this->field];
if (IsBinaryType($this->fieldType)) {
$value = "LONG BINARY DATA - CANNOT BE DISPLAYED";
}
if ($value === false) {
$value = "";
}
if ($this->editFormat == EDIT_FORMAT_CHECKBOX && $this->viewFormat == FORMAT_NONE) {
if ($value && $value != 0) {
$value = "Yes";
} else {
$value = "No";
}
}
return $this->checkForEncoding($value, $keylink);
}
示例3: WriteTableData
/**
* @param Mixed rs
* @param Number nPageSize
*/
protected function WriteTableData($rs, $nPageSize)
{
$exportFields = $this->pSet->getExportFields();
$totalFieldsData = $this->pSet->getTotalsFields();
if ($this->eventsObject->exists("ListFetchArray")) {
$row = $this->eventsObject->ListFetchArray($rs, $this);
} else {
$row = $this->cipherer->DecryptFetchedArray($this->connection->fetch_array($rs));
}
// write header
echo "<tr>";
if ($_REQUEST["type"] == "excel") {
foreach ($exportFields as $field) {
echo '<td style="width: 100" x:str>' . PrepareForExcel($this->pSet->label($field)) . '</td>';
}
} else {
foreach ($exportFields as $field) {
echo "<td>" . $this->pSet->label($field) . "</td>";
}
}
echo "</tr>";
$totals = array();
$totalsFields = array();
foreach ($totalFieldsData as $data) {
if (!in_array($data["fName"], $exportFields)) {
continue;
}
$totals[$data["fName"]] = array("value" => 0, "numRows" => 0);
$totalsFields[] = array('fName' => $data["fName"], 'totalsType' => $data["totalsType"], 'viewFormat' => $this->pSet->getViewFormat($data["fName"]));
}
// write data rows
$iNumberOfRows = 0;
$this->viewControls->forExport = "export";
while ((!$nPageSize || $iNumberOfRows < $nPageSize) && $row) {
countTotals($totals, $totalsFields, $row);
$values = array();
foreach ($exportFields as $field) {
$fType = $this->pSet->getFieldType($field);
if (IsBinaryType($fType)) {
$values[$field] = "código binario demasiado grande – no puede ser desplegado";
} else {
$values[$field] = $this->getViewControl($field)->getExportValue($row, "");
}
}
$eventRes = true;
if ($this->eventsObject->exists('BeforeOut')) {
$eventRes = $this->eventsObject->BeforeOut($row, $values, $this);
}
if ($eventRes) {
$iNumberOfRows++;
echo "<tr>";
foreach ($exportFields as $field) {
$fType = $this->pSet->getFieldType($field);
if (IsCharType($fType)) {
if ($_REQUEST["type"] == "excel") {
echo '<td x:str>';
} else {
echo '<td>';
}
} else {
echo '<td>';
}
$editFormat = $this->pSet->getEditFormat($field);
if ($editFormat == EDIT_FORMAT_LOOKUP_WIZARD) {
if ($this->pSet->NeedEncode($field)) {
if ($_REQUEST["type"] == "excel") {
echo PrepareForExcel($values[$field]);
} else {
echo $values[$field];
}
} else {
echo $values[$field];
}
} elseif (IsBinaryType($fType)) {
echo $values[$field];
} else {
if ($editFormat == FORMAT_CUSTOM || $this->pSet->isUseRTE($field)) {
echo $values[$field];
} elseif (NeedQuotes($field)) {
if ($_REQUEST["type"] == "excel") {
echo PrepareForExcel($values[$field]);
} else {
echo $values[$field];
}
} else {
echo $values[$field];
}
}
echo '</td>';
}
echo "</tr>";
}
if ($this->eventsObject->exists("ListFetchArray")) {
$row = $this->eventsObject->ListFetchArray($rs, $this);
} else {
$row = $this->cipherer->DecryptFetchedArray($this->connection->fetch_array($rs));
//.........这里部分代码省略.........
示例4: runner_htmlspecialchars
$gKey = $key;
$res_head .= "<th>" . runner_htmlspecialchars($gKey) . "</th>";
}
}
$res_body .= '<tr>';
foreach( $data as $fld=>$val )
{
if(is_wr_project())
{
if(IsBinaryType($gSettings->getFieldType($fld)))
continue;
}
elseif(is_wr_custom())
{
if(IsBinaryType($fields_type[$fld]))
continue;
}
elseif(is_array($val))
{
$res_body .= '<td><span></span></td>';
continue;
}
$s=$val;
if(strlen($s)>100)
$s=substr($s,0,100);
$res_body .= '<td><span>' . runner_htmlspecialchars($s) . '</span></td>';
}
$res_body .= '</tr>';
$flag=false;
}
示例5: ExportToExcel
function ExportToExcel($rs, $nPageSize, $eventObj, $cipherer, $pageObj)
{
if ($eventObj->exists("ListFetchArray")) {
$row = $eventObj->ListFetchArray($rs, $pageObj);
} else {
$row = $cipherer->DecryptFetchedArray($pageObj->connection->fetch_array($rs));
}
$tmpArr = array();
$totals = array();
$arrLabel = array();
$arrTotal = array();
$arrFields = array();
$arrTmpTotal = array();
$arrColumnWidth = array();
$arrTotalMessage = array();
$tmpArr = $pageObj->pSet->getExportFields();
foreach ($tmpArr as $value) {
if ($pageObj->pSet->appearOnExportPage($value)) {
$arrFields[] = $value;
}
}
$arrTmpTotal = $pageObj->pSet->getTotalsFields();
$pageObj->viewControls->forExport = "excel";
foreach ($arrFields as $value) {
$arrLabel[$value] = GetFieldLabel(GoodFieldName($pageObj->tName), GoodFieldName($value));
$arrColumnWidth[$value] = 10;
$totals[$value] = array("value" => 0, "numRows" => 0);
$totalsType = "";
foreach ($arrTmpTotal as $tvalue) {
if ($tvalue["fName"] == $value) {
$totalsType = $tvalue["totalsType"];
$totalsFields[] = array('fName' => $value, 'totalsType' => $totalsType, 'viewFormat' => $pageObj->pSet->getViewFormat($value));
}
}
}
// write data rows
$iNumberOfRows = 0;
$objPHPExcel = ExportExcelInit($arrLabel, $arrColumnWidth);
while ((!$nPageSize || $iNumberOfRows < $nPageSize) && $row) {
countTotals($totals, $totalsFields, $row);
$values = array();
$arrData = array();
$arrDataType = array();
foreach ($arrFields as $field) {
if (IsBinaryType($pageObj->pSet->getFieldType($field))) {
$values[$field] = $row[$field];
} else {
$values[$field] = $pageObj->getExportValue($field, $row);
}
}
$eventRes = true;
if ($eventObj->exists('BeforeOut')) {
$eventRes = $eventObj->BeforeOut($row, $values, $pageObj);
}
if ($eventRes) {
$iNumberOfRows++;
$i = 0;
foreach ($arrFields as $field) {
if (IsBinaryType($pageObj->pSet->getFieldType($field))) {
$arrDataType[$field] = "binary";
} elseif ($pageObj->pSet->getViewFormat($field) == FORMAT_DATE_SHORT || $pageObj->pSet->getViewFormat($field) == FORMAT_DATE_LONG || $pageObj->pSet->getViewFormat($field) == FORMAT_DATE_TIME) {
$arrDataType[$field] = "date";
} elseif ($pageObj->pSet->getViewFormat($field) == FORMAT_FILE_IMAGE) {
$arrDataType[$field] = "file";
} else {
$arrDataType[$field] = "";
}
$arrData[$field] = $values[$field];
}
ExportExcelRecord($arrData, $arrDataType, $iNumberOfRows, $objPHPExcel, $pageObj);
}
if ($eventObj->exists("ListFetchArray")) {
$row = $eventObj->ListFetchArray($rs, $pageObj);
} else {
$row = $cipherer->DecryptFetchedArray($pageObj->connection->fetch_array($rs));
}
}
if (count($arrTmpTotal)) {
foreach ($arrFields as $fName) {
$value = array();
foreach ($arrTmpTotal as $tvalue) {
if ($tvalue["fName"] == $fName) {
$value = $tvalue;
}
}
$total = "";
$totalMess = "";
if ($value["totalsType"]) {
if ($value["totalsType"] == "COUNT") {
$totalMess = "Count" . ": ";
} elseif ($value["totalsType"] == "TOTAL") {
$totalMess = "Total" . ": ";
} elseif ($value["totalsType"] == "AVERAGE") {
$totalMess = "Average" . ": ";
}
$total = GetTotals($fName, $totals[$fName]["value"], $value["totalsType"], $totals[$fName]["numRows"], $value["viewFormat"], "export");
}
$arrTotal[$fName] = $total;
$arrTotalMessage[$fName] = $totalMess;
}
//.........这里部分代码省略.........
示例6: GoodFieldName
if ( in_array( $field, $aSelGroupFields ) ) {
$disabled = "disabled";
$class = "inactive";
$blobClass = "";
}
}
if (!is_wr_custom())
$field_type=WRGetFieldType( $arr['table'].".".$arr['field']);
else
$field_type=$fields_type[$arr['field']];
if(is_wr_custom())
$arr['table']=$table_name;
if ( IsBinaryType( $field_type ) ) {
$blobDisabled = "disabled";
$class = "";
$blobClass = "inactive";
$adClass = "inactive";
$blobCheck = "";
}
if ( $class == "active" && $blobClass == "active" ) {
$blobClass = "";
}
$tgFields .='<tr id="'. GoodFieldName($arr['table'].".".$arr['field']) .'" class="tbody">
<td width="10px" style="border:0px">
<div style="height:7px">';
if($disabled=="")
示例7: addSpanVal
/**
* Add span val for lookup fields, and average|total|count totals
*/
function addSpanVal($fName, &$data)
{
global $strTableName;
$pSet = new ProjectSettings($strTableName, PAGE_LIST);
$type = $pSet->getFieldType($fName);
if ((@$this->arrFieldSpanVal[$fName] == 2 || @$this->arrFieldSpanVal[$fName] == 1) && !IsBinaryType($type)) {
return "val=\"" . runner_htmlspecialchars($data[$fName]) . "\" ";
}
}
示例8: WRadd_db_quotes
function WRadd_db_quotes($field, $value, $table = "")
{
$connection = getWebreportConnection();
$type = WRGetFieldType($table . "." . $field);
if (IsBinaryType($type)) {
return $connection->addSlashesBinary($value);
}
if (($value === "" || $value === FALSE) && !IsCharType($type)) {
return "null";
}
if (NeedQuotes($type)) {
if (!IsDateFieldType($type)) {
$value = $connection->prepareString($value);
} else {
$value = $connection->addDateQuotes($value);
}
} else {
$strvalue = (string) $value;
$strvalue = str_replace(",", ".", $strvalue);
if (is_numeric($strvalue)) {
$value = $strvalue;
} else {
$value = 0;
}
}
return $value;
}
示例9: baseSQLWhere
/**
* @param String strSearchOption
* @return String | Boolean
*/
function baseSQLWhere($strSearchOption)
{
if(IsBinaryType($this->type))
return false;
if($strSearchOption != 'Empty')
return "";
$fullFieldName = GetFullFieldName($this->field, $this->pageObject->tName);
if( IsCharType($this->type) && (!$this->ismssql || !$this->btexttype) && !$this->isOracle )
return "(".$fullFieldName." is null or ".$fullFieldName."='')";
if( $this->ismssql && $this->btexttype )
return "(".$fullFieldName." is null or ".$fullFieldName." LIKE '')";
return $fullFieldName." is null";
}
示例10: Update
/**
* Update record in the table.
* @intellisense
*/
function Update()
{
global $dal_info;
$tableinfo =& $dal_info[$this->m_TableName];
$updateParam = "";
$updateValue = "";
$blobs = array();
foreach ($tableinfo as $fieldname => $fld) {
$command = 'if(isset($this->' . $fld['varname'] . ')) { ';
if ($fld["key"]) {
$command .= '$this->Param[\'' . escapesq($fieldname) . '\'] = $this->' . $fld['varname'] . ';';
} else {
$command .= '$this->Value[\'' . escapesq($fieldname) . '\'] = $this->' . $fld['varname'] . ';';
}
$command .= ' }';
eval($command);
if (!$fld["key"] && !array_key_exists(strtoupper($fieldname), array_change_key_case($this->Param, CASE_UPPER))) {
foreach ($this->Value as $field => $value) {
if (strtoupper($field) != strtoupper($fieldname)) {
continue;
}
$updateValue .= $this->_connection->addFieldWrappers($fieldname) . "=" . $this->PrepareValue($value, $fld["type"]) . ", ";
if ($this->_connection->dbType == nDATABASE_Oracle || $this->_connection->dbType == nDATABASE_DB2 || $this->_connection->dbType == nDATABASE_Informix) {
if (IsBinaryType($fld["type"])) {
$blobs[$fieldname] = $value;
}
if ($this->_connection->dbType == nDATABASE_Informix && IsTextType($fld["type"])) {
$blobs[$fieldname] = $value;
}
}
break;
}
} else {
foreach ($this->Param as $field => $value) {
if (strtoupper($field) != strtoupper($fieldname)) {
continue;
}
$updateParam .= $this->_connection->addFieldWrappers($fieldname) . "=" . $this->PrepareValue($value, $fld["type"]) . " and ";
break;
}
}
}
// construct SQL and do update
if ($updateParam) {
$updateParam = substr($updateParam, 0, -5);
}
if ($updateValue) {
$updateValue = substr($updateValue, 0, -2);
}
if ($updateValue && $updateParam) {
$dalSQL = "update " . $this->_connection->addTableWrappers($this->m_TableName) . " set " . $updateValue . " where " . $updateParam;
$this->Execute_Query($blobs, $dalSQL, $tableinfo);
}
// cleanup
$this->Reset();
}
示例11: showDBValue
/**
* Get the field's content
* @param &Array data
* @param String keylink
* @return String
*/
public function showDBValue(&$data, $keylink = "")
{
$value = $data[$this->field];
if (IsBinaryType($this->fieldType)) {
$value = "LONG BINARY DATA - CANNOT BE DISPLAYED";
$this->searchHighlight = false;
}
if ($value === false) {
$value = "";
}
if ($this->editFormat == EDIT_FORMAT_CHECKBOX && $this->viewFormat == FORMAT_NONE) {
if ($value && $value != 0) {
$value = "Yes";
} else {
$value = "No";
}
$this->searchHighlight = false;
}
if ($this->container->forExport == "excel" || $this->container->forExport == "csv") {
return $value;
}
$processedText = $this->processText($value, $keylink);
return nl2br($processedText);
}
示例12: baseSQLWhere
function baseSQLWhere($strSearchOption)
{
$this->btexttype = IsTextType($this->type);
if (IsBinaryType($this->type)) {
return false;
}
if ($strSearchOption == 'Empty') {
if (IsCharType($this->type) && (!$this->ismssql || !$this->btexttype) && !$this->isOracle) {
return "(" . GetFullFieldNameForInsert($this->pageObject->pSetEdit, $this->field) . " is null or " . GetFullFieldNameForInsert($this->pageObject->pSetEdit, $this->field) . "='')";
} elseif ($this->ismssql && $this->btexttype) {
return "(" . GetFullFieldNameForInsert($this->pageObject->pSetEdit, $this->field) . " is null or " . GetFullFieldNameForInsert($this->pageObject->pSetEdit, $this->field) . " LIKE '')";
} else {
return GetFullFieldNameForInsert($this->pageObject->pSetEdit, $this->field) . " is null";
}
}
return "";
}
示例13: add_db_quotes
/**
* @intellisense
*/
function add_db_quotes($field, $value, $table = "", $type = null)
{
global $strTableName, $locale_info;
if($table=="")
$table=$strTableName;
$pSet = new ProjectSettings($table);
if($type == null)
$type = $pSet->getFieldType($field);
if(IsBinaryType($type))
return db_addslashesbinary($value);
if(($value==="" || $value===FALSE || is_null($value)) && !IsCharType($type))
return "null";
if(NeedQuotes($type))
{
if(!IsDateFieldType($type))
$value=db_prepare_string($value);
else
{
$y = "(\d\d\d\d)";
$m = "(0?[1-9]|1[0-2])";
$d = "(0?[1-9]|[1-2][0-9]|3[0-1])";
$delim = "(-|".preg_quote($locale_info["LOCALE_SDATE"], "/").")";
$reg = "/".$d.$delim.$m.$delim.$y."|".$m.$delim.$d.$delim.$y."|".$y.$delim.$m.$delim.$d."/";
if( !preg_match($reg, $value, $matches) )
return "null";
$value=db_datequotes($value);
}
}
else
{
$strvalue = (string)$value;
if(is_numeric($strvalue))
$value = str_replace(",",".",$strvalue);
else
$value=0;
}
return $value;
}
示例14: getSaveStatusJSON
/**
* Get an array containing the record save status
* @return Array
*/
protected function getSaveStatusJSON()
{
$returnJSON = array();
if ($this->action != "edited" || $this->mode == EDIT_SIMPLE) {
return $returnJSON;
}
$returnJSON['success'] = $this->updatedSuccessfully;
$returnJSON['message'] = $this->message;
$returnJSON['lockMessage'] = $this->lockingMessageText;
if (!$this->isCaptchaOk) {
$returnJSON['captcha'] = false;
}
if (!$this->updatedSuccessfully) {
return $returnJSON;
}
// successful update. Return new keys and field values
$data = $this->getCurrentRecordInternal();
if (!$data) {
$data = $this->newRecordData;
}
// details tables keys
$returnJSON['detKeys'] = array();
foreach ($this->pSet->getDetailTablesArr() as $dt) {
$dkeys = array();
foreach ($dt["masterKeys"] as $idx => $mk) {
$dkeys["masterkey" . ($idx + 1)] = $data[$mk];
}
$returnJSON['detKeys'][$dt['dDataSourceTable']] = $dkeys;
}
// prepare field values
// keys
$keyParams = array();
foreach ($this->keyFields as $i => $k) {
$keyParams[] = "key" . ($i + 1) . "=" . rawurldecode($this->keys[$k]);
}
$keylink = "&" . implode("&", $keyParams);
// values
$values = array();
$rawValues = array();
$fields = $this->pSet->getFieldsList();
foreach ($fields as $f) {
$value = $this->showDBValue($f, $data, $keylink);
$values[$f] = $value;
if (IsBinaryType($this->pSet->getFieldType($f))) {
$rawValues[$f] = "";
} else {
$rawValues[$f] = substr($data[$f], 0, 100);
}
}
$returnJSON['keys'] = $this->jsKeys;
$returnJSON['keyFields'] = $this->keyFields;
$returnJSON['vals'] = $values;
$returnJSON['fields'] = $fields;
$returnJSON['rawVals'] = $rawValues;
$returnJSON['hrefs'] = $this->buildDetailGridLinks($returnJSON['detKeys']);
// the record might become non-editable after updating
if (!$this->IsRecordEditable(false)) {
$returnJSON['nonEditable'] = true;
}
return $returnJSON;
}
示例15: _fetch_array
/**
* Fetch a result row as an array
* @param Mixed qHanle The query handle
* @param Number assoc (optional)
* @return Array
*/
protected function _fetch_array($qHanle, $assoc = 1)
{
$ret = array();
if ($qHanle->EOF()) {
return false;
}
try {
for ($i = 0; $i < $this->num_fields($qHanle); $i++) {
if (IsBinaryType($qHanle->Fields[$i]->Type) && $qHanle->Fields[$i]->Type != 128 || $qHanle->Fields[$i]->Type == 203) {
$str = "";
if ($qHanle->Fields[$i]->ActualSize > 0) {
$size = $qHanle->Fields[$i]->ActualSize;
$val = $qHanle->Fields[$i]->GetChunk($size);
if (is_array($val) || is_object($val)) {
$str = str_pad("", $size);
$j = 0;
foreach ($val as $byte) {
$str[$j++] = chr($byte);
}
} else {
$str = $val;
}
}
if ($assoc) {
$ret[$qHanle->Fields[$i]->Name] = $str;
} else {
$ret[$i] = $str;
}
} else {
$value = $qHanle->Fields[$i]->Value;
if (is_null($value)) {
$val = NULL;
} else {
if (isdatefieldtype($qHanle->Fields[$i]->Type)) {
$value = localdatetime2db((string) $qHanle->Fields[$i]->Value, $this->access_dmy);
}
if (IsNumberType($qHanle->Fields[$i]->Type)) {
$val = floatval($value);
} else {
$val = strval($value);
}
}
if ($assoc) {
$ret[$qHanle->Fields[$i]->Name] = $val;
} else {
$ret[$i] = $val;
}
}
}
$qHanle->MoveNext();
} catch (com_exception $e) {
trigger_error($e->getMessage(), E_USER_ERROR);
}
return $ret;
}