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


PHP mssql_init函数代码示例

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


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

示例1: _prepare

 /**
  * Prepares statement handle
  *
  * @param string $sql
  * @return void
  * @throws Exception
  */
 protected function _prepare($sql)
 {
     $connection = $this->_adapter->getConnection();
     $this->_stmt = mssql_init(uniqid('StatementSQL'), $connection);
     if (!$this->_stmt) {
         throw new Exception(mssql_get_last_message());
     }
     $this->_originalSQL = $sql;
 }
开发者ID:diglin,项目名称:diglin_mssql,代码行数:16,代码来源:Mssql.php

示例2: PrepareSP

	public function PrepareSP($sql)
	{
		if (!$this->_has_mssql_init) {
			ADOConnection::outp( "PrepareSP: mssql_init only available since PHP 4.1.0");
			return $sql;
		}
		if (is_string($sql)) $sql = str_replace('||','+',$sql);
		$stmt = mssql_init($sql,$this->_connectionID);
		if (!$stmt)  return $sql;
		return array($sql,$stmt);
	}
开发者ID:joeymetal,项目名称:v1,代码行数:11,代码来源:adodb-mssqlpo.inc.php

示例3: 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

示例4: mssql_query

$sql = <<<EOSQL
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));
开发者ID:johnnyzhong,项目名称:freetds,代码行数:31,代码来源:rpc1.php

示例5: mssql_free_statement

} else {
    mssql_free_statement($proc);
    echo "test1 = {$test1}\n";
    if ($test1 != 10) {
        echo "Expected test1 10\n";
        $err = TRUE;
    }
    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') {
开发者ID:ljia310,项目名称:freetds,代码行数:31,代码来源:rpc2.php

示例6: prepareCall

 /**
  * Creates a CallableStatement object for calling database stored procedures.
  * 
  * @param string $sql
  * @return CallableStatement
  * @throws SQLException
  */
 function prepareCall($sql)
 {
     require_once 'creole/drivers/mssql/MSSQLCallableStatement.php';
     $stmt = mssql_init($sql);
     if (!$stmt) {
         throw new SQLException('Unable to prepare statement', mssql_get_last_message(), $sql);
     }
     return new MSSQLCallableStatement($this, $stmt);
 }
开发者ID:nshong,项目名称:processmaker,代码行数:16,代码来源:MSSQLConnection.php

示例7: mssql_init

<?php

include_once '../includes/connection.php';
$Copyproc = mssql_init('websitecopyproc');
$LocID = $_POST['LocID'];
$SiteKey = $_POST['SiteKey'];
$CopyTypeKey = $_POST['CopyTypeKey'];
$short = $_POST['short'];
$location = $_POST['location'];
$about = $_POST['about'];
$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);
开发者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: 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

示例10: 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

示例11: InitSp

 public function InitSp()
 {
     switch (strtoupper($this->dbdriver)) {
         case "POSTGRES":
             break;
         case "MSSQL":
             return mssql_init($this->pSchema . "." . $this->pNameStoreProcedure, $this->pConnection);
             break;
     }
 }
开发者ID:gianpascal,项目名称:yachay,代码行数:10,代码来源:Adophp.class.php

示例12: mssql_init

<?php

//Connect to Poolparty
include_once '../includes/connection.php';
// Create a new statement
$stmt = mssql_init('updatecatalog');
// Some data strings
$SchoolInfoKey = $_POST['SchoolInfoKey'];
$LocID = $_POST['LocID'];
$CatalogURL = $_POST['CatalogURL'];
// Bind values
mssql_bind($stmt, '@SchoolInfoKey', $SchoolInfoKey, SQLINT4, false, false, 20);
mssql_bind($stmt, '@LocID', $LocID, SQLINT4, false, false, 20);
mssql_bind($stmt, '@CatalogURL', $CatalogURL, SQLTEXT, false, false, 500);
// 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,代码来源:catalog-update.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: SetName

 function SetName($Name)
 {
     $this->Handle = mssql_init($Name, $this->Connection);
 }
开发者ID:michalkoczwara,项目名称:WebGoatPHP,代码行数:4,代码来源:mssql.php


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