Example #1
1
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>";
}
Example #2
0
 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;
 }
 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);
 }
Example #4
0
 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;
 }
Example #5
0
 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);
 }
Example #6
0
 function SelectDB($dbName)
 {
     $this->databaseName = $dbName;
     if ($this->_connectionID) {
         return @sybase_select_db($dbName);
     } else {
         return false;
     }
 }
 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;
 }
Example #8
0
 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;
 }
Example #9
0
 /**
  * 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;
 }
 /**
  * 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;
 }
Example #11
0
 /**
  * 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()');
     }
 }
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;
    }
}
Example #13
0
 /**
  * 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 <*****@*****.**>
  * @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);
 }
Example #14
0
 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');
         }
     }
 }
 /**
  * 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;
 }
Example #16
0
<?php

//phpinfo();
$link = @sybase_connect('lltang2000', 'sa', '******') or die("Could not connect !");
//连接数据库,第一空必须写服务名称,不能是ip;
echo "Connected successfully<br>";
$db = @sybase_select_db("sulcmis", $link) or die("数据库没有选择");
echo "数据库选择成功<br>";
$sql = "select ctrlNo,F200,F210c from b_brief where ctrlNo<100";
$rs = sybase_query($sql, $link);
//查询表
if (!$rs) {
    echo "SQL:" . $sql . "执行失败!";
    exit;
}
//$sybase = sybase_fetch_array($rs);
//print_r($sybase);//结束
echo '<table border="1"><tr><td>CtrlNO</td><td>F200</td><td>F210c</td>';
while ($row = sybase_fetch_array($rs)) {
    $id = $row["ctrlNo"];
    $F200 = $row["F200"];
    $F210c = $row["F210c"];
    echo '<tr><td>' . $id . '</td><td>' . $F200 . '</td><td>' . $F210c . '</td></tr>';
}
echo '</table>';
sybase_free_result($rs);
sybase_close($link);
?>

 /**
  * Select the database
  *
  * @access	private called by the base class
  * @return	resource
  */
 function db_select()
 {
     // Note: The brackets are required in the event that the DB name
     // contains reserved characters
     return @sybase_select_db('[' . $this->database . ']', $this->conn_id);
 }
Example #18
0
 /**
  * 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
  */
 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);
 }
Example #19
0
function db_connect()
{
    global $base_host, $base_port, $base_name, $base_user, $base_pass, $base, $conn, $charset;
    $RST = '';
    if ($base == 'pgsql') {
        $conn = "host=" . $base_host . " port=" . $base_port . " dbname=" . $base_name . " user="******" password="******"";
        $db = pg_connect($conn);
    }
    if ($base == 'mysqlPDO') {
        //$conn=mysql_connect($base_host,$base_user,$base_pass) or die ("Erro de Conexao !");
        $txt = 'mysql:host=' . $base_host . ';dbname=' . $base_name . ';charset=utf8';
        //.$charset;
        $conn = new PDO($txt, $base_user, $base_pass);
        //$banco=mysql_select_db(trim($base_name),$conn) or die ("Erro ao Selecionar o Banco !");
        $RST = 'MYSQL';
    }
    if ($base == 'mysql') {
        $conn = mysql_connect($base_host, $base_user, $base_pass) or die("Erro de Conexao !");
        $banco = mysql_select_db(trim($base_name), $conn) or die("Erro ao Selecionar o Banco !");
        $RST = 'MYSQL';
    }
    if ($base == 'mssql') {
        $conn = mssql_connect($base_host, $base_user, $base_pass) or die("Erro de Conex�o !");
        $banco = mssql_select_db($base_name, $conn) or die("Erro ao Selecionar o Banco !");
        $RST = 'MSSQL';
    }
    if ($base == 'sybase') {
        $conn = sybase_connect($base_host, $base_user, $base_pass) or die("Erro de Conex�o !");
        $banco = sybase_select_db($base_name, $conn) or die("Erro ao Selecionar o Banco !");
        $RST = 'MSSQL';
    }
    return $RST;
}
Example #20
0
 /**
  * Initialize the driver.
  *
  * Validate configuration and perform all resource-intensive tasks needed to
  * make the driver active.
  *
  * @throws ILSException
  * @return void
  */
 public function init()
 {
     parent::init();
     // initialize DAIA parent
     if (isset($this->config['Catalog']['opaciln'])) {
         $this->opaciln = $this->config['Catalog']['opaciln'];
     }
     if (isset($this->config['Catalog']['opacfno'])) {
         $this->opacfno = $this->config['Catalog']['opacfno'];
     }
     if (isset($this->config['Catalog']['opcloan'])) {
         $this->opcloan = $this->config['Catalog']['opcloan'];
     }
     if (isset($this->config['Catalog']['database'])) {
         putenv("SYBASE=" . $this->config['Catalog']['sybpath']);
         $this->db = sybase_connect($this->config['Catalog']['sybase'], $this->config['Catalog']['username'], $this->config['Catalog']['password']);
         sybase_select_db($this->config['Catalog']['database']);
     } else {
         throw new ILSException('No Database.');
     }
 }
Example #21
0
 public function open($name, $username, $password, $db, $charset)
 {
     $this->link = @sybase_connect($name, $username, $password, $charset) or die("sybase link defail");
     $this->db = @sybase_select_db($db, $this->link) or die("数据库没有选择");
 }
Example #22
0
function sql_connect($host, $user, $password, $db)
{
    global $dbtype;
    switch ($dbtype) {
        case "MySQL":
            $dbi = @mysql_connect($host, $user, $password);
            if (!mysql_select_db($db)) {
                mysql_query("CREATE DATABASE {$db}");
                mysql_select_db($db);
                include 'install.php';
                die;
            }
            return $dbi;
            break;
        case "mSQL":
            $dbi = msql_connect($host);
            if (!msql_select_db($db)) {
                msql_query("CREATE DATABASE {$db}");
                msql_select_db($db);
                include 'install.php';
                die;
            }
            return $dbi;
            break;
        case "PostgreSQL":
            $dbi = @pg_connect("host={$host} user={$user} password={$password} port=5432 dbname={$db}");
            return $dbi;
            break;
        case "PostgreSQL_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);
            if (!sybase_select_db($db, $dbi)) {
                sybase_query("CREATE DATABASE {$db}", $dbi);
                sybase_select_db($db, $dbi);
                include 'install.php';
                die;
            }
            return $dbi;
            break;
        default:
            break;
    }
}
Example #23
0
 /**
  * Initialize the driver.
  *
  * Validate configuration and perform all resource-intensive tasks needed to
  * make the driver active.
  *
  * @throws ILSException
  * @return void
  */
 public function init()
 {
     if (isset($this->config['Catalog']['opaciln'])) {
         $this->opaciln = $this->config['Catalog']['opaciln'];
     }
     if (isset($this->config['Catalog']['opacfno'])) {
         $this->opacfno = $this->config['Catalog']['opacfno'];
     }
     if (isset($this->config['Catalog']['opcloan'])) {
         $this->opcloan = $this->config['Catalog']['opcloan'];
     }
     if (function_exists("sybase_pconnect") && isset($this->config['Catalog']['database'])) {
         putenv("SYBASE=" . $this->config['Catalog']['sybpath']);
         $this->db = sybase_pconnect($this->config['Catalog']['sybase'], $this->config['Catalog']['username'], $this->config['Catalog']['password']);
         sybase_select_db($this->config['Catalog']['database']);
     } else {
         throw new ILSException('No Database.');
     }
 }
Example #24
0
 /**
  * Roll back (undo) the current transaction.
  */
 function rollback()
 {
     if ($this->transaction_opcount > 0) {
         if (!@sybase_select_db($this->_db, $this->connection)) {
             return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
         }
         $result = @sybase_query('ROLLBACK', $this->connection);
         $this->transaction_opcount = 0;
         if (!$result) {
             return $this->sybaseRaiseError();
         }
     }
     return DB_OK;
 }
Example #25
0
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="../stylePrint.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body bgcolor="#FFFFFF" text="#000000">

<?php 
// Récupération des données du patient
$queryPat = "SELECT * FROM patient_admin INNER JOIN patient_treat ON patient_admin.idStluc=patient_treat.idStluc WHERE patient_admin.idStluc='{$_SESSION['idPatStluc']}' AND patient_treat.volcible='{$_SESSION['volcible']}' AND patient_treat.req='{$_SESSION['req']}' AND patient_treat.ptv='{$_SESSION['ptv']}' AND patient_treat.plan='{$_SESSION['plan']}' AND patient_treat.status='{$_SESSION['statusPat']}'";
$resultPat = mysql_query($queryPat);
$coordPat = mysql_fetch_array($resultPat);
//echo "TEST<pre>"; print_r($coordPat); echo "</pre>";
//recherche des infos autres sur le patient dans VISIR
$link = sybase_connect('10.96.4.201:5000', 'visiruse', 'visirdb') or die("Impossible de se connecter !");
//print ("Connexion établie");
sybase_select_db("visir");
//Va falloir trouver qque chose pour récupérer le PIDno du patient dans Visir ...
$pidno = $coordPat[idStluc];
//requete sur les coordonnées -- (patient.Lastname='$coordPat[lastname]') AND AND (patient.Firstname='$coordPat[firstname]')
$queryCOORD = "SELECT patient.Tel1, patient.Tel2, patient.Tel3, patient.PersNo, patient.BirthDate FROM patient\n\t\t\tWHERE ( (patient.PIDno={$pidno}))";
//echo $queryCOORD;
$requeteCOORD = sybase_query($queryCOORD, $link);
//while($row=sybase_fetch_array($requeteCOORD)) {
$row = sybase_fetch_array($requeteCOORD);
//echo "TEST<pre>"; print_r($row); echo "</pre>";
$tel1 = $row[Tel1];
$tel2 = $row[Tel2];
$tel3 = $row[Tel3];
$persno = $row[PersNo];
//=$row[PIDno];
$birthdate = $row[BirthDate];
Example #26
0
 function connect_sybase($host, $user, $pass, $db)
 {
     $this->sybase_link = sybase_connect($host, $user, $pass);
     if ($this->sybase_link == 0) {
         return false;
     }
     if (!sybase_select_db($db, $this->sybase_link)) {
         print "Database Error. \n";
         return false;
     }
     return $this->sybase_link;
 }
 function SelectDB($dbName)
 {
     $this->database = $dbName;
     $this->databaseName = $dbName;
     # obsolete, retained for compat with older adodb versions
     if ($this->_connectionID) {
         return @sybase_select_db($dbName);
     } else {
         return false;
     }
 }
 function select($dbname = '')
 {
     global $ezsql_sybase_str;
     $return_val = false;
     // Must have a database name
     if (!$dbname) {
         $this->register_error($ezsql_sybase_str[3] . ' in ' . __FILE__ . ' on line ' . __LINE__);
         $this->show_errors ? trigger_error($ezsql_sybase_str[3], E_USER_WARNING) : null;
     } else {
         if (!$this->dbh) {
             $this->register_error($ezsql_sybase_str[4] . ' in ' . __FILE__ . ' on line ' . __LINE__);
             $this->show_errors ? trigger_error($ezsql_sybase_str[4], E_USER_WARNING) : null;
         } else {
             if (!@sybase_select_db($dbname, $this->dbh)) {
                 $str = $ezsql_sybase_str[5];
                 $this->register_error($str . ' in ' . __FILE__ . ' on line ' . __LINE__);
                 $this->show_errors ? trigger_error($str, E_USER_WARNING) : null;
             } else {
                 $this->dbname = $dbname;
                 $return_val = true;
             }
         }
     }
     return $return_val;
 }
 /**
  * Returns information about a table or a result set
  *
  * NOTE: only supports 'table' and 'flags' if <var>$result</var>
  * is a table name.
  *
  * @param object|string  $result  DB_result object from a query or a
  *                                 string containing the name of a table.
  *                                 While this also accepts a query result
  *                                 resource identifier, this behavior is
  *                                 deprecated.
  * @param int            $mode    a valid tableInfo mode
  *
  * @return array  an associative array with the information requested.
  *                 A DB_Error object on failure.
  *
  * @see DB_common::tableInfo()
  * @since Method available since Release 1.6.0
  */
 function tableInfo($result, $mode = null)
 {
     if (is_string($result)) {
         /*
          * Probably received a table name.
          * Create a result resource identifier.
          */
         if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
             return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
         }
         $id = @sybase_query("SELECT * FROM {$result} WHERE 1=0", $this->connection);
         $got_string = true;
     } elseif (isset($result->result)) {
         /*
          * Probably received a result object.
          * Extract the result resource identifier.
          */
         $id = $result->result;
         $got_string = false;
     } else {
         /*
          * Probably received a result resource identifier.
          * Copy it.
          * Deprecated.  Here for compatibility only.
          */
         $id = $result;
         $got_string = false;
     }
     if (!is_resource($id)) {
         return $this->sybaseRaiseError(DB_ERROR_NEED_MORE_DATA);
     }
     if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
         $case_func = 'strtolower';
     } else {
         $case_func = 'strval';
     }
     $count = @sybase_num_fields($id);
     $res = array();
     if ($mode) {
         $res['num_fields'] = $count;
     }
     for ($i = 0; $i < $count; $i++) {
         $f = @sybase_fetch_field($id, $i);
         // column_source is often blank
         $res[$i] = array('table' => $got_string ? $case_func($result) : $case_func($f->column_source), 'name' => $case_func($f->name), 'type' => $f->type, 'len' => $f->max_length, 'flags' => '');
         if ($res[$i]['table']) {
             $res[$i]['flags'] = $this->_sybase_field_flags($res[$i]['table'], $res[$i]['name']);
         }
         if ($mode & DB_TABLEINFO_ORDER) {
             $res['order'][$res[$i]['name']] = $i;
         }
         if ($mode & DB_TABLEINFO_ORDERTABLE) {
             $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
         }
     }
     // free the result only if we were called on a table
     if ($got_string) {
         @sybase_free_result($id);
     }
     return $res;
 }
Example #30
0
 /**
  * Change the current database
  * @param string
  * @return boolean
  */
 protected function set_database($strDatabase)
 {
     return @sybase_select_db($strDatabase);
 }