Welcome Guest, Not a member yet? Register   Sign In
CI and SQL SERVER 2005 and MS ADODB not ADOdb
#4

[eluser]riza_nurhadi[/eluser]
and now for the adodb_driver.php [located @ system\database\drivers\adodb_driver.php]
this is the code.

i change function db_connect, db_pconnect so its used php COM class
oh yea i forgot i also change function insert_id
just look at the code

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class CI_DB_adodb_driver extends CI_DB {

    var $_count_string = "SELECT COUNT(*) AS ";
    var $_random_keyword = ' ASC'; // not currently supported

    function db_connect()
    {
         //this is the change
         //return @mssql_connect($this->hostname, $this->username, $this->password);
         $conn = new COM("ADODB.Connection") or die("Cannot start ADO");
         $conn->Open("Provider=SQLOLEDB; Data Source=".$this->hostname.";
         Initial Catalog=".$this->database."; User ID=".$this->username."; Password=".$this->password."");
        return $conn;
    }
    
    function db_pconnect()
    {
        //return @mssql_pconnect($this->hostname, $this->username, $this->password);
        //return true;
        return $this->db_connect();
    }
    
    function db_select()
    {
        //return @mssql_select_db($this->database, $this->conn_id);
        return true;
    }

    function db_set_charset($charset, $collation)
    {
        // TODO - add support if needed
        return TRUE;
    }

    function _execute($sql)
    {
        //$sql = $this->_prep_query($sql);
        // return @mssql_query($sql, $this->conn_id);
                $conn = $this->conn_id;
            $rs = $conn->Execute($sql);
        return $rs;
    }
    
    function insert_id()
    {
        // $ver = self::_parse_major_version($this->version());
        // $sql = ($ver >= 8 ? "SELECT SCOPE_IDENTITY() AS last_id" : "SELECT @@IDENTITY AS last_id");
        // $query = $this->query($sql);
        // $row = $query->row();
        // return $row->last_id;
        $conn = $this->conn_id;
        $sql = " SELECT @@IDENTITY AS last_id";
         $rs =  $conn->Execute($sql);
        $insertid = $rs->Fields[0]->value;
        return $insertid;
    }
}

as you see i only copy this code from mssql driver


Messages In This Thread
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 04-21-2009, 10:32 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 04-22-2009, 06:18 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 03:07 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 03:23 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 03:31 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 03:39 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 11:54 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-12-2009, 03:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB