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


PHP mssql_get_last_message函数代码示例

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


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

示例1: __construct

 /**
  * Database object constructor
  * @param string Database host
  * @param string Database user name
  * @param string Database user password
  * @param string Database name
  * @param string Common prefix for all tables
  */
 function __construct($options)
 {
     //var_dump_pre($options);
     $host = array_key_exists('host', $options) ? $options['host'] : 'localhost';
     $user = array_key_exists('user', $options) ? $options['user'] : '';
     $password = array_key_exists('password', $options) ? $options['password'] : '';
     $database = array_key_exists('database', $options) ? $options['database'] : '';
     $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : 'jos_';
     $select = array_key_exists('select', $options) ? $options['select'] : true;
     // perform a number of fatality checks, then return gracefully
     if (!function_exists('mssql_connect')) {
         $this->_errorNum = 1;
         $this->_errorMsg = 'The MSSQL adapter "mssql" is not available.';
         return;
     }
     // connect to the server
     if (!($this->_resource = @mssql_connect($host, $user, $password, true))) {
         $this->_errorNum = 2;
         $this->_errorMsg = 'Could not connect to MSSQL: ' . mssql_get_last_message();
         print_r($this->_resource);
         return;
     } else {
         $this->connected = true;
     }
     // finalize initializations
     parent::__construct($options);
     // select the database
     if ($select) {
         $this->select('[' . $database . ']');
     }
 }
开发者ID:Jonathonbyrd,项目名称:SportsCapping-Experts,代码行数:39,代码来源:mssql.php

示例2: SetMSSQLError

 function SetMSSQLError($scope, $error)
 {
     if (($last_error = mssql_get_last_message()) != "") {
         $error .= ": " . $last_error;
     }
     return $this->SetError($scope, $error);
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:7,代码来源:metabase_mssql.php

示例3: query

 public function query($sql)
 {
     $resource = mssql_query($sql, $this->link);
     if ($resource) {
         if (is_resource($resource)) {
             $i = 0;
             $data = array();
             while ($result = mssql_fetch_assoc($resource)) {
                 $data[$i] = $result;
                 $i++;
             }
             mssql_free_result($resource);
             $query = new stdClass();
             $query->row = isset($data[0]) ? $data[0] : array();
             $query->rows = $data;
             $query->num_rows = $i;
             unset($data);
             return $query;
         } else {
             return true;
         }
     } else {
         trigger_error('Error: ' . mssql_get_last_message($this->link) . '<br />' . $sql);
         exit;
     }
 }
开发者ID:ahmedkato,项目名称:openshift-opencart,代码行数:26,代码来源:mmsql.php

示例4: initColumns

 /**
  * Loads the columns for this table.
  * @return void
  */
 protected function initColumns()
 {
     include_once 'creole/metadata/ColumnInfo.php';
     include_once 'creole/drivers/mssql/MSSQLTypes.php';
     if (!@mssql_select_db($this->dbname, $this->conn->getResource())) {
         throw new SQLException('No database selected');
     }
     $res = mssql_query("sp_columns " . $this->name, $this->conn->getResource());
     if (!$res) {
         throw new SQLException('Could not get column names', mssql_get_last_message());
     }
     while ($row = mssql_fetch_array($res)) {
         $name = $row['COLUMN_NAME'];
         $type = $row['TYPE_NAME'];
         $length = $row['LENGTH'];
         $is_nullable = $row['NULLABLE'];
         $default = $row['COLUMN_DEF'];
         $precision = $row['PRECISION'];
         $scale = $row['SCALE'];
         $identity = false;
         if (strtolower($type) == "int identity") {
             $identity = true;
         }
         $this->columns[$name] = new ColumnInfo($this, $name, MSSQLTypes::getType($type), $type, $length, $precision, $scale, $is_nullable, $default, $identity);
     }
     $this->colsLoaded = true;
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:31,代码来源:MSSQLTableInfo.php

示例5: my_query

function my_query($str_query, $conex)
{
    global $conf_db_type, $conf_is_prod;
    $queries2log = array('UPD', 'DEL', 'DRO', 'ALT', 'TRU');
    if (in_array(strtoupper(substr($str_query, 0, 3)), $queries2log) && !$conf_is_prod) {
        @write_log('db_trans', $str_query);
    }
    switch ($conf_db_type) {
        case 'mysql':
            $res = @mysql_query($str_query, $conex);
            if ($res) {
                return $res;
            } else {
                write_log('db_error', mysql_error() . " ----> " . $str_query);
            }
            break;
        case 'mssql':
            $res = @mssql_query($str_query, $conex);
            if ($res) {
                return $res;
            } else {
                write_log('db_error', mssql_get_last_message() . " ----> " . $str_query);
            }
            break;
    }
}
开发者ID:javiercaceres77,项目名称:rooms,代码行数:26,代码来源:connect.php

示例6: _catch

 function _catch($msg = "")
 {
     if (!($this->error = mssql_get_last_message())) {
         return true;
     }
     $this->error($msg . "<br>{$this->query} \n {$this->error}");
 }
开发者ID:jvinet,项目名称:pronto,代码行数:7,代码来源:mssql.php

示例7: DriverMssqlExec

function DriverMssqlExec($conn, $sql)
{
    $result = mssql_query($sql, $conn);
    if (!$result) {
        throw new lmbDbException('MSSQL execute error happened: ' . mssql_get_last_message() . ". SQL: " . $sql);
    }
}
开发者ID:snowjobgit,项目名称:limb,代码行数:7,代码来源:fixture.inc.php

示例8: query

 /**
  * @param $sql
  *
  * @return array
  */
 public function query($sql)
 {
     //
     $this->connection = $this->getConnection();
     // Run query
     $query = mssql_query($sql, $this->connection);
     // On error
     if ($query === false) {
         Response::error(500, $_SERVER["SERVER_PROTOCOL"] . ' DB query failed (SQL): ' . mssql_get_last_message());
     }
     // E.g. boolean is returned if no rows (e.g. no resource found or on UPDATE)
     if ($query === true) {
         $response = $query;
     } else {
         // Response
         $response = array();
         //
         // Loop rows and add to response array
         if (mssql_num_rows($query) > 0) {
             while ($row = mssql_fetch_assoc($query)) {
                 $response[] = $row;
             }
         }
         // Free the query result
         mssql_free_result($query);
     }
     // Close link
     $this->closeConnection();
     //
     return $response;
 }
开发者ID:skrodal,项目名称:relay-fusjonator-api,代码行数:36,代码来源:relaysqlconnection.class.php

示例9: dbquery_func_old

function dbquery_func_old($connection_info, $query, $debug = "off")
{
    if ($connection_info['db_type'] == "mysql") {
        mysql_connect($connection_info['db_host'] . ":" . $connection_info['db_port'], $connection_info['username'], $connection_info['password']) or die("Unable to connect to " . $connection_info['db_host']);
        mysql_select_db($connection_info['db_name']) or die("Unable to select database " . $connection_info['db_name']);
        $return = mysql_query($query);
        if ($debug == "on") {
            $merror = mysql_error();
            if (!empty($merror)) {
                print "MySQL Error:<br />" . $merror . "<p />Query<br />: " . $query . "<br />";
            }
            print "Number of rows returned: " . mysql_num_rows($return) . "<br />";
        }
    } else {
        if ($connection_info['db_type'] == "mssql") {
            mssql_connect($connection_info['db_host'] . "," . $connection_info['db_port'], $connection_info['username'], $connection_info['password']) or die("Unable to connect to " . $connection_info['db_host'] . "<br />" . $query);
            mssql_select_db($connection_info['db_name']) or die("Unable to select database " . $connection_info['db_name']);
            $return = mssql_query($query);
            if ($debug == "on") {
                $merror = mssql_get_last_message();
                if (!empty($merror)) {
                    print "MySQL Error: " . $merror . "<br />Query" . $query . "<br />";
                }
                print "Number of rows returned: " . mssql_num_rows($result) . "<br />";
            }
        }
    }
    return $return;
}
开发者ID:JhunCabas,项目名称:avarice-nms,代码行数:29,代码来源:db_config.php

示例10: query

 public function query($sql)
 {
     $resource = mssql_query($sql, $this->link);
     if ($resource) {
         if (is_resource($resource)) {
             $i = 0;
             $data = array();
             while ($result = mssql_fetch_assoc($resource)) {
                 $data[$i] = $result;
                 $i++;
             }
             mssql_free_result($resource);
             $query = new Object();
             $row = isset(Arrays::first($data)) ? Arrays::first($data) : array();
             $query->setRow($row)->setRows($data)->setNumRows($i);
             unset($data);
             return $query;
         } else {
             return true;
         }
     } else {
         trigger_error('Error: ' . mssql_get_last_message($this->link) . '<br />' . $sql);
         exit;
     }
 }
开发者ID:schpill,项目名称:thin,代码行数:25,代码来源:Sqlserver.php

示例11: _connect

 /**
  * Creates a connection resource.
  */
 protected function _connect()
 {
     if (is_resource($this->_connection)) {
         // connection already exists
         return;
     }
     if (!extension_loaded('mssql')) {
         throw new Exception('The mssql extension is required for this adapter but the extension is not loaded');
     }
     $serverName = $this->_config['host'];
     if (isset($this->_config['port'])) {
         $port = (int) $this->_config['port'];
         $serverName .= ', ' . $port;
     }
     $username = $password = '';
     if (isset($this->_config['username']) && isset($this->_config['password'])) {
         $username = $this->_config['username'];
         $password = $this->_config['password'];
     }
     $this->_connection = mssql_connect($serverName, $username, $password);
     if (!$this->_connection) {
         throw new Exception('Mssql Connection Error: ' . mssql_get_last_message());
     }
     if (isset($this->_config['dbname']) && !mssql_select_db($this->_config['dbname'])) {
         throw new Exception('Unable to connect or select database ' . $this->_config['dbname']);
     }
 }
开发者ID:diglin,项目名称:diglin_mssql,代码行数:30,代码来源:Mssql.php

示例12: query

	function query($sql){
		$res = mssql_query($sql, $this->conn);
		if (!$res){
			throw new Exception("Query error: " . mssql_get_last_message());
		}
		
		return new knjdb_result($this->knjdb, $this, $res);
	}
开发者ID:kaspernj,项目名称:knjphpfw,代码行数:8,代码来源:class_knjdb_mssql.php

示例13: query

 /**
  * Executes the SQL query.
  * @param  string      SQL statement.
  * @return IDibiResultDriver|NULL
  * @throws DibiDriverException
  */
 public function query($sql)
 {
     $this->resultSet = @mssql_query($sql, $this->connection);
     // intentionally @
     if ($this->resultSet === FALSE) {
         throw new DibiDriverException(mssql_get_last_message(), 0, $sql);
     }
     return is_resource($this->resultSet) ? clone $this : NULL;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:15,代码来源:mssql.php

示例14: throwSQLError

function throwSQLError($message, $query = '')
{
    $output = ucfirst($message) . ', the error returned was:<br><br><font color="red">' . mssql_get_last_message();
    if ($query != '') {
        $output .= '<br>The query I attempted to execute was: ' . $query;
    }
    $output .= '</font><br><br>';
    echo $output . '<br>';
}
开发者ID:noikiy,项目名称:vsuninpay,代码行数:9,代码来源:funclib.php

示例15: connect

 /**
  * Connects to the database.
  *
  * @param   string $host
  * @param   string $username
  * @param   string $password
  * @param   string $db_name
  * @return  boolean TRUE, if connected, otherwise FALSE
  */
 function connect($host, $user, $passwd, $db)
 {
     $this->conn = mssql_pconnect($host, $user, $passwd);
     if (empty($db) or $this->conn == false) {
         PMF_Db::errorPage(mssql_get_last_message());
         die;
     }
     return mssql_select_db($db, $this->conn);
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:18,代码来源:Mssql.php


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