本文整理汇总了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;
}
示例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);
}
示例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
}
示例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));
示例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') {
示例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);
}
示例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);
示例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;
}
}
示例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;
示例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;
}
}
}
示例11: InitSp
public function InitSp()
{
switch (strtoupper($this->dbdriver)) {
case "POSTGRES":
break;
case "MSSQL":
return mssql_init($this->pSchema . "." . $this->pNameStoreProcedure, $this->pConnection);
break;
}
}
示例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;
示例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;
}
示例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;
}
}
示例15: SetName
function SetName($Name)
{
$this->Handle = mssql_init($Name, $this->Connection);
}