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


PHP ADOdb_Active_Record::SetDatabaseAdapter方法代码示例

本文整理汇总了PHP中ADOdb_Active_Record::SetDatabaseAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP ADOdb_Active_Record::SetDatabaseAdapter方法的具体用法?PHP ADOdb_Active_Record::SetDatabaseAdapter怎么用?PHP ADOdb_Active_Record::SetDatabaseAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ADOdb_Active_Record的用法示例。


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

示例1: _init_adodb_library

 function _init_adodb_library(&$ci)
 {
     $db_var = false;
     $debug = false;
     $show_errors = true;
     $active_record = false;
     $db = NULL;
     if (!isset($dsn)) {
         // fallback to using the CI database file
         include APPPATH . 'config/database' . EXT;
         $group = 'default';
         $dsn = $db[$group]['dbdriver'] . '://' . $db[$group]['username'] . ':' . $db[$group]['password'] . '@' . $db[$group]['hostname'] . '/' . $db[$group]['database'];
     }
     // Show Message Adodb Library PHP
     if ($show_errors) {
         require_once BASEPATH . 'packages/adodb5/adodb-errorhandler.inc' . EXT;
     }
     // $ci is by reference, refers back to global instance
     $ci->adodb =& ADONewConnection($dsn);
     // Use active record adodbx
     $ci->adodb->setFetchMode(ADODB_FETCH_ASSOC);
     if ($db_var) {
         // Also set the normal CI db variable
         $ci->db =& $ci->adodb;
     }
     if ($active_record) {
         require_once BASEPATH . 'packages/adodb5/adodb-active-record.inc' . EXT;
         ADOdb_Active_Record::SetDatabaseAdapter($ci->adodbx);
     }
     if ($debug) {
         $ci->adodb->debug = true;
     }
 }
开发者ID:baltimoreteacher,项目名称:Grading,代码行数:33,代码来源:Adodbx.php

示例2: connectToDatabase

function connectToDatabase()
{
    $dsn = 'mysqli://root:sasakixi@localhost/movies';
    global $db;
    $db = ADONewConnection($dsn);
    if (!$db) {
        die("Failed to connect to database : " . $dsn);
    }
    ADOdb_Active_Record::SetDatabaseAdapter($db);
    ADOdb_Active_Record::ClassHasMany('Moviemains', 'Moviesupps', 'fk_movie');
    return $db;
}
开发者ID:bearwithcode,项目名称:Victor,代码行数:12,代码来源:config.php

示例3: crearconexion

	public function crearconexion()
	{
		$db = NewADOConnection($this->gestor);
		if($db->NConnect($this->host,$this->user,$this->pass,$this->base))
		{		
			ADOdb_Active_Record::SetDatabaseAdapter($db);
			$ADODB_ASSOC_CASE = 0;
			return $db;
		}
		else
		{
			return false;
		}
	}
开发者ID:ssolano,项目名称:cafe_sigesp,代码行数:14,代码来源:sigesp_conexiondin_dao.php

示例4: __construct

 public function __construct($user, $password = '', $dbname = '', $host = '', $port = '', $sock = '', $retry = 3, $retry_int = 1)
 {
     $this->id = md5(uniqid('MTDatabase', true));
     $retry_cnt = 0;
     while ((empty($this->conn) || !empty($this->conn) && !$this->conn->IsConnected()) && $retry_cnt++ < $retry) {
         try {
             $this->connect($user, $password, $dbname, $host, $port, $sock);
         } catch (Exception $e) {
             sleep($retry_int);
         }
     }
     if (empty($this->conn) || !empty($this->conn) && !$this->conn->IsConnected()) {
         throw new MTDBException($this->conn->ErrorMsg(), 0);
     }
     ADOdb_Active_Record::SetDatabaseAdapter($this->conn);
     #        $this->conn->debug = true;
 }
开发者ID:OCMO,项目名称:movabletype,代码行数:17,代码来源:mtdb.base.php

示例5: die

    if ($i != $cnt) {
        die("actual cnt is {$i}, cnt should be {$cnt}\n");
    } else {
        echo "Count {$i} is correct<br>";
    }
    $rs = $db->Execute("select bad from badder");
} catch (exception $e) {
    adodb_pr($e);
    echo "<h3>adodb_backtrace:</h3>\n";
    $e = adodb_backtrace($e->gettrace());
}
$rs = $db->Execute("select distinct id, firstname,lastname from adoxyz order by id");
echo "Result=\n", $rs, "</p>";
echo "<h3>Active Record</h3>";
include_once "../adodb-active-record.inc.php";
ADOdb_Active_Record::SetDatabaseAdapter($db);
try {
    class City extends ADOdb_Active_Record
    {
    }
    $a = new City();
} catch (exception $e) {
    echo $e->getMessage();
}
try {
    $a = new City();
    echo "<p>Successfully created City()<br>";
    #var_dump($a->GetPrimaryKeys());
    $a->city = 'Kuala Lumpur';
    $a->Save();
    $a->Update();
开发者ID:GLUD,项目名称:EcoHack,代码行数:31,代码来源:test-php5.php

示例6: db

 /** 
  * Returns the database object, or loads it if not yet created
  * <code>
  * <?php 
  * $db = Loader::db();
  * $db->query($sql);
  * </code>
  */
 public function db($server = null, $username = null, $password = null, $database = null, $create = false, $autoconnect = true)
 {
     static $_dba;
     if ((!isset($_dba) || $create) && $autoconnect) {
         if ($server == null && defined('DB_SERVER')) {
             $dsn = DB_TYPE . '://' . DB_USERNAME . ':' . rawurlencode(DB_PASSWORD) . '@' . rawurlencode(DB_SERVER) . '/' . DB_DATABASE;
         } else {
             if ($server) {
                 $dsn = DB_TYPE . '://' . $username . ':' . rawurlencode($password) . '@' . rawurlencode($server) . '/' . $database;
             }
         }
         if (isset($dsn) && $dsn) {
             $_dba = @NewADOConnection($dsn);
             if (is_object($_dba)) {
                 $_dba->setFetchMode(ADODB_FETCH_ASSOC);
                 if (DB_CHARSET != '') {
                     $names = 'SET NAMES \'' . DB_CHARSET . '\'';
                     if (DB_COLLATE != '') {
                         $names .= ' COLLATE \'' . DB_COLLATE . '\'';
                     }
                     $_dba->Execute($names);
                 }
                 ADOdb_Active_Record::SetDatabaseAdapter($_dba);
             } else {
                 if (defined('DB_SERVER')) {
                     $v = View::getInstance();
                     $v->renderError(t('Unable to connect to database.'), t('A database error occurred while processing this request.'));
                 }
             }
         } else {
             return false;
         }
     }
     return $_dba;
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:43,代码来源:loader.php

示例7: error_reporting

<?php

global $conf;
global $global;
error_reporting(E_ALL ^ E_NOTICE);
define('APPROOT', realpath(dirname(__FILE__) . '/../') . '/');
$_SESSION['username'] = 'admin';
require_once APPROOT . 'conf/sysconf.php';
require_once APPROOT . '3rd/adodb5/adodb-active-record.inc.php';
require_once APPROOT . 'inc/lib_uuid.inc';
//load db handler
require_once APPROOT . 'inc/handler_db.inc';
ADOdb_Active_Record::SetDatabaseAdapter($global['db']);
//overide conf values from db
require_once APPROOT . 'inc/handler_config.inc';
include_once APPROOT . 'inc/lib_entity_forms.inc';
//include_once APPROOT.'3rd/phpgacl/gacl.class.php';
include_once APPROOT . 'inc/lib_form_util.inc';
include_once APPROOT . 'inc/lib_files.inc';
include_once APPROOT . 'inc/security/lib_acl.inc';
include_once APPROOT . 'inc/security/handler_acl.inc';
include_once APPROOT . 'inc/lib_form.inc';
include_once APPROOT . 'inc/lib_form_util.inc';
require_once APPROOT . 'data/Browse.php';
require_once APPROOT . 'data/MtField.php';
require_once APPROOT . 'data/MtFieldWrapper.php';
require_once APPROOT . 'data/MtIndex.php';
require_once APPROOT . 'data/MtTerms.php';
$mtIndex = new MtIndex();
$index_terms = $mtIndex->Find('');
$options = array();
开发者ID:GeraldScott,项目名称:OpenEvSys,代码行数:31,代码来源:upgrade.2.0-2.1.php

示例8: define

define("LOOMP_USER_URI_NS", LOOMP_BASE_PATH . "/users/");
if (!strstr($_SERVER['REQUEST_URI'], 'install') && !strstr($_SERVER['REQUEST_URI'], 'error')) {
    try {
        // set database connection and retrieve the rdf model
        $logger->debug("Initializing RDF store");
        $rdfStore = ModelFactory::getDbStore($configuration->loomp->db->type, $configuration->loomp->db->host, $configuration->loomp->db->name, $configuration->loomp->db->user, $configuration->loomp->db->pass);
        //die(LOOMP_MODEL_URI);
        $registry->rdfModel = $rdfStore->getModel(LOOMP_MODEL_URI);
        if ($registry->rdfModel === false) {
            throw new Exception("Failed to initialize RDF store.");
        }
        $logger->debug("Initializing Loomp API");
        $registry->loompApi = new LoompApi();
        // Active Record stuff
        require_once RDFAPI_INCLUDE_DIR . 'util/adodb/adodb-active-record.inc.php';
        require_once APPLICATION_PATH . '/model/User.php';
        require_once APPLICATION_PATH . '/model/Access.php';
        ADOdb_Active_Record::SetDatabaseAdapter($rdfStore->getDbConn());
    } catch (Exception $e) {
        $logger->err("Init error: " . $e->getMessage());
        $logger->err($e->getTraceAsString());
        $loomp_path = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . "/error/nosetup";
        header("Location: " . $loomp_path);
        die;
    }
}
// CLEANUP - remove items from global scope
// This will clear all our local boostrap variables from the global scope of
// this script (and any scripts that called bootstrap).  This will enforce
// object retrieval through the Applications's Registry
unset($frontController, $view, $configuration, $arsConfig, $registry, $logger, $translate);
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:31,代码来源:bootstrap.php

示例9: __construct

 public function __construct($appapikey, $appsecret, $adoConnectString)
 {
     $this->client = new Facebook($appapikey, $appsecret);
     $this->db = NewADOConnection($adoConnectString);
     ADOdb_Active_Record::SetDatabaseAdapter($this->db);
 }
开发者ID:JohnField,项目名称:publicfacebookfeed,代码行数:6,代码来源:facebookfeed.class.php

示例10: ADONewConnection

* @librería que contiene la conexión a la Base de Datos
* @fecha de creación: 16/05/2008 
* @autor: Ing. Yesenia Moreno de Lang
* **************************
* @fecha modificacion 
* @autor   
* @descripcion 
***********************************************************************************/
include '../../base/librerias/php/adodb/adodb.inc.php';
include '../../base/librerias/php/adodb/adodb-exceptions.inc.php';
include '../../base/librerias/php/adodb/adodb-active-record.inc.php';
$conexionbd =& ADONewConnection($_SESSION['sigesp_gestor_apr']);
$conexionbd->Connect($_SESSION['sigesp_servidor_apr'], $_SESSION['sigesp_usuario_apr'], $_SESSION['sigesp_clave_apr'], $_SESSION['sigesp_basedatos_apr']);
if ($conexionbd != false) {
    $conexionbd->SetFetchMode(ADODB_FETCH_ASSOC);
    ADOdb_Active_Record::SetDatabaseAdapter($conexionbd);
    $ADODB_ASSOC_CASE = 0;
    $ADODB_FORCE_IGNORE = 0;
}
/***********************************************************************************
* @Función que se conecta a una base de datos según los parámetros 
* @parametros: 
* @retorno:
* @fecha de creación: 20/10/2008
* @autor: Ing. Yesenia Moreno de Lang
************************************************************************************
* @fecha modificación:
* @descripción:
* @autor:
***********************************************************************************/
function conectarBD($servidor, $usuario, $clave, $basedatos, $gestor)
开发者ID:ssolano,项目名称:cafe_sigesp,代码行数:31,代码来源:sigesp_lib_conexion.php

示例11: array

<?php

require_once 'funcs.php';
$libraries = array('AR', 'Config', 'Validate', 'Html', 'Session', 'Response');
$models = array('Task');
$configuration_files = array('application' => 'inc/conf/application.php', 'database' => 'inc/conf/database.php', 'email' => 'inc/conf/email.php');
foreach ($libraries as $key => $value) {
    require_once 'inc/lib/utilities/' . $value . '.php';
}
foreach ($models as $key => $value) {
    require_once 'inc/models/' . $value . '.php';
}
Config::loads($configuration_files);
// connect to database
AR::$conn = connect(Config::read('database', 'username'), Config::read('database', 'password'), Config::read('database', 'server'), Config::read('database', 'database'));
// AR::$conn->debug = 1; // turn on / off debug message
ADOdb_Active_Record::SetDatabaseAdapter(AR::$conn);
// set minimum length of password
Validate::$min_length = 8;
Session::init();
safe_post_data();
header("Content-Type: application/json; charset=utf-8");
开发者ID:nasrulhazim,项目名称:to-do-list-server,代码行数:22,代码来源:init.php

示例12: getConexion

 /**
  * Devuelve la conexion del nucleo
  *
  * @param String $dbx
  * @return ADOConnection
  */
 public function getConexion($dbx = "default")
 {
     if ($this->conexion[$dbx] == null) {
         $ini = new Configuracion("bd.config");
         $this->conexion[$dbx] = ADONewConnection($ini->get($dbx, "tipo"));
         $this->conexion[$dbx]->Connect($ini->get($dbx, "servidor"), $ini->get($dbx, "usuario"), $ini->get($dbx, "password"), $ini->get($dbx, "nombre"));
         $this->conexion[$dbx]->Execute("SET NAMES 'utf8'");
         if ($dbx == "default") {
             ADOdb_Active_Record::SetDatabaseAdapter($this->conexion[$dbx]);
         }
     }
     return $this->conexion[$dbx];
 }
开发者ID:axelavargas,项目名称:UFPS-CMS,代码行数:19,代码来源:nucleo.class.php

示例13: Save

<?php

include_once Config::$home_lib . 'adodb5' . Config::$ds . 'adodb-active-record.inc.php';
ADOdb_Active_Record::SetDatabaseAdapter(App::$base->getADOdb());
class atable extends ADODB_Active_Record
{
    function Save()
    {
        // Agregar el generador a la llave primaria en insercion
        // el generador debe llamarse GEN_(Campo PK)
        if (App::$base->driver == 'firebird') {
            $ids = $this->DB()->MetaPrimaryKeys($this->_table);
            // PK
            $id = count($ids) > 0 ? $ids[0] : '';
            if (!$this->_saved && $id != '') {
                $id = strtolower($id);
                $gen = 'GEN_' . strtoupper($id);
                $this->{$id} = $this->DB()->GenID($gen);
            }
        }
        if (App::$base->driver == 'postgres' || App::$base->driver == 'postgres8') {
            $ids = $this->DB()->MetaPrimaryKeys($this->_table);
            // PK
            $id = count($ids) > 0 ? $ids[0] : '';
            if (!$this->_saved && $id != '') {
                $gen = $this->_table . '_' . $id . '_seq';
                //formato: tbl_nombretabla_id_campoid_seq
                $gen = strtolower($gen);
                $this->{$id} = $this->DB()->GenID($gen);
            }
        }
开发者ID:hectorjairmontero,项目名称:Turismo,代码行数:31,代码来源:active_table.php


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