本文整理汇总了PHP中mssql_free_result函数的典型用法代码示例。如果您正苦于以下问题:PHP mssql_free_result函数的具体用法?PHP mssql_free_result怎么用?PHP mssql_free_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mssql_free_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
/**
* @param $sql
*
* @return array
*/
public function query($sql)
{
//
$this->connection = $this->getConnection();
// Run query
$query = mssql_query($sql, $this->connection);
// On error
if ($query === false) {
Response::error(500, $_SERVER["SERVER_PROTOCOL"] . ' DB query failed (SQL): ' . mssql_get_last_message());
}
// E.g. boolean is returned if no rows (e.g. no resource found or on UPDATE)
if ($query === true) {
$response = $query;
} else {
// Response
$response = array();
//
// Loop rows and add to response array
if (mssql_num_rows($query) > 0) {
while ($row = mssql_fetch_assoc($query)) {
$response[] = $row;
}
}
// Free the query result
mssql_free_result($query);
}
// Close link
$this->closeConnection();
//
return $response;
}
示例2: closeCursor
public function closeCursor()
{
if ($this->_result) {
mssql_free_result($this->_result);
$this->_result = false;
}
}
示例3: econnect_copy
function econnect_copy($sql, $key, $node)
{
global $old_gp;
global $new_gp;
$name = "";
$inc = 0;
$break = 0;
$st_proc = "";
$rset = mssql_query($sql, $old_gp);
while ($line = mssql_fetch_assoc($rset)) {
$st_proc = "";
$break = 0;
for ($inc = 0; $inc < mssql_num_fields($rset); $inc++, $break++) {
$name = trim(mssql_field_name($rset, $inc));
if ($break > 1) {
$st_proc .= "\n ";
$break = 0;
}
$st_proc .= "@I_v{$name}='" . str_replace("'", "''", trim($line[$name])) . "', ";
}
$st_proc = "\n declare @O_iErrorState int; declare @oErrString varchar(255); \n select @O_iErrorState = 0;\n exec {$node}\n {$st_proc} @oErrString = @oErrString output,@O_iErrorState = @O_iErrorState output;\n select @O_iErrorState as ret_val, ErrorDesc from DYNAMICS..taErrorCode where errorcode = @O_iErrorState;\n ";
#PHP bug fix work around
$st_proc = str_replace("@I_vUnrealized_Purchase_Price_Vari=", "@I_vUnrealized_Purchase_Price_Variance_Acct=", $st_proc);
echo "{$node} " . trim($line[$key]) . ". ";
$rset_x = mssql_query($st_proc, $new_gp);
$line_x = mssql_fetch_assoc($rset_x);
if ($line_x["ret_val"] == 0) {
echo "Successful.\n";
} else {
echo "Failed. Reason: " . trim($line_x["ErrorDesc"]) . "\n{$st_proc}\n";
#exit();
}
mssql_free_result($rset_x);
}
}
示例4: executeQuery
private function executeQuery()
{
$return = false;
if ($this->queryType == 'other') {
if (mssql_query($this->query, $this->link) === true) {
$return = true;
$this->error = mssql_get_last_message();
}
} else {
if ($result = mssql_query($this->query, $this->link)) {
// Conteo de registros
if ($this->queryType == 'insert' || $this->queryType == 'update' || $this->queryType == 'delete') {
$this->numRows = mssql_rows_affected($this->link);
$return = true;
} else {
$this->numRows = mssql_num_rows($result);
$fetchType = MSSQL_NUM;
if ($this->queryReturn == 'assoc') {
$fetchType = MSSQL_ASSOC;
} elseif ($this->queryReturn == 'both') {
$fetchType = MSSQL_BOTH;
}
$return = array();
while ($row = mssql_fetch_array($result, $fetchType)) {
array_push($return, $row);
}
}
$this->error = mssql_get_last_message();
mssql_free_result($result);
} else {
$this->error = mssql_get_last_message();
}
}
return $return;
}
示例5: free_result
function free_result()
{
if (is_resource($this->result_id)) {
mssql_free_result($this->result_id);
$this->result_id = FALSE;
}
}
示例6: free
/**
* This function frees the command reference.
*
* @access public
* @override
*/
public function free()
{
if ($this->command !== NULL) {
@mssql_free_result($this->command);
$this->command = NULL;
$this->record = FALSE;
}
}
示例7: free_result
function free_result()
{
if ($this->Query_ID) {
mssql_free_result($this->Query_ID);
}
$this->Query_ID = 0;
$this->VEOF = -1;
}
示例8: close
public function close()
{
if ($this->rsrc) {
mssql_free_result($this->rsrc);
$this->rsrc = null;
}
$this->current = null;
}
示例9: getLastId
public function getLastId()
{
$last_id = false;
$resource = mssql_query("SELECT @@identity AS id", $this->link);
if ($row = mssql_fetch_row($resource)) {
$last_id = trim($row[0]);
}
mssql_free_result($resource);
return $last_id;
}
示例10: getOneColumnAsArray
function getOneColumnAsArray()
{
$column = array();
$queryId = $this->connection->execute($this->getSQL());
while (is_array($row = mssql_fetch_row($queryId))) {
$column[] = is_numeric($row[0]) ? $row[0] : mb_convert_encoding($row[0], 'UTF-8', 'Windows-1251');
}
mssql_free_result($queryId);
return $column;
}
示例11: exec
public function exec(&$statement)
{
if ($result = @mssql_query($statement, $this->link)) {
if (is_resource($result)) {
mssql_free_result($result);
return 0;
}
return mssql_rows_affected($this->link);
}
return false;
}
示例12: loadTables
function loadTables()
{
if ($this->isExisting && !$this->isTablesLoaded) {
$queryId = $this->connection->execute("select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_CATALOG='" . $this->name . "'");
while (is_array($row = mssql_fetch_row($queryId))) {
$this->tables[$row[0]] = null;
}
mssql_free_result($queryId);
$this->isTablesLoaded = true;
}
}
示例13: getNamaBulanById
public function getNamaBulanById($id)
{
$sql = 'SELECT Bulan FROM ' . $this->table . ' WHERE BulanId=' . $id;
$result = mssql_query($sql);
if (mssql_num_rows($result) > 0) {
while ($val = mssql_fetch_assoc($result)) {
$namaBulan = $val['Bulan'];
}
}
mssql_free_result($result);
return $bulan;
}
示例14: getKecamatanByKelurahan
public function getKecamatanByKelurahan($id)
{
$sql = 'SELECT a.Nama, a.KecamatanId, a.KodeDepdagri FROM ' . $this->table . ' a INNER JOIN M_Kelurahan b on a.KecamatanId=b.KecamatanId WHERE b.KelurahanId=' . $id;
$result = mssql_query($sql);
$data = array();
if (mssql_num_rows($result) > 0) {
while ($val = mssql_fetch_assoc($result)) {
$data[] = array('KecamatanId' => $val['KecamatanId'], 'Nama' => $val['Nama'], 'KodeDedagri' => $val['KodeDepdagri']);
}
}
mssql_free_result($result);
return $data;
}
示例15: getAlasanTidakKbById
public function getAlasanTidakKbById($id)
{
$sql = 'SELECT * FROM ' . $this->table . ' WHERE ID=' . $id;
$result = mssql_query($sql);
$data = array();
if (mssql_num_rows($result) > 0) {
while ($val = mssql_fetch_assoc($result)) {
$data[] = array('ID' => $val['ID'], 'Alasan' => $val['Alasan'], 'SortNumber' => $val['SortNumber'], 'IsActive' => $val['IsActive']);
}
}
mssql_free_result($result);
return $data;
}