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


PHP sybase_pconnect函数代码示例

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


在下文中一共展示了sybase_pconnect函数的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

 /**
  * Connect
  *
  * @param   bool reconnect default FALSE
  * @return  bool success
  * @throws  rdbms.SQLConnectException
  */
 public function connect($reconnect = false)
 {
     if (is_resource($this->handle)) {
         return true;
     }
     // Already connected
     if (!$reconnect && false === $this->handle) {
         return false;
     }
     // Previously failed connecting
     $this->_obs && $this->notifyObservers(new \rdbms\DBEvent(\rdbms\DBEvent::CONNECT, $reconnect));
     if ($this->flags & DB_PERSISTENT) {
         $this->handle = sybase_pconnect($this->dsn->getHost(), $this->dsn->getUser(), $this->dsn->getPassword(), 'utf8');
     } else {
         $this->handle = sybase_connect($this->dsn->getHost(), $this->dsn->getUser(), $this->dsn->getPassword(), 'utf8');
     }
     if (!is_resource($this->handle)) {
         $e = new \rdbms\SQLConnectException(trim(sybase_get_last_message()), $this->dsn);
         \xp::gc(__FILE__);
         throw $e;
     }
     \xp::gc(__FILE__);
     $this->_obs && $this->notifyObservers(new \rdbms\DBEvent(\rdbms\DBEvent::CONNECTED, $reconnect));
     return parent::connect();
 }
开发者ID:xp-framework,项目名称:rdbms,代码行数:32,代码来源:SybaseConnection.class.php

示例3: db_pconnect

 /**
  * Persistent database connection
  *
  * @access	private called by the base class
  * @return	resource
  */
 function db_pconnect()
 {
     if ($this->port != '') {
         $this->hostname .= ',' . $this->port;
     }
     return @sybase_pconnect($this->hostname, $this->username, $this->password);
 }
开发者ID:belalangkunyit,项目名称:ci30sybase,代码行数:13,代码来源:sybase_driver.php

示例4: 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

示例5: 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) || $this->conn === false) {
         PMF_Db::errorPage('An unspecified error occurred.');
         die;
     }
     return @sybase_select_db($db, $this->conn);
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:23,代码来源:Sybase.php

示例6: 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

示例7: 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

示例8: 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

示例9: connect

 /**
  * Connect to the database server and select the database
  */
 protected function connect()
 {
     $strHost = $GLOBALS['TL_CONFIG']['dbHost'];
     if ($GLOBALS['TL_CONFIG']['dbPort']) {
         $strHost .= ':' . $GLOBALS['TL_CONFIG']['dbPort'];
     }
     if ($GLOBALS['TL_CONFIG']['dbPconnect']) {
         $this->resConnection = @sybase_pconnect($strHost, $GLOBALS['TL_CONFIG']['dbUser'], $GLOBALS['TL_CONFIG']['dbPass'], $GLOBALS['TL_CONFIG']['dbCharset']);
     } else {
         $this->resConnection = @sybase_connect($strHost, $GLOBALS['TL_CONFIG']['dbUser'], $GLOBALS['TL_CONFIG']['dbPass'], $GLOBALS['TL_CONFIG']['dbCharset']);
     }
     if (is_resource($this->resConnection)) {
         @sybase_select_db($GLOBALS['TL_CONFIG']['dbDatabase']);
     }
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:18,代码来源:DB_Sybase.php

示例10: 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

示例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: connect

 /**
  * Connect
  *
  * @param   bool reconnect default FALSE
  * @return  bool success
  * @throws  rdbms.SQLConnectException
  */
 public function connect($reconnect = FALSE)
 {
     if (is_resource($this->handle)) {
         return TRUE;
     }
     // Already connected
     if (!$reconnect && FALSE === $this->handle) {
         return FALSE;
     }
     // Previously failed connecting
     if ($this->flags & DB_PERSISTENT) {
         $this->handle = sybase_pconnect($this->dsn->getHost(), $this->dsn->getUser(), $this->dsn->getPassword(), 'iso_1');
     } else {
         $this->handle = sybase_connect($this->dsn->getHost(), $this->dsn->getUser(), $this->dsn->getPassword(), 'iso_1');
     }
     if (!is_resource($this->handle)) {
         $e = new SQLConnectException(trim(sybase_get_last_message()), $this->dsn);
         xp::gc(__FILE__);
         throw $e;
     }
     xp::gc(__FILE__);
     $this->_obs && $this->notifyObservers(new DBEvent(__FUNCTION__, $reconnect));
     return parent::connect();
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:31,代码来源:SybaseConnection.class.php

示例13: _pconnect

 function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
 {
     if (!function_exists('sybase_connect')) {
         return null;
     }
     // Sybase connection on custom port
     if ($this->port) {
         $argHostname .= ':' . $this->port;
     }
     if ($this->charSet) {
         $this->_connectionID = sybase_pconnect($argHostname, $argUsername, $argPassword, $this->charSet);
     } else {
         $this->_connectionID = sybase_pconnect($argHostname, $argUsername, $argPassword);
     }
     if ($this->_connectionID === false) {
         return false;
     }
     if ($argDatabasename) {
         return $this->SelectDB($argDatabasename);
     }
     return true;
 }
开发者ID:ceryxSeidor,项目名称:ProyectoPruebaWSV2,代码行数:22,代码来源:adodb-sybase.inc.php

示例14: sybase_pconnect

<?
    $dbh = sybase_pconnect("SERVER", "user", "password");
    if(!$dbh) {
        echo("<B>Unable to connect to database.</B><BR>\n");
        exit;
    }

    $sql = "
        declare @op varchar(100)
        exec test_stored_proc 'This is the input string',
                              @output_param = @op OUTPUT
    ";
    $result = sybase_query($sql);

    if(!$result) {
        echo("<B>Unable to execute $sql.<B><BR>\n");
        exit;
    }

    // Create a table of output parameters
    echo("<table><tr><th bgcolor=grey>Output parameter</th><th>Value</th></tr>\n");
    $output_params = sybase_output_params($result->_queryID);
    while(list($key, $value) = each($output_params))
    {
        echo("<tr><td>$key</td><td>$value</td></tr>\n");
    }
    echo("</table>\n");

    echo("<br/>Return value is " . sybase_return_status($result->_queryID));

?>
开发者ID:nickmarden,项目名称:php-sybase,代码行数:31,代码来源:testing.php

示例15: _pconnect

 function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
 {
     if (!function_exists('sybase_connect')) {
         return null;
     }
     $this->_connectionID = sybase_pconnect($argHostname, $argUsername, $argPassword);
     if ($this->_connectionID === false) {
         return false;
     }
     if ($argDatabasename) {
         return $this->SelectDB($argDatabasename);
     }
     return true;
 }
开发者ID:centaurustech,项目名称:BenFund,代码行数:14,代码来源:adodb-sybase.inc.php


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