当前位置: 首页>>代码示例>>PHP>>正文


PHP mssql_execute函数代码示例

本文整理汇总了PHP中mssql_execute函数的典型用法代码示例。如果您正苦于以下问题:PHP mssql_execute函数的具体用法?PHP mssql_execute怎么用?PHP mssql_execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mssql_execute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ReaPaises

function ReaPaises($nIdPais)
{
    $sp = mssql_init('REAPAISES');
    //SP
    //Parámetros SP
    mssql_bind($sp, '@nIdPais', $nIdPais, SQLINT4);
    $resultado = mssql_execute($sp);
    //Ejecución SP
    $i = 0;
    while ($row = mssql_fetch_array($resultado)) {
        $html[$i]['id_pais'] = $row[0];
        $html[$i]['nombre'] = $row[1];
        $i++;
    }
    return $html;
    mssql_free_result($resultado);
    //Liberación del recurso
    mssql_free_statement($sp);
    //Liberación del recurso
}
开发者ID:aabritog,项目名称:APP0295,代码行数:20,代码来源:servidor.php

示例2: mssql_query

CREATE PROCEDURE sp_php_test AS
\t-- first Query: no match
\tSELECT * FROM php_test WHERE id=10000
\t-- second Query: 2 matches
\tSELECT * FROM php_test
EOSQL;
mssql_query($sql, $conn) or die("error querying");
# one time to let sql compile and compute statistics on table
$rs = mssql_query("sp_php_test", $conn) or die("error querying");
mssql_next_result($rs);
mssql_next_result($rs);
mssql_free_result($rs);
$err = "";
$num_res = 0;
$stmt = mssql_init("sp_php_test", $conn);
$rs = mssql_execute($stmt);
if (is_resource($rs)) {
    echo "fetching...\n";
    do {
        ++$num_res;
        echo "Processing result {$num_res}\n";
        echo "Num rows = " . mssql_num_rows($rs) . "\n";
        if (!$err && $num_res == 1 && mssql_num_rows($rs) != 0) {
            $err = "Expected 0 rows from recordset {$num_res}";
        }
        if (!$err && $num_res == 2 && mssql_num_rows($rs) != 2) {
            $err = "Expected 2 rows from recordset {$num_res}";
        }
        // Process result
    } while (mssql_next_result($rs));
    mssql_free_result($rs);
开发者ID:johnnyzhong,项目名称:freetds,代码行数:31,代码来源:rpc1.php

示例3: _query

	function _query($sql,$inputarr)
	{
		$this->_errorMsg = false;
		if (is_array($inputarr)) {
			
			# bind input params with sp_executesql: 
			# see http://www.quest-pipelines.com/newsletter-v3/0402_F.htm
			# works only with sql server 7 and newer
			if (!is_array($sql)) $sql = $this->Prepare($sql);
			$params = '';
			$decl = '';
			$i = 0;
			foreach($inputarr as $v) {
				if ($decl) {
					$decl .= ', ';
					$params .= ', ';
				}	
				if (is_string($v)) {
					$len = strlen($v);
					if ($len == 0) $len = 1;
					
					if ($len > 4000 ) {
						// NVARCHAR is max 4000 chars. Let's use NTEXT
						$decl .= "@P$i NTEXT";
					} else {
						$decl .= "@P$i NVARCHAR($len)";
					}

					$params .= "@P$i=N". (strncmp($v,"'",1)==0? $v : $this->qstr($v));
				} else if (is_integer($v)) {
					$decl .= "@P$i INT";
					$params .= "@P$i=".$v;
				} else {
					$decl .= "@P$i FLOAT";
					$params .= "@P$i=".$v;
				}
				$i += 1;
			}
			$decl = $this->qstr($decl);
			if ($this->debug) ADOConnection::outp("<font size=-1>sp_executesql N{$sql[1]},N$decl,$params</font>");
			$rez = mssql_query("sp_executesql N{$sql[1]},N$decl,$params");
			
		} else if (is_array($sql)) {
			# PrepareSP()
			$rez = mssql_execute($sql[1]);
			
		} else {
			$rez = mssql_query($sql,$this->_connectionID);
		}
		return $rez;
	}
开发者ID:songchin,项目名称:Cacti,代码行数:51,代码来源:adodb-mssql.inc.php

示例4: mssql_init

    echo "retval = {$retval}\n";
    if ($retval != 3) {
        echo "Expected retval 3\n";
        $err = TRUE;
    }
}
// Test 4, SQLVARCHAR output
//
$proc = mssql_init("sp_php_test4", $conn);
$test1 = "";
$retval = 0;
// Bind the parameters
mssql_bind($proc, "@test1", &$test1, SQLVARCHAR, TRUE, FALSE, 13);
// Bind the return value
mssql_bind($proc, "RETVAL", &$retval, SQLINT4);
$result = mssql_execute($proc);
if (!$result) {
    echo "Last message from SQL : " . mssql_get_last_message() . "\n";
    $err = TRUE;
    mssql_free_statement($proc);
} else {
    mssql_free_statement($proc);
    echo "test1 = >{$test1}<\n";
    if ($test1 != 'xyz45678') {
        echo "Expected test1 >xyz45678<\n";
        $err = TRUE;
    }
    echo "retval = {$retval}\n";
    if ($retval != 4) {
        echo "Expected retval 4\n";
        $err = TRUE;
开发者ID:ljia310,项目名称:freetds,代码行数:31,代码来源:rpc2.php

示例5: executeQuery

 /**
  * @see CallableStatement::executeQuery()
  */
 function executeQuery($p1 = null, $fetchmode = null)
 {
     $params = null;
     if ($fetchmode !== null) {
         $params = $p1;
     } elseif ($p1 !== null) {
         if (is_array($p1)) {
             $params = $p1;
         } else {
             $fetchmode = $p1;
         }
     }
     if ($params) {
         for ($i = 0, $cnt = count($params); $i < $cnt; $i++) {
             $this->set($i + 1, $params[$i]);
         }
     }
     $this->result = mssql_execute($this->stmt);
     if (!$this->result) {
         throw new SQLException('unable to execute callable statement', mssql_get_last_message());
     }
     return new MSSQLResultSet($this->conn, $this->result, $fetchmode, $this->offset, $this->limit);
 }
开发者ID:taryono,项目名称:school,代码行数:26,代码来源:MSSQLCallableStatement.php

示例6: set_time_limit

<?php

set_time_limit(10000);
require "../config/main.php";
$mdir = opendir("updates");
while ($arr = readdir($mdir)) {
    if (strstr(strtolower($arr), ".sql")) {
        $dbms_schema = 'updates/' . $arr;
        $sql_query = file_get_contents($dbms_schema);
        mssql_execute($sql_query, true);
        mssql_free_statement($stmt);
    }
}
echo "Se han actualizado " . $upt * 1 . " consultas en la base de datos";
function remove_comments(&$output)
{
    $lines = explode("\n", $output);
    $output = "";
    // try to keep mem. use down
    $linecount = count($lines);
    $in_comment = false;
    for ($i = 0; $i < $linecount; $i++) {
        if (preg_match("/^\\/\\*/", preg_quote($lines[$i]))) {
            $in_comment = true;
        }
        if (!$in_comment) {
            $output .= $lines[$i] . "\n";
        }
        if (preg_match("/\\*\\/\$/", preg_quote($lines[$i]))) {
            $in_comment = false;
        }
开发者ID:lflores10,项目名称:octa,代码行数:31,代码来源:updatesql.php

示例7: mssql_bind

$community = $_POST['community'];
$school = $_POST['school'];
/*
echo "<p>LocID:</p>";
echo $LocID;
echo "<p>SiteKey: </p>";
echo $SiteKey;
echo "<p>Copy Type Key</p>";
echo $CopyTypeKey;
echo "<p>Short:</p>";
echo  $short;
echo "<p>Location: </p>";
echo  $location;
echo "<p>about: </p>";
echo $about;
echo "<p>community: </p>";
echo  $community;
echo "<p>school; </p>";
echo $school;
*/
mssql_bind($Copyproc, '@LocID', $LocID, SQLINT4, false, false, 10);
mssql_bind($Copyproc, '@SiteKey', $SiteKey, SQLINT4, false, false, 1);
mssql_bind($Copyproc, '@CopyTypeKey', $CopyTypeKey, SQLINT1, false, false, 1);
mssql_bind($Copyproc, '@short', $short, SQLTEXT, false, false, 255);
mssql_bind($Copyproc, '@location', $location, SQLTEXT, false, false, 255);
mssql_bind($Copyproc, '@about', $about, SQLTEXT, false, false, 255);
mssql_bind($Copyproc, '@community', $community, SQLTEXT, false, false, 255);
mssql_bind($Copyproc, '@school', $school, SQLTEXT, false, false, 255);
mssql_execute($Copyproc);
mssql_close();
header("Location: http://toolkit.empire-dev.com/copy.php");
开发者ID:brandonwk,项目名称:webadmin,代码行数:31,代码来源:websitecopy.php

示例8: exeStoredProc

 /**
  * method to deal with the execution of MS SQL stored proceedured
  * @param $string $procName The name of the proceedure to execute
  * @param array $paramArray An array containing entries for each paramneeded but the stored proceedure see the exampel in the code below
  */
 function exeStoredProc($procName, $paramArray = false, $skip_results = false)
 {
     // example param array
     // $paramArray = array ('LocationName' => array ('VALUE' => 'the clients host name', 'TYPE' => 'SQLVARCHAR', 'ISOUTPUT' => 'false', 'IS_NULL' =>'false', 'MAXLEN' => '255' ) );
     // each element in the paramArray must idetify a paramiter required by the stored proceedure and can tain an array of settings from that paramiter
     // see http://php.net/manual/en/function.mssql-bind.php for information on the values for these paramiters
     // initiate the stored proceedure
     $stmt = mssql_init($procName, $this->linkid);
     // bind paramiters
     if ($paramArray) {
         foreach ($paramArray as $paramName => $values) {
             mssql_bind($stmt, $paramName, $values['VALUE'], $values['TYPE'], $values['ISOUTPUT'], $values['IS_NULL'], $values['MAXLEN']);
         }
     }
     // execute the stored proceedure
     $results = mssql_execute($stmt);
     // if we do not get anu results return false
     if (!$results) {
         return false;
         // if we get results then put them in to an array and return it
     } else {
         // define the array to return
         $resultArray = array();
         // loop throught he result set and place each result to the resultArray
         do {
             while ($row = mssql_fetch_row($stmt)) {
                 $resultArray[] = $row;
             }
         } while (mssql_next_result($stmt));
         // clean up the statment ready for the next useexec SELLING_GetLocation @LocationName='it-leigh.skilouise.com'
         mssql_free_statement($stmt);
         //returnt he result array
         return $resultArray;
     }
 }
开发者ID:exaflo,项目名称:appli,代码行数:40,代码来源:class.mssql.php

示例9: Execute

 function Execute()
 {
     $this->Result = mssql_execute($this->Handle);
     if (is_resource($this->Result)) {
         return $this->GetResults();
     } else {
         return $this->Result;
     }
 }
开发者ID:michalkoczwara,项目名称:WebGoatPHP,代码行数:9,代码来源:mssql.php

示例10: _query

	function _query($sql,$inputarr=false)
	{
		$this->_errorMsg = false;
		if (is_array($inputarr)) {

			# bind input params with sp_executesql:
			# see http://www.quest-pipelines.com/newsletter-v3/0402_F.htm
			# works only with sql server 7 and newer
            $getIdentity = false;
            if (!is_array($sql) && preg_match('/^\\s*insert/i', $sql)) {
                $getIdentity = true;
                $sql .= (preg_match('/;\\s*$/i', $sql) ? ' ' : '; ') . $this->identitySQL;
            }
			if (!is_array($sql)) $sql = $this->Prepare($sql);
			$params = '';
			$decl = '';
			$i = 0;
			foreach($inputarr as $v) {
				if ($decl) {
					$decl .= ', ';
					$params .= ', ';
				}
				if (is_string($v)) {
					$len = strlen($v);
					if ($len == 0) $len = 1;

					if ($len > 4000 ) {
						// NVARCHAR is max 4000 chars. Let's use NTEXT
						$decl .= "@P$i NTEXT";
					} else {
						$decl .= "@P$i NVARCHAR($len)";
					}

					$params .= "@P$i=N". (strncmp($v,"'",1)==0? $v : $this->qstr($v));
				} else if (is_integer($v)) {
					$decl .= "@P$i INT";
					$params .= "@P$i=".$v;
				} else if (is_float($v)) {
					$decl .= "@P$i FLOAT";
					$params .= "@P$i=".$v;
				} else if (is_bool($v)) {
					$decl .= "@P$i INT"; # Used INT just in case BIT in not supported on the user's MSSQL version. It will cast appropriately.
					$params .= "@P$i=".(($v)?'1':'0'); # True == 1 in MSSQL BIT fields and acceptable for storing logical true in an int field
				} else {
					$decl .= "@P$i CHAR"; # Used char because a type is required even when the value is to be NULL.
					$params .= "@P$i=NULL";
					}
				$i += 1;
			}
			$decl = $this->qstr($decl);
			if ($this->debug) ADOConnection::outp("<font size=-1>sp_executesql N{$sql[1]},N$decl,$params</font>");
			$rez = mssql_query("sp_executesql N{$sql[1]},N$decl,$params", $this->_connectionID);
            if ($getIdentity) {
                $arr = @mssql_fetch_row($rez);
                $this->lastInsID = isset($arr[0]) ? $arr[0] : false;
                @mssql_data_seek($rez, 0);
            }

		} else if (is_array($sql)) {
			# PrepareSP()
			$rez = mssql_execute($sql[1]);
            $this->lastInsID = false;

		} else {
			$rez = mssql_query($sql,$this->_connectionID);
            $this->lastInsID = false;
		}
		return $rez;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:69,代码来源:adodb-mssql.inc.php

示例11: mssql_init

<?php

//Connect to Poolparty
include_once '../includes/connection.php';
// Create a new statement
$stmt = mssql_init('Classstartproc');
// Some data strings
$ClassStartSchedulesID = $_POST['ClassStartSchedulesID'];
$LocID = $_POST['LocID'];
$ScheduleID = $_POST['ScheduleID'];
// Bind values
mssql_bind($stmt, '@ClassStartSchedulesID', $ClassStartSchedulesID, SQLINT1, false, false, 20);
mssql_bind($stmt, '@LocID', $LocID, SQLINT1, false, false, 20);
mssql_bind($stmt, '@ScheduleID', $ScheduleID, SQLTEXT, false, false, 50);
// Execute the statement
$result = mssql_execute($stmt);
echo $result;
// // And we can free it like so:
// mssql_free_statement($stmt);
//
// echo $stmt;
header("Location: http://54.209.36.245/programs.php");
exit;
开发者ID:brandonwk,项目名称:webadmin,代码行数:23,代码来源:Class-start.php

示例12: Execute

	public function Execute(){
		if ($this->commandtype == self::C_CMDTEXT)
		{
			//Returns a TRecordset object
			return $this->activeconnection->Execute($this->commandtext);
		}
		elseif ($this->commandtype == self::C_CMDSTOREDPROC)
		{
			try
			{				
				//Call Stored Procedure
				$this->stmt = @mssql_init($this->commandtext, $this->activeconnection->connection_id);
			
				//If can't call Stored Procedure
				if (!$this->stmt) throw new TException(TCustomMessage::GetMessage(5009, $this->commandtext), 5009);

				//Add the SQL Parameters to the Stored Procedure if it exists
				for ($x = 0; $x < $this->parameters->count; $x ++)
				{
					//Add SQL Parameter
					$k = @mssql_bind($this->stmt, $this->parameters->parameter($x)->name, &$this->parameters->parameter($x)->value, $this->parameters->parameter($x)->type,
					$this->parameters->parameter($x)->is_output, $this->parameters->parameter($x)->is_null, $this->parameters->parameter($x)->maxlen);

					//If can't add SQL Parameter
					if (!$k) throw new TException(TCustomMessage::GetMessage(5010, $this->commandtext), 5010);
				}
			
				//Execute Stored Procedure
				$this->result_id = @mssql_execute($this->stmt);	
	
				//If can't execute Stored Procedure
				if (!$this->result_id) throw new TException(TCustomMessage::GetMessage(5011, $this->commandtext), 5011);		

				//Returns a TRecordset object
				return new TRecordset($this->result_id, $this->activeconnection);
			}
			catch (TException $e)
			{
				//Set the exception
				$this->activeconnection->err = $e;
						
				//TCommand::Execute() failed, returns false 
				return false;			
			}
		}
	}
开发者ID:abelcondear,项目名称:repo,代码行数:46,代码来源:MSSQL_ADO.inc.php

示例13: func_mssql_query

function func_mssql_query($query, $sess, &$bin, &$biVal, &$biLen, &$biRes, &$biType)
{
    if (count($bin) >= 1) {
        $res = mssql_init($query);
        for ($i = 0; $i < count($bin); $i++) {
            $TypeParam = TRUE;
            $biRes[$i] = $biVal[$i];
            if ($biLen[$i] == -1) {
                $TypeParam = FALSE;
            }
            if ($biType[$i] == 1) {
                $msType = SQLVARCHAR;
            }
            if ($biType[$i] == 2) {
                $msType = SQLINT4;
            }
            if ($biType[$i] == 3) {
                $msType = SQLFLT8;
            }
            if ($biType[$i] == 4) {
                $msType = SQLVARCHAR;
            }
            mssql_bind($res, $bin[$i], $biRes[$i], $msType, $TypeParam);
        }
        $resExec = mssql_execute($res);
        while (mssql_next_result($resExec)) {
        }
    } else {
        $resExec = mssql_query($query);
        if (!$resExec) {
            ErreurExecutionMSSQL();
        }
    }
    return $resExec;
}
开发者ID:EliosIT,项目名称:PS_AchatFilet,代码行数:35,代码来源:connect.php

示例14: executeStoreProcedure

 public static function executeStoreProcedure($storep, $params, $type)
 {
     $database = self::GetInstance();
     switch ($database->type) {
         case 'mysql':
             break;
         case 'mssql':
             if (extension_loaded('pdo_mssql')) {
             } else {
                 if (extension_loaded('mssql')) {
                     $proc = mssql_init($storep, $database->connection);
                     $proc_result = mssql_execute($proc);
                     if (!$result) {
                         echo 'Error in statement execution.\\n';
                         die('MSSQL error: ' . mssql_get_last_message());
                     }
                     return $result;
                 } else {
                     if (extension_loaded('sqlsrv')) {
                         $result = sqlsrv_query($database->connection, $query, $store, $params);
                         if ($result === false) {
                             echo 'Error in statement execution s.\\n';
                             die("Problemas en el store:" . sqlsrv_errors());
                         } else {
                             if ($type == "get") {
                                 $arr = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC);
                                 return $arr;
                             } else {
                                 return $result;
                             }
                         }
                     }
                 }
             }
             break;
         default:
             // Error is triggered for all other database types
             //trigger_error('This database type is not supported',E_USER_ERROR);
             break;
     }
 }
开发者ID:maroend,项目名称:protocolos,代码行数:41,代码来源:dbaccess.php

示例15: _query

 function _query($sql, $inputarr)
 {
     $this->_errorMsg = false;
     if (is_array($sql)) {
         $rez = mssql_execute($sql[1]);
     } else {
         $rez = mssql_query($sql, $this->_connectionID);
     }
     return $rez;
 }
开发者ID:sraj4,项目名称:EthicsPublicHtmlProd,代码行数:10,代码来源:adodb-mssql.inc.php


注:本文中的mssql_execute函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。