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


PHP sybase_select_db函数代码示例

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


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

示例1: dbQuery

function dbQuery($query, $show_errors = true, $all_results = true, $show_output = true)
{
    if ($show_errors) {
        error_reporting(E_ALL);
    } else {
        error_reporting(E_PARSE);
    }
    // Connect to the Sybase database management system
    $link = @sybase_pconnect("192.168.231.144", "testuser", "testpass");
    if (!$link) {
        die(sybase_get_last_message());
    }
    // Make 'testdb' the current database
    $db_selected = @sybase_select_db("testdb");
    if (!$db_selected) {
        die(sybase_get_last_message());
    }
    // Print results in HTML
    print "<html><body>\n";
    // Print SQL query to test sqlmap '--string' command line option
    //print "<b>SQL query:</b> " . $query . "<br>\n";
    // Perform SQL injection affected query
    $result = sybase_query($query);
    if (!$result) {
        if ($show_errors) {
            print "<b>SQL error:</b> " . sybase_get_last_message() . "<br>\n";
        }
        exit(1);
    }
    if (!$show_output) {
        exit(1);
    }
    print "<b>SQL results:</b>\n";
    print "<table border=\"1\">\n";
    while ($line = sybase_fetch_assoc($result)) {
        print "<tr>";
        foreach ($line as $col_value) {
            print "<td>" . $col_value . "</td>";
        }
        print "</tr>\n";
        if (!$all_results) {
            break;
        }
    }
    print "</table>\n";
    print "</body></html>";
}
开发者ID:dieface,项目名称:testenv,代码行数:47,代码来源:sybase_user.inc.php

示例2: connect

 function connect($dsninfo, $persistent = false)
 {
     if (!DB::assertExtension('sybase')) {
         return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
     }
     $this->dsn = $dsninfo;
     $user = $dsninfo['username'];
     $pw = $dsninfo['password'];
     $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost';
     $connect_function = $persistent ? 'sybase_pconnect' : 'sybase_connect';
     if ($dbhost && $user && $pw) {
         $conn = $connect_function($dbhost, $user, $pw);
     } elseif ($dbhost && $user) {
         $conn = $connect_function($dbhost, $user);
     } elseif ($dbhost) {
         $conn = $connect_function($dbhost);
     } else {
         $conn = $connect_function();
     }
     if (!$conn) {
         return $this->raiseError(DB_ERROR_CONNECT_FAILED);
     }
     if ($dsninfo['database']) {
         if (!@sybase_select_db($dsninfo['database'], $conn)) {
             return $this->raiseError(DB_ERROR_NODBSELECTED);
         }
     }
     $this->connection = $conn;
     return DB_OK;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:30,代码来源:sybase.php

示例3: connect

 public function connect($config = array())
 {
     $this->config = $config;
     $this->connect = $this->config['pconnect'] === true ? @sybase_pconnect($this->config['host'], $this->config['user'], $this->config['password'], $this->config['charset'], $this->config['appname']) : @sybase_connect($this->config['host'], $this->config['user'], $this->config['password'], $this->config['charset'], $this->config['appname']);
     if (empty($this->connect)) {
         die(getErrorMessage('Database', 'mysqlConnectError'));
     }
     sybase_select_db($this->config['database'], $this->connect);
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:9,代码来源:SybaseDriver.php

示例4: getDB

 protected function getDB()
 {
     $link = @sybase_connect('sulcmis3', 'sa', '*****') or die("不能连接数据库!");
     //连接数据库,第一空必须写服务名称,不能是ip;
     $db = @sybase_select_db("sulcmis", $link) or die("数据库没有选择");
     echo "getDB";
     echo $link;
     return $link;
 }
开发者ID:blackjackedu,项目名称:FreeMLib,代码行数:9,代码来源:BookSearch.php

示例5: db_sybase

 function db_sybase($host, $user, $passwd, $db = null)
 {
     $this->db_name = $db;
     $this->db_user = $user;
     $this->db_passwd = $passwd;
     $this->db_host = $host;
     $this->db_link_ptr = sybase_connect($host, $user, $passwd) or die("Couldn't connect to Sybase Server on {$host}");
     $this->dbhandler = @sybase_select_db($db);
 }
开发者ID:rezarahimi4861,项目名称:icmf,代码行数:9,代码来源:sybase.php

示例6: SelectDB

 function SelectDB($dbName)
 {
     $this->databaseName = $dbName;
     if ($this->_connectionID) {
         return @sybase_select_db($dbName);
     } else {
         return false;
     }
 }
开发者ID:qoire,项目名称:portal,代码行数:9,代码来源:adodb-sybase.inc.php

示例7: CanConnectDatabase

 function CanConnectDatabase()
 {
     global $dcl_domain_info, $dcl_domain;
     $conn = sybase_connect($dcl_domain_info[$dcl_domain]['dbHost'], $dcl_domain_info[$dcl_domain]['dbUser'], $dcl_domain_info[$dcl_domain]['dbPassword']);
     if ($conn > 0) {
         $bRetVal = sybase_select_db($dcl_domain_info[$dcl_domain]['dbName'], $conn);
         sybase_close($conn);
         return $bRetVal;
     }
     return false;
 }
开发者ID:ljvblfz,项目名称:mysoftwarebrasil,代码行数:11,代码来源:class.DCL_DB_sybase.inc.php

示例8: connect

 function connect()
 {
     if (0 == $this->Link_ID) {
         $this->Link_ID = sybase_pconnect($this->Host, $this->User, $this->Password);
         if (!$this->Link_ID) {
             $this->halt("Link-ID == false, pconnect failed");
         }
         if (!sybase_select_db($this->Database, $this->Link_ID)) {
             $this->halt("cannot use database " . $this->Database);
         }
     }
     return $this->Link_ID;
 }
开发者ID:antirek,项目名称:prestige-pbx,代码行数:13,代码来源:phplib_sybase.php

示例9: connect

 /**
  * Connects to the database using options in the given configuration array.
  *
  * @return boolean True if the database could be connected, else false
  */
 function connect()
 {
     $config = $this->config;
     $this->connected = false;
     if (!$config['persistent']) {
         $this->connection = sybase_connect($config['host'], $config['login'], $config['password'], true);
     } else {
         $this->connection = sybase_pconnect($config['host'], $config['login'], $config['password']);
     }
     if (sybase_select_db($config['database'], $this->connection)) {
         $this->connected = true;
     }
     return $this->connected;
 }
开发者ID:quinns,项目名称:REST-API,代码行数:19,代码来源:dbo_sybase.php

示例10: connect

 /**
  * Connects to the database using options in the given configuration array.
  *
  * @return boolean True if the database could be connected, else false
  */
 function connect()
 {
     $config = $this->config;
     $port = '';
     if ($config['port'] !== null) {
         $port = ':' . $config['port'];
     }
     if ($config['persistent']) {
         $this->connection = sybase_pconnect($config['host'] . $port, $config['login'], $config['password']);
     } else {
         $this->connection = sybase_connect($config['host'] . $port, $config['login'], $config['password'], true);
     }
     $this->connected = sybase_select_db($config['database'], $this->connection);
     return $this->connected;
 }
开发者ID:christianallred,项目名称:fluent_univ,代码行数:20,代码来源:dbo_sybase.php

示例11: __construct

 /**
  * constructor(string $dsn)
  * Connect to Sybase.
  */
 function __construct($dsn)
 {
     if (!is_callable('sybase_connect')) {
         return $this->_setLastError("-1", "Sybase extension is not loaded", "sybase_connect");
     }
     if (isset($dsn['lcharset'])) {
         $this->lcharset = $dsn['lcharset'];
     }
     if (isset($dsn['rcharset'])) {
         $this->rcharset = $dsn['rcharset'];
     }
     // May be use sybase_connect or sybase_pconnect
     $ok = $this->link = sybase_pconnect($dsn['host'] . (empty($dsn['port']) ? "" : ":" . $dsn['port']), $dsn['user'], $dsn['pass']);
     $this->_resetLastError();
     if (!$ok) {
         return $this->_setDbError('sybase_connect()');
     }
     $ok = sybase_select_db(preg_replace('{^/}s', '', $dsn['path']), $this->link);
     if (!$ok) {
         return $this->_setDbError('sybase_select_db()');
     }
 }
开发者ID:Ambalus,项目名称:DbSimple,代码行数:26,代码来源:Sybase.php

示例12: sql_connect

function sql_connect($host, $user, $password, $db)
{
    global $dbtype;
    switch ($dbtype) {
        case "MySQL":
            $dbi = @mysql_connect($host, $user, $password);
            mysql_select_db($db);
            return $dbi;
            break;
        case "mSQL":
            $dbi = msql_connect($host);
            msql_select_db($db);
            return $dbi;
            break;
        case "postgres":
            $dbi = @pg_connect("host={$host} user={$user} password={$password} port=5432 dbname={$db}");
            return $dbi;
            break;
        case "postgres_local":
            $dbi = @pg_connect("user={$user} password={$password} dbname={$db}");
            return $dbi;
            break;
        case "ODBC":
            $dbi = @odbc_connect($db, $user, $password);
            return $dbi;
            break;
        case "ODBC_Adabas":
            $dbi = @odbc_connect($host . ":" . $db, $user, $password);
            return $dbi;
            break;
        case "Interbase":
            $dbi = @ibase_connect($host . ":" . $db, $user, $password);
            return $dbi;
            break;
        case "Sybase":
            $dbi = @sybase_connect($host, $user, $password);
            sybase_select_db($db, $dbi);
            return $dbi;
            break;
        default:
            break;
    }
}
开发者ID:BackupTheBerlios,项目名称:domsmod-svn,代码行数:43,代码来源:sql_layer.php

示例13: connect

 /**
  * Connects to the database.
  *
  * This function connects to a MySQL database
  *
  * @param   string $host
  * @param   string $username
  * @param   string $password
  * @param   string $db_name
  * @return  boolean TRUE, if connected, otherwise FALSE
  * @access  public
  * @author  Adam Greene <phpmyfaq@skippy.fastmail.fm>
  * @since   2004-12-10
  */
 function connect($host, $user, $passwd, $db)
 {
     $this->conn = @sybase_pconnect($host, $user, $passwd);
     if (empty($db) or $this->conn == FALSE) {
         print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
         print "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
         print "<head>\n";
         print "    <title>phpMyFAQ Error</title>\n";
         print "    <meta http-equiv=\"content-type\" content=\"application/xhtml+xml; charset=utf-8\" />\n";
         print "</head>\n";
         print "<body>\n";
         print "<p align=\"center\">The connection to the Sybase server could not be established.</p>\n";
         print "<p align=\"center\">The error message of the Sybase server:<br />" . error() . "</p>\n";
         print "</body>\n";
         print "</html>";
         return FALSE;
     }
     return @sybase_select_db($db, $this->conn);
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:33,代码来源:sybase.php

示例14: connect

 protected function connect(&$username, &$password, &$driver_options)
 {
     $host = isset($this->dsn['host']) ? $this->dsn['host'] : 'SYBASE';
     $dbname = isset($this->dsn['dbname']) ? $this->dsn['dbname'] : '';
     $charset = isset($this->dsn['charset']) ? intval($this->dsn['charset']) : '';
     if (isset($driver_options[PDO::ATTR_PERSISTENT]) && $driver_options[PDO::ATTR_PERSISTENT]) {
         $this->link = @sybase_pconnect($host, $username, $password, $charset);
     } else {
         // hope this opens a new connection every time
         $app_name = uniqid('phppdo_');
         $this->link = @sybase_connect($host, $username, $password, $charset, $app_name);
     }
     if (!$this->link) {
         $this->set_driver_error('28000', PDO::ERRMODE_EXCEPTION, '__construct');
     }
     if ($dbname) {
         if (!@sybase_select_db($dbname, $this->link)) {
             $this->set_driver_error(null, PDO::ERRMODE_EXCEPTION, '__construct');
         }
     }
 }
开发者ID:Deepab23,项目名称:clinic,代码行数:21,代码来源:sybase.php

示例15: selectdb

 /**
  * Select database
  *
  * @param   string db name of database to select
  * @return  bool success
  * @throws  rdbms.SQLStatementFailedException
  */
 public function selectdb($db)
 {
     if (!sybase_select_db($db, $this->handle)) {
         throw new SQLStatementFailedException('Cannot select database: ' . trim(sybase_get_last_message()), 'use ' . $db, current(sybase_fetch_row(sybase_query('select @@error', $this->handle))));
     }
     return TRUE;
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:14,代码来源:SybaseConnection.class.php


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