當前位置: 首頁>>代碼示例>>PHP>>正文


PHP D::stack方法代碼示例

本文整理匯總了PHP中D::stack方法的典型用法代碼示例。如果您正苦於以下問題:PHP D::stack方法的具體用法?PHP D::stack怎麽用?PHP D::stack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在D的用法示例。


在下文中一共展示了D::stack方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: query

	function query($sql, $returnType=null) {
		if($this->prepared == false) {
			$this->prepare($sql);
		}
		//echo "\n SQL call = " . $sql . "\n";
		
		$this->queries[] = $sql;
	//	$this->result = $this->connection->query($sql);
		D::log("\n" . $sql, 'SQL call');
		
		$this->result = mysql_query($sql, $this->connection);
		
		$this->prepared = false;
		
		if(!$this->result) {
			D::stack();
			D::log(mysql_error($this->connection), 'SQL Errors');
			return false;
		}
		
		$returnArray = array();
/* 	@todo
get rid of this switch and use an array of functions instead.
	 */
	 	if(!isset($returnType)) {
	 		return true;
	 	}
		switch ($returnType) {
			case 'object':
				if(!is_resource($this->result)) {
					D::stackTrace();
				}
				while($row = mysql_fetch_object($this->result)) {
					$returnArray[] = $row;
				}
				return $returnArray;
					
				
				break;
			case 'assoc':
				while($row = mysql_fetch_assoc($this->result)) {
					$returnArray[] = $row;
				}
				return $returnArray;
				break;
			case 'driver':
				return $this->result;
			break;
			case 'raw':
				return $this->result;
				break;
			default:
				return true;
		}
	}
開發者ID:noblejay,項目名稱:Sweet-Framework,代碼行數:55,代碼來源:My_SQL.php

示例2: _buildPull

	function _buildPull($pull, $pullRel, $tableName, $lfName=null, $rfName=null) {
		$select = $join = array();
		//JOIN CODE:
		
		if(is_array($tableName)) {
			$tableName = join('$', ($tableName));
		}
		
		if(is_array($lfName)) {
			//D::log($pull, '$pull aka $k');
			//D::log($lfName, 'lfName');
			D::stack('is_array($lfName)');
		}
		
		$join[$this->tableName . ' AS ' . $pull] = array(
			$tableName . '.' . $lfName => $pull . '.' . $rfName
		);
		
		//SELECT CODE:
		foreach(array_keys($this->fields) as $field) {
			//$select[$pull . '.' . $field] = str_replace('$', '.', $pull) . '.' . $field;
			$select[str_replace('$', '.', $pull) . '.' . $field] = $pull . '.' . $field;
		}
	//	D::log($select, 'built select');
		return array(
			'join' => $join,
			'select' => $select
		);
	}	
開發者ID:noblejay,項目名稱:Sweet-Framework,代碼行數:29,代碼來源:SweetModel.php

示例3: warn

	static function warn($warning='Warning') {
		//D::show('WHAT');
		if(self::$config['warnings']) {
			if(!extension_loaded('xdebug')) {
				D::show(D::stack(), $warning);
			}
			trigger_error($warning);
		}		
	}
開發者ID:noblejay,項目名稱:Sweet-Framework,代碼行數:9,代碼來源:D.php


注:本文中的D::stack方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。