• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ADOdb_Active_Record类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了ADOdb_Active_Record类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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


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


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


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


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


示例10: editarRegistro

 public function editarRegistro()
 {
     $this->usarScaffold();
     //Conectarse a la base de datos
     if ($this->db == "") {
         $this->db = "default";
     }
     $conexion = $this->nucleo->getConexion($this->db);
     $conexion->Execute("SET NAMES utf8");
     //Primarias en $primarias
     //Demas campos en $campos
     $campos = $this->getCampos();
     $registro = new ADOdb_Active_Record($this->modelo);
     $where = "";
     foreach ($campos as $c) {
         if ($c["primaria"] == 1) {
             if ($where != "") {
                 $where .= " AND ";
             }
             $where .= $c["nombre"] . "=" . $this->par['pri_' . $c["nombre"]];
         }
     }
     $registro->Load($where);
     foreach ($campos as $c) {
         if ($c["auto"] == 1) {
         } elseif ($c["nombre"] == "password" || $c["nombre"] == "contrasena") {
             if ($this->par[$c["nombre"]] != "") {
                 $registro->{$c}["nombre"] = md5($this->par[$c["nombre"]]);
             }
         } elseif ($c["nombre"] == "texto") {
             $registro->{$c}["nombre"] = stripslashes($this->par[$c["nombre"]]);
         } else {
             $registro->{$c}["nombre"] = $this->par[$c["nombre"]];
         }
     }
     if ($registro->Save()) {
         $this->set("editado", "1");
         $this->listado();
         $this->set("vista", "listado");
     } else {
         $this->set("editado", "0");
         $this->agregar();
         $this->set("vista", "agregar");
     }
 }
开发者ID:axelavargas,项目名称:UFPS-CMS,代码行数:45,代码来源:libscaffold.class.php


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


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


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


示例14: NewADOConnection

    }
}
$db = NewADOConnection('mysql://root@localhost/northwind?persist');
$db->debug = 1;
ADOdb_Active_Record::SetDatabaseAdapter($db);
$db->Execute("CREATE TEMPORARY TABLE `persons` (\r\n\t                `id` int(10) unsigned NOT NULL auto_increment,\r\n\t                `name_first` varchar(100) NOT NULL default '',\r\n\t                `name_last` varchar(100) NOT NULL default '',\r\n\t                `favorite_color` varchar(100) NOT NULL default '',\r\n\t                PRIMARY KEY  (`id`)\r\n\t            ) ENGINE=MyISAM;\r\n\t           ");
$db->Execute("CREATE TEMPORARY TABLE `children` (\r\n\t                `id` int(10) unsigned NOT NULL auto_increment,\r\n\t\t\t\t\t`person_id` int(10) unsigned NOT NULL,\r\n\t                `name_first` varchar(100) NOT NULL default '',\r\n\t                `name_last` varchar(100) NOT NULL default '',\r\n\t                `favorite_pet` varchar(100) NOT NULL default '',\r\n\t                PRIMARY KEY  (`id`)\r\n\t            ) ENGINE=MyISAM;\r\n\t           ");
class Person extends ADOdb_Active_Record
{
    function ret($v)
    {
        return $v;
    }
}
$person = new Person();
ADOdb_Active_Record::$_quoteNames = '111';
echo "<p>Output of getAttributeNames: ";
var_dump($person->getAttributeNames());
/**
 * Outputs the following:
 * array(4) {
 *    [0]=>
 *    string(2) "id"
 *    [1]=>
 *    string(9) "name_first"
 *    [2]=>
 *    string(8) "name_last"
 *    [3]=>
 *    string(13) "favorite_color"
 *  }
 */
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:test-active-record.php


示例15: TableKeyBelongsTo

 static function TableKeyBelongsTo($table, $tablePKey, $foreignRef, $foreignKey = false, $parentKey = '', $parentClass = 'ADODB_Active_Record')
 {
     if (!is_array($tablePKey)) {
         $tablePKey = array($tablePKey);
     }
     $ar = new ADOdb_Active_Record($table, $tablePKey);
     $ar->belongsTo($foreignRef, $foreignKey, $parentKey, $parentClass);
 }
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:8,代码来源:adodb-active-record.inc.php


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


示例17: doquote

 /**
  * Override the default `doquote` method to better sanitize numeric values.
  *
  * @param ADOConnection $db
  * @param mixed $value
  * @param string $type
  * @return mixed
  */
 public function doquote(&$db, $value, $type)
 {
     switch ($type) {
         case 'L':
         case 'I':
         case 'I1':
         case 'I2':
         case 'I4':
         case 'I8':
         case 'F':
         case 'N':
             if (!is_numeric($value)) {
                 if (is_null($value)) {
                     return null;
                 }
                 if ($value === true) {
                     return 1;
                 }
                 if ($value === false) {
                     return 0;
                 }
                 $db->outp_throw('Numeric field type "' . $type . '" requires numeric value.', 'DOQUOTE');
                 return 0;
             }
         default:
             return parent::doquote($db, $value, $type);
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:36,代码来源:model.php


示例18: __construct

	public function __construct ($db_name=false,$keys=false) {
		if (!$keys) {
			$keys = array('ipFrom','ipTo');
		}
		$this->unique_keys=$keys;
		parent::__construct();
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:7,代码来源:user_banned_ip.php


示例19: __construct

		public function __construct($tbl = null) {
			if ($tbl) {
				$db = Loader::db();
				$this->_table = $tbl;
				parent::__construct($tbl);
			}
		}
开发者ID:remkoj,项目名称:concrete5,代码行数:7,代码来源:block_view.php


示例20: save

 public function save($data = null)
 {
     if ($data != null) {
         $this->setData($data);
     }
     parent::replace();
 }
开发者ID:rmxdave,项目名称:multisite,代码行数:7,代码来源:model.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AEAbstractFilter类代码示例发布时间:2022-05-23
下一篇:
PHP ADORecordSet_postgres64类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap