/** * Constructor. * * Connects to database with given connection string. * * @param string $dsn The connection string. * @param boolean $persistent Whether or not to establish a persistent connection. * * @throws SQLAnywhereException */ public function __construct($dsn, $persistent = false) { $this->connection = $persistent ? @sasql_pconnect($dsn) : @sasql_connect($dsn); if (!is_resource($this->connection) || get_resource_type($this->connection) !== 'SQLAnywhere connection') { throw SQLAnywhereException::fromSQLAnywhereError(); } // Disable PHP warnings on error. if (!sasql_set_option($this->connection, 'verbose_errors', false)) { throw SQLAnywhereException::fromSQLAnywhereError($this->connection); } // Enable auto committing by default. if (!sasql_set_option($this->connection, 'auto_commit', 'on')) { throw SQLAnywhereException::fromSQLAnywhereError($this->connection); } // Enable exact, non-approximated row count retrieval. if (!sasql_set_option($this->connection, 'row_counts', true)) { throw SQLAnywhereException::fromSQLAnywhereError($this->connection); } }
public function __construct($calc_id, $score_id) { $this->calc_id = $calc_id; //подключения к базе $this->con = sasql_connect("UID=dba;PWD=gjknfdf_rhtlbns;SERVER=app_12;DBN=lease12;HOST=front"); $this->con1 = sasql_connect("UID=dba;PWD=sql;SERVER=test_12;DBN=father;HOST=front_test"); // $this->con2 = sasql_connect( "UID=dba;PWD=gjknfdf_rhtlbns;SERVER=test_12;DBN=father;HOST=front_test" ); //информацыя о машине $q = 'select * from calc_pars where calc_id = ' . $this->calc_id; $res = sasql_query($this->con, $q); $this->car = sasql_fetch_array($res); // $this->printArr($this->car); //информацыя о заказчике $q1 = 'SELECT * FROM "DBA"."физ_лица_nst" LEFT JOIN Applications on Applications.app_client_id="физ_лица_nst".ID LEFT JOIN app_calc on Applications.app_id=app_calc.app_id where app_calc.calc_id=' . $this->calc_id; $res = sasql_query($this->con, $q1); $this->users = sasql_fetch_array($res); // $this->printArr($this->users); //id_scoring // $q = 'select score_id.nextval'; // $res = sasql_query($this->con, $q ); // $res1 = sasql_fetch_array($res); // $this->score_id = $res1['nextval']; if ($score_id == false) { $q = 'select score_id.nextval'; $res = sasql_query($this->con, $q); $res1 = sasql_fetch_array($res); $this->score_id = $res1['nextval']; } else { $this->score_id = $score_id; } // var_dump($this->score_id); }
/** * Create connection fybase * @param string $dns String connection for sybase * @param boolean $persistent Define connection for persistent */ function __construct($dns, $autocommit = true, $persistent = false) { $this->dns = $dns; $this->persistent = $persistent; $this->autocommit = $autocommit; if (!function_exists('sasql_connect')) { throw new Exception("SQL Anywhere model not install in this server!", 100); } // Verifica se a conexão é persistente if ($this->persistent) { $this->connection = sasql_pconnect($this->dns); } else { $this->connection = sasql_connect($this->dns); } if (!$this->connection) { throw new Exception("Connection Problem :: " . sasql_error(), 101); } // Define option auto_commit if ($this->connection) { sasql_set_option($this->connection, 'auto_commit', $this->autocommit ? 'on' : 0); $this->dbinfo = array($dns, $autocommit, $persistent); } }
public function __construct($calc_id) { $this->calc_id = $calc_id; //подключения к базе $this->con = sasql_connect("UID=dba;PWD=gjknfdf_rhtlbns;SERVER=app_12;DBN=lease12;HOST=front"); //информацыя о машине $q = 'select * from calc_pars where calc_id = ' . $this->calc_id; $res = sasql_query($this->con, $q); $this->car = sasql_fetch_array($res); // $this->prn($this->car); $q = 'SELECT * FROM "DBA"."s_mark" where id = ' . $this->car['mark_id']; $res = sasql_query($this->con, $q); $this->mark = sasql_fetch_array($res); $this->model = $this->car['mark_id']; $q = 'select month_id, debt*-1 as debt from Graphics_Calc where calc_id = ' . $this->calc_id; // $this->prn($q); $res = sasql_query($this->con, $q); // $this->ulf_pay = sasql_fetch_array($res); while ($row = sasql_fetch_array($res)) { $this->ulf_pay[$row['month_id']] = $row['debt']; } // $this->prn($this->ulf_pay); }
/** * Non-persistent database connection * * @access private called by the base class * @return resource */ function db_connect() { // return @sasql_connect("Dbn=$this->database;UID=$this->username;PWD=$this->password;ServerName=$this->server_name"); return @sasql_connect("UID=dba;PWD=gjknfdf_rhtlbns;SERVER=app_12;DBN=lease12;HOST=front"); }
<?php require_once "../config.php"; $res = sasql_connect($sasql_conn); require "../../codebase/grid_connector.php"; require "../../codebase/db_sasql.php"; $grid = new GridConnector($res, "SaSQL"); $grid->enable_log("temp.log", true); $grid->dynamic_loading(100); $grid->render_table("Contacts", "ID", "Surname,GivenName,Title");
/** * Non-persistent database connection * * @access private called by the base class * @return resource */ function db_connect() { return @sasql_connect($this->_connect_string()); }
public function __construct($calc_id) { $this->calc_id = $calc_id; //подключения к базе $this->con = sasql_connect("UID=dba;PWD=gjknfdf_rhtlbns;SERVER=app_12;DBN=lease12;HOST=front"); $q1 = 'SELECT * FROM "DBA"."физ_лица_nst" LEFT JOIN Applications on Applications.app_client_id="физ_лица_nst".ID LEFT JOIN app_calc on Applications.app_id=app_calc.app_id where app_calc.calc_id=' . $this->calc_id; $res = sasql_query($this->con, $q1); $this->users = sasql_fetch_array($res); $this->inn = $this->users['ИНН']; // $this->inn = '2905602379'; $this->lnameua = $this->users['Фамилия']; // $this->lnameua = 'Нікітін'; $this->fnameua = $this->users['Имя']; // $this->fnameua = 'Андрій'; $this->mnameua = $this->users['Отчество']; // $this->mnameua = 'Іванович'; $this->pser = $this->users['Паспорт_Серия']; // $this->pser = 'КН'; $this->pnom = $this->users['Паспорт_Номер']; // $this->pnom = '925600'; $this->bdate = $this->users['Дата_Рождения']; // $this->bdate = '1969-06-17'; // $this->prn($this->users); }