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


PHP sqlsrv_close函数代码示例

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


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

示例1: Query

 public function Query($Procedimiento, $RetornaDatos, $arrayValores = "")
 {
     $parametros = array();
     $NombreServidor = constant("sqlHost");
     $InfoConexion = array("UID" => constant("sqlUsuario"), "PWD" => constant("sqlContrasena"), "Database" => $this->NombreBaseDatos);
     $conn = sqlsrv_connect($NombreServidor, $InfoConexion);
     if (is_array($arrayValores)) {
         $stringInterrogacion = "(?";
         for ($i = 1; $i < count($arrayValores); $i++) {
             $stringInterrogacion .= ",?";
         }
         $stringInterrogacion .= ")";
         $Procedimiento = "{call " . $Procedimiento . " " . $stringInterrogacion . "}";
         for ($i = 0; $i < count($arrayValores); $i++) {
             array_push($parametros, array($arrayValores[$i], SQLSRV_PARAM_IN));
         }
     } else {
         $Procedimiento = "{call " . $Procedimiento . "}";
     }
     $stmt3 = sqlsrv_query($conn, $Procedimiento, $parametros);
     if ($RetornaDatos) {
         $array = array();
         while ($obj = sqlsrv_fetch_array($stmt3, SQLSRV_FETCH_ASSOC)) {
             $array[] = $obj;
         }
         return $array;
         sqlsrv_free_stmt($stmt3);
     }
     sqlsrv_close($conn);
 }
开发者ID:raicerk,项目名称:Biblioteca,代码行数:30,代码来源:Modelo.ddbb.php

示例2: disconnect

 /** Disconnects from database * */
 function disconnect()
 {
     if (DB_TYPE == 'sqlsrv') {
         if (@sqlsrv_close($this->_dbHandle) != 0) {
             return 1;
         } else {
             return 0;
         }
     } else {
         if (DB_TYPE == 'mssql') {
             if (@mssql_close($this->_dbHandle) != 0) {
                 return 1;
             } else {
                 return 0;
             }
         } else {
             if (DB_TYPE == 'mysql') {
                 if (@mysql_close($this->_dbHandle) != 0) {
                     return 1;
                 } else {
                     return 0;
                 }
             }
         }
     }
 }
开发者ID:bciv,项目名称:COMS,代码行数:27,代码来源:sqlquery.class.php

示例3: GetScheduleWithQuestionsOLD

function GetScheduleWithQuestionsOLD($groupid)
{
    include_once 'db_Connection.php';
    $conn = sqlsrv_connect($serverName, $connectionInfo);
    $questionvalues = array();
    $questions = array();
    $schedule = array();
    $schedulequestions = array();
    if ($conn) {
        //----get acadyear-------------------
        $acid = 0;
        $sqlstr = " SELECT [AcadYearID] FROM [dbo].[Groups] where [groupid]=? ";
        $params = array($groupid);
        $sqlquery = sqlsrv_query($conn, $sqlstr, $params);
        if ($sqlquery) {
            while ($row = sqlsrv_fetch_array($sqlquery, SQLSRV_FETCH_ASSOC)) {
                $acid = $row['AcadYearID'];
            }
            sqlsrv_free_stmt($sqlquery);
        }
        $sqlstr = " SELECT [questionTypeId],[value],[text] " . " FROM [dbo].[QuestionValues] " . " order by questionTypeId ";
        //  $params = array ($acid);
        $sqlquery = sqlsrv_query($conn, $sqlstr);
        if ($sqlquery) {
            while ($row = sqlsrv_fetch_object($sqlquery)) {
                $questionvalues[] = $row;
            }
            sqlsrv_free_stmt($sqlquery);
        }
        //----get question array-------------------
        $sqlstr = " SELECT [QuestionID],[QueastionText],[questionType],[maxmark],[NeedDescription],-1 as mark,'' as description " . " FROM [dbo].[Questions] " . " where [QuestionLecturer]=1 " . " and [Acadyear]=? ";
        $params = array($acid);
        $sqlquery = sqlsrv_query($conn, $sqlstr, $params);
        if ($sqlquery) {
            while ($row = sqlsrv_fetch_object($sqlquery)) {
                $row->questionValues = array();
                foreach ($questionvalues as &$questValue) {
                    if ($questValue->questionTypeId === $row->questionType) {
                        array_push($row->questionValues, $questValue);
                    }
                }
                $questions[] = $row;
            }
            sqlsrv_free_stmt($sqlquery);
        }
        //----get schadule array-------------------
        $sqlstr = " SELECT distinct [SubjID],[SubjName],[STypeID],[STypeName], [LectID], [LectName] " . " FROM [dbo].[Schedule] " . " WHERE groupID=? " . " order by [SubjID],[STypeID] ";
        $params = array($groupid);
        $sqlquery = sqlsrv_query($conn, $sqlstr, $params);
        if ($sqlquery) {
            while ($row = sqlsrv_fetch_object($sqlquery)) {
                $row->quests = $questions;
                $schedule[] = $row;
            }
            $schedulequestions = array("result" => 0, "data" => $schedule);
        }
        sqlsrv_close($conn);
    }
    return $schedulequestions;
}
开发者ID:Nata12,项目名称:SocHarcum,代码行数:60,代码来源:getScheduleWithGroupsQuestions.php

示例4: GetFacultyQuestions

function GetFacultyQuestions($groupid)
{
    include_once 'db_Connection.php';
    $conn = sqlsrv_connect($serverName, $connectionInfo);
    $questionvalues = array();
    $questions = array();
    $faculty = array();
    $facultyquestions = array();
    if ($conn) {
        //----get acadyear-------------------
        $acid = 0;
        $sqlstr = " SELECT [AcadYearID] FROM [dbo].[Groups] where [groupid]=? ";
        $params = array($groupid);
        $sqlquery = sqlsrv_query($conn, $sqlstr, $params);
        if ($sqlquery) {
            while ($row = sqlsrv_fetch_array($sqlquery, SQLSRV_FETCH_ASSOC)) {
                $acid = $row['AcadYearID'];
            }
            sqlsrv_free_stmt($sqlquery);
        }
        $sqlstr = " SELECT [questionTypeId],[value],[text] " . " FROM [dbo].[QuestionValues] " . " order by questionTypeId ";
        //  $params = array ($acid);
        $sqlquery = sqlsrv_query($conn, $sqlstr);
        if ($sqlquery) {
            while ($row = sqlsrv_fetch_object($sqlquery)) {
                $questionvalues[] = $row;
            }
            sqlsrv_free_stmt($sqlquery);
        }
        //----get question array-------------------
        $sqlstr = " SELECT [QuestionID],[QueastionText],[questionType],[maxmark],-1 as mark,'' as description " . " FROM [dbo].[Questions] " . " where [QuestionLecturer]=0 " . " and [Acadyear]=? ";
        $params = array($acid);
        $sqlquery = sqlsrv_query($conn, $sqlstr, $params);
        if ($sqlquery) {
            while ($row = sqlsrv_fetch_object($sqlquery)) {
                $row->questionValues = array();
                foreach ($questionvalues as &$questValue) {
                    if ($questValue->questionTypeId === $row->questionType) {
                        array_push($row->questionValues, $questValue);
                    }
                }
                $questions[] = $row;
            }
            sqlsrv_free_stmt($sqlquery);
        }
        //----get faculty-------------------
        $sqlstr = " SELECT [FacultyID],[FacultyName] FROM [dbo].[Groups] " . " where [groupid]=? ";
        $params = array($groupid);
        $sqlquery = sqlsrv_query($conn, $sqlstr, $params);
        if ($sqlquery) {
            while ($row = sqlsrv_fetch_object($sqlquery)) {
                $row->quests = $questions;
                $faculty[] = $row;
            }
            $facultyquestions = array("result" => 0, "data" => $faculty);
        }
        sqlsrv_close($conn);
    }
    return $facultyquestions;
}
开发者ID:Nata12,项目名称:SocHarcum,代码行数:60,代码来源:getFacultyQuestions.php

示例5: dbcall

function dbcall()
{
    session_start();
    $seubid = (string) session_id();
    $server = "bamsql2";
    $options = array("UID" => "genes", "PWD" => "Genes12", "Database" => "genes");
    $conn = sqlsrv_connect($server, $options);
    if ($conn === false) {
        die("<pre>" . print_r(sqlsrv_errors(), true));
    }
    $rno = $_POST['Rnumber'];
    $name = $_POST['name'];
    $email = $_POST['email'];
    $gender = $_POST['gender'];
    $sql = "insert INTO dbo.contactinfo values('{$rno}','{$name}','{$email}','{$gender}')";
    $query = sqlsrv_query($conn, $sql);
    if ($query === false) {
        exit("<pre>" . print_r(sqlsrv_errors(), true));
    }
    #while ($row = sqlsrv_fetch_array($query))
    # {  echo "<p>Hello, $row[ascore]!</p>";
    #}
    sqlsrv_free_stmt($query);
    sqlsrv_close($conn);
}
开发者ID:vivek8943,项目名称:RawlsGACode,代码行数:25,代码来源:Guessdemo.php

示例6: SaveLecturerMarks

function SaveLecturerMarks($marks)
{
    $status = array();
    include_once 'db_Connection.php';
    $conn = sqlsrv_connect($serverName, $connectionInfo);
    if ($conn) {
        $login = "0";
        $subjectid = 0;
        $subjtype = 0;
        $lectid = 0;
        $qid = 0;
        $mark = 0;
        $ldescription = "0";
        $sqlstr = " insert into [dbo].[MarkLecturer] ([Login],[subjid],[subjtype],[lectid],[qid],[mark],[ldescription]) " . " values (?,?,?,?,?,?,?) ";
        $params = array(&$login, &$subjectid, &$subjtype, &$lectid, &$qid, &$mark, &$ldescription);
        $stmt = sqlsrv_prepare($conn, $sqlstr, $params);
        if ($stmt) {
            foreach ($marks as &$data) {
                $login = $data->login;
                $subjectid = $data->subjectid;
                $subjtype = $data->subjtype;
                $lectid = $data->lectid;
                $qid = $data->qid;
                $mark = $data->mark;
                $ldescription = $data->description;
                if (!sqlsrv_execute($stmt)) {
                    array_push($status, "not inserted-L" . $login . "-S" . $subjectid . "-T" . $subjtype . "-L" . $lectid . "-Q" . $qid);
                }
            }
        }
        sqlsrv_close($conn);
    }
    return $status;
}
开发者ID:Nata12,项目名称:SocHarcum,代码行数:34,代码来源:saveLecturerMarks.php

示例7: disconnect

 /**
  * Close the connection.
  */
 public function disconnect()
 {
     if ($this->connected()) {
         sqlsrv_close($this->connection);
     }
     $this->connected = false;
 }
开发者ID:darya,项目名称:framework,代码行数:10,代码来源:SqlServer.php

示例8: __destruct

 public function __destruct()
 {
     /*
              | About:
      | 	-> Close the connection and returns the elapsed time.
     */
     if (!empty($this->connection['debugMode'])) {
         $this->errorHandling();
     }
     switch ($this->connection['db_type']) {
         case 'mysql':
             $this->conn->close();
             break;
         case 'mssql':
             mssql_close($this->conn);
             break;
         case 'sqlserv':
             sqlsrv_close($this->conn);
             break;
         case 'pgsql':
             pg_close($this->conn);
             break;
     }
     return $this->elapsedTime();
 }
开发者ID:samukt,项目名称:T-Rex,代码行数:25,代码来源:class_db.php

示例9: close

 /**
  * @see MooMsSQL::close()
  *
  */
 public function close()
 {
     if ($this->linkId) {
         sqlsrv_close($this->linkId);
         $this->linkId = false;
     }
 }
开发者ID:GameCrusherTechnology,项目名称:HeroTowerServer,代码行数:11,代码来源:MsSQLnt.class.php

示例10: close

 /**
  * Disconnect
  *
  * @return  bool success
  */
 public function close()
 {
     if ($this->handle && ($r = sqlsrv_close($this->handle))) {
         $this->handle = NULL;
         return $r;
     }
     return FALSE;
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:13,代码来源:SqlSrvConnection.class.php

示例11: disconnectInternal

 /**
  * Disconnects from the database.
  * Does nothing if there was no connection established.
  *
  * @return void
  */
 protected function disconnectInternal()
 {
     if (!$this->isConnected) {
         return;
     }
     $this->isConnected = false;
     sqlsrv_close($this->resource);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:14,代码来源:mssqlconnection.php

示例12: CloseConnection

 function CloseConnection()
 {
     if ($this->databaseType == 'mySql' || $this->databaseType == 'both') {
         mysql_close($this->mysqlConnection);
     }
     if ($this->databaseType == 'sqlServer' || $this->databaseType == 'both') {
         sqlsrv_close($this->sqlserverConnection);
     }
 }
开发者ID:renatosans,项目名称:contratos,代码行数:9,代码来源:DataConnector.php

示例13: close

 protected function close()
 {
     if (isset($this->db)) {
         $r = sqlsrv_close($this->db);
         if ($r) {
             $this->db = null;
         }
     }
 }
开发者ID:Borvik,项目名称:Munla,代码行数:9,代码来源:mssql.php

示例14: close

 /**
  * This function closes an open connection.
  *
  * @access public
  * @override
  * @return boolean                              whether an open connection was closed
  */
 public function close()
 {
     if ($this->is_connected()) {
         if (!@sqlsrv_close($this->resource)) {
             return FALSE;
         }
         $this->resource = NULL;
     }
     return TRUE;
 }
开发者ID:ruslankus,项目名称:invoice-crm,代码行数:17,代码来源:Improved.php

示例15: close

 public function close()
 {
     $this->conn_open = false;
     if (!$this->reuse_connection) {
         if ($this->handle && !$this->data_result) {
             return sqlsrv_close($this->handle);
         }
     }
     return true;
 }
开发者ID:codifyllc,项目名称:phpopenfw,代码行数:10,代码来源:dt_sqlsrv.class.php


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