コード例 #1
0
 function disconnect()
 {
     if ($this->connectionId) {
         mssql_close($this->connectionId);
         $this->connectionId = null;
     }
 }
コード例 #2
0
ファイル: sqlquery.class.php プロジェクト: bciv/COMS
 /** 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;
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: MSSQL_Connector.php プロジェクト: axoquen/tt780
 function __destruct()
 {
     if ($this->link) {
         mssql_close($this->link);
     }
     $this->link = null;
 }
コード例 #4
0
ファイル: class_db.php プロジェクト: samukt/T-Rex
 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();
 }
コード例 #5
0
 function dbactionAdd()
 {
     print "starting\n";
     if (!windowsOs()) {
         throw new lxException('mssql_is_only_on_windows', '', '');
     }
     print "\n mantu\n";
     $req = mssql_connect("localhost,1433");
     if (!$req) {
         throw new lxException('MsSql Connection is Failed', '', '');
     }
     $loginname = $this->main->username;
     $dbname = $loginname;
     print "\n" . $loginname;
     $pass = $this->main->dbpassword;
     print "\n" . $pass;
     $result = mssql_query("select loginname from syslogins where loginname='{$loginname}'");
     $row = mssql_fetch_array($result, MSSQL_ASSOC);
     if (!$row) {
         mssql_query("sp_addlogin '{$loginname}', '{$pass}'");
     } else {
         print "user already exist by this name\n";
         throw new Exception("couldn't create {$loginname}--already user exist\n");
     }
     print "executing\n";
     try {
         mssql_query("create database {$dbname}");
     } catch (Exception $e) {
         print "\n ERROR: Create database";
     }
     mssql_query("use  {$dbname}");
     mssql_query("sp_adduser '{$loginname}', '{$loginname}', 'db_owner'");
     mssql_close();
     print "\ndone\n";
 }
コード例 #6
0
ファイル: Mssql5.php プロジェクト: joaosigno/dazake-job
 /**
  * 关闭数据库连接
  */
 function close()
 {
     if ($this->conn) {
         mssql_close($this->conn);
     }
     parent::close();
 }
コード例 #7
0
ファイル: Mssql.php プロジェクト: diglin/diglin_mssql
 public function closeConnection()
 {
     if ($this->isConnected()) {
         mssql_close($this->_connection);
     }
     $this->_connection = null;
 }
コード例 #8
0
ファイル: mssql.php プロジェクト: BackupTheBerlios/phpbbsfp
 function sql_close()
 {
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $starttime = $mtime;
     if ($this->db_connect_id) {
         //
         // Commit any remaining transactions
         //
         if ($this->in_transaction) {
             @mssql_query("COMMIT", $this->db_connect_id);
         }
         $mtime = microtime();
         $mtime = explode(" ", $mtime);
         $mtime = $mtime[1] + $mtime[0];
         $endtime = $mtime;
         $this->sql_time += $endtime - $starttime;
         return @mssql_close($this->db_connect_id);
     } else {
         $mtime = microtime();
         $mtime = explode(" ", $mtime);
         $mtime = $mtime[1] + $mtime[0];
         $endtime = $mtime;
         $this->sql_time += $endtime - $starttime;
         return false;
     }
 }
コード例 #9
0
 /**
  * 关闭数据库,如果数据库连接已经打开则关闭它
  * 请在调用connect()并处理后使用close()
  *
  * @return void
  */
 public function close()
 {
     if ($this->linkId) {
         mssql_close($this->linkId);
         $this->linkId = false;
     }
 }
コード例 #10
0
ファイル: getProductos.php プロジェクト: ekutor/hermes
function getProductos()
{
    $myServer = "172.30.5.49";
    $myUser = "******";
    $myPass = "******";
    $myDB = "LAUMAYER";
    $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on {$myServer}");
    $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database {$myDB}");
    //Realiza el query en la base de datos
    $mysqli = makeSqlConnection();
    //$sql = "SELECT * FROM psg_productos a LEFT JOIN psg_productos_cstm ac ON a.id = ac.id_c";
    $sql = "SELECT id,name FROM psg_productos where deleted ='0'";
    $res = $mysqli->query($sql);
    $rows = array();
    while ($r = mysqli_fetch_assoc($res)) {
        $obj = (object) $r;
        $querySaldo = "Select dbo.F_Saldo_Bodega_Informe(Year(GETDATE()),MONTH(GETDATE()),'" . $r['id'] . "','BODPRDCTO','T','C') as Saldo";
        $result = mssql_query($querySaldo);
        if ($row = mssql_fetch_array($result)) {
            $obj->saldo = $row['Saldo'];
        }
        $a = (array) $obj;
        $rows[] = $a;
    }
    mssql_close($dbhandle);
    if (empty($rows)) {
        return '{"results" :[]}';
    } else {
        //Convierte el arreglo en json y lo retorna
        $temp = json_encode(utf8ize($rows));
        return '{"results" :' . $temp . '}';
    }
}
コード例 #11
0
ファイル: class.MSSQL.php プロジェクト: jwiegel/FormHandler
 /**
  * MSSQL::close()
  *
  * Close the connection
  *
  * @return bool
  * @access public
  * @author Teye Heimans
  */
 function close()
 {
     if ($this->_isConnected) {
         $this->_isConnected = false;
         return mssql_close($this->_conn);
     }
 }
コード例 #12
0
 function Connect()
 {
     if ($this->connection != 0) {
         if (!strcmp($this->connected_host, $this->host) && !strcmp($this->connected_user, $this->user) && !strcmp($this->connected_password, $this->password) && $this->opened_persistent == $this->persistent) {
             return 1;
         }
         $this->Close();
     }
     $function = $this->persistent ? "mssql_pconnect" : "mssql_connect";
     if (!function_exists($function)) {
         return $this->SetError("Connect", "Microsoft SQL server support is not available in this PHP configuration");
     }
     if (($this->connection = @$function($this->host, $this->user, $this->password)) <= 0) {
         return $this->SetMSSQLError("Connect", "Could not connect to the Microsoft SQL server");
     }
     if (strcmp($this->database_name, "") && !@mssql_select_db($this->database_name, $this->connection)) {
         $this->SetMSSQLError("Connect", "Could not select a Microsoft SQL server database");
         mssql_close($this->connection);
         $this->connection = 0;
         return 0;
     }
     $this->selected_database = $this->database_name;
     if (!$this->auto_commit && !$this->DoQuery("BEGIN TRANSACTION")) {
         $this->SetMSSQLError("Connect", "Could not begin the initial transaction");
         mssql_close($this->connection);
         $this->connection = 0;
         return 0;
     }
     $this->connected_host = $this->host;
     $this->connected_user = $this->user;
     $this->connected_password = $this->password;
     $this->opened_persistent = $this->persistent;
     return 1;
 }
コード例 #13
0
 /**
  * Close the connection to the database if still connected.
  *
  * @return bool Returns TRUE if the connection was closed, FALSE if it failed.
  */
 function Close()
 {
     if (mssql_close($this->link)) {
         $this->link = NULL;
         return TRUE;
     }
     return FALSE;
 }
コード例 #14
0
 function disconnect()
 {
     if (!$this->link_identifier) {
         return;
     }
     @mssql_close($this->link_identifier);
     $this->link_identifier = false;
 }
コード例 #15
0
 /**
  * Disconnect
  *
  * @return  bool success
  */
 public function close()
 {
     if ($this->handle && ($r = mssql_close($this->handle))) {
         $this->handle = NULL;
         return $r;
     }
     return FALSE;
 }
コード例 #16
0
ファイル: PDO_MSSQL.php プロジェクト: phpburn/phpburn
 public function close()
 {
     //$this->dispatchEvent('preClose', $this);
     if ($this->conn_id && $this->state != self::CLOSED) {
         $this->state = self::CLOSED;
         mssql_close($this->conn_id);
     }
     //$this->dispatchEvent('posClose', $this);
 }
コード例 #17
0
 /**
  * Database object destructor
  *
  * @return boolean
  * @since 1.5
  */
 function __destruct()
 {
     $return = false;
     if (is_resource($this->_resource)) {
         $return = mssql_close($this->_resource);
         $this->connected = false;
     }
     return $return;
 }
コード例 #18
0
ファイル: Standard.php プロジェクト: ruslankus/invoice-crm
 /**
  * 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 (!@mssql_close($this->resource)) {
             return FALSE;
         }
         $this->resource = NULL;
     }
     return TRUE;
 }
コード例 #19
0
 protected function close()
 {
     $msclose = mssql_close($this->connection);
     if ($msclose === FALSE) {
         wLog(get_class($this), "Couldn't close db connection");
         wLog(get_class($this), "Last message on server was: " . mssql_get_last_message());
         die("Couldn't close db connection");
     }
     return;
 }
コード例 #20
0
 public function close()
 {
     $this->conn_open = false;
     if (!$this->reuse_connection) {
         if ($this->handle && !$this->data_result) {
             return mssql_close($this->handle);
         }
     }
     return true;
 }
コード例 #21
0
ファイル: database.php プロジェクト: ahmader/database-php
 function close()
 {
     if ($this->dbh === false) {
         return;
     }
     if (isset($this->mssql)) {
         @mssql_close($this->dbh);
     } else {
         @mysql_close($this->dbh);
     }
 }
コード例 #22
0
 function CanConnectDatabase()
 {
     global $dcl_domain_info, $dcl_domain;
     $conn = mssql_connect($dcl_domain_info[$dcl_domain]['dbHost'], $dcl_domain_info[$dcl_domain]['dbUser'], $dcl_domain_info[$dcl_domain]['dbPassword']);
     if ($conn > 0) {
         $bRetVal = mssql_select_db($dcl_domain_info[$dcl_domain]['dbName'], $conn);
         mssql_close($conn);
         return $bRetVal;
     }
     return false;
 }
コード例 #23
0
ファイル: class.DbMssql.php プロジェクト: palmic/lbox
 public function __destruct()
 {
     if ($this->activeTransaction) {
         if ($this->autoCommit) {
             $this->transactionCommit();
         } else {
             $this->transactionRollback();
         }
     }
     @mssql_close($this->connection);
 }
コード例 #24
0
ファイル: mssql.php プロジェクト: JDevelopers/Mail
 /**
  * @return bool
  */
 function Disconnect()
 {
     $result = true;
     if ($this->_conectionHandle) {
         $this->FreeResult();
         $result = @mssql_close($this->_conectionHandle);
         $this->_conectionHandle = null;
         return $result;
     } else {
         return false;
     }
 }
コード例 #25
0
ファイル: MsSQL.php プロジェクト: rrmoura1/Abstergo
 /**
  * @see ILumine_Connection::close()
  */
 public function close()
 {
     $this->dispatchEvent(new Lumine_ConnectionEvent(Lumine_Event::PRE_CLOSE, $this));
     if ($this->conn_id && $this->state != self::CLOSED) {
         Lumine_Log::debug('Liberando resultados todos os resultados');
         Lumine_Dialect_Factory::getByName('MsSQL')->freeAllResults();
         $this->state = self::CLOSED;
         Lumine_Log::debug('Fechando conexao com ' . $this->getDatabase());
         mssql_close($this->conn_id);
     }
     $this->dispatchEvent(new Lumine_ConnectionEvent(Lumine_Event::POS_CLOSE, $this));
 }
コード例 #26
0
 private function close($connection)
 {
     $msclose = mssql_close($connection);
     if ($msclose === FALSE) {
         $msg = "Couldn't close connection {$mssqlDB} \n";
         file_put_contents(RTD2SQL_log_main, date("YmdHis ") . $msg, FILE_APPEND);
         $msg = "Last message on server was: " . mssql_get_last_message() . "\n";
         file_put_contents(RTD2SQL_log_main, date("YmdHis ") . $msg, FILE_APPEND);
         die("Couldn't close connection {$mssqlDB}");
     }
     return;
 }
コード例 #27
0
ファイル: pb_misc1.php プロジェクト: Halfnhav4/pfff
 /**
  * Close an MSSQL database
  */
 function close()
 {
     $this->mOpened = false;
     if ($this->mConn) {
         if ($this->trxLevel()) {
             $this->immediateCommit();
         }
         return mssql_close($this->mConn);
     } else {
         return true;
     }
 }
コード例 #28
0
ファイル: DBConfig.php プロジェクト: rogerapras/fms
		public function DBClose(){
			switch($this->sqltype){
				case 'mysql':
					mysql_close();
					break;
				case 'mssql':
					mssql_close();
					break;
				default:
					break;
			}
			$this->cn = null;
		}
コード例 #29
0
ファイル: data.php プロジェクト: eescallon/upload
 function __destruct()
 {
     //close the connection
     switch ($this->_engine) {
         case "mssql":
             mssql_close($this->_dbhandle);
             break;
         case "mysql":
             mysql_close($this->_dbhandle);
             break;
     }
     $this->_client = null;
 }
コード例 #30
-1
ファイル: config_db.php プロジェクト: sarawoot/meeting
function checkToken($token)
{
    global $url_login, $url_authenn, $sys_code;
    if (isset($token)) {
        $data = getAuthen($token);
        if (isset($data->BappGetSessionResult->Username)) {
            $_SESSION["user_name"] = sprintf("%08s", $data->BappGetSessionResult->Username);
            $_SESSION["name"] = $data->BappGetSessionResult->FullNameTH;
            $_SESSION['token'] = $token;
            $_SESSION['image_url'] = $data->BappGetSessionResult->ImageUrl;
            // Role
            $conn = ConnectDB();
            $sql = "select ROLE_CODE from DB_DS.DBO.GET_ROLE_BY_PER_SYSID ('" . sprintf("%08s", $_SESSION["user_name"]) . "', '" . $sys_code . "')";
            $query = mssql_query($sql);
            $row = mssql_fetch_array($query, MSSQL_ASSOC);
            $_SESSION["role"] = $row['ROLE_CODE'];
            mssql_free_result($query);
            mssql_close($conn);
            header('Location: /meeting/index.php');
        } else {
            header('Location: ' . $url_login);
        }
    } else {
        header('Location: ' . $url_login);
    }
}