本文整理汇总了PHP中getDoliDBInstance函数的典型用法代码示例。如果您正苦于以下问题:PHP getDoliDBInstance函数的具体用法?PHP getDoliDBInstance怎么用?PHP getDoliDBInstance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDoliDBInstance函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connectSpip
/**
* Function used to connect to SPIP
*
* @return boolean|DoliDB Boolean of DoliDB
*/
function connectSpip()
{
$resource = getDoliDBInstance('mysql', ADHERENT_SPIP_SERVEUR, ADHERENT_SPIP_USER, ADHERENT_SPIP_PASS, ADHERENT_SPIP_DB, ADHERENT_SPIP_PORT);
if ($resource->ok) {
return $resource;
}
dol_syslog('Error when connecting to SPIP ' . ADHERENT_SPIP_SERVEUR . ' ' . ADHERENT_SPIP_USER . ' ' . ADHERENT_SPIP_PASS . ' ' . ADHERENT_SPIP_DB, LOG_ERR);
return false;
}
示例2: dol_decode
else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
}
// $conf is already instancied inside inc.php
$conf->db->type = $dolibarr_main_db_type;
$conf->db->host = $dolibarr_main_db_host;
$conf->db->port = $dolibarr_main_db_port;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
// For encryption
$conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption)?$dolibarr_main_db_encryption:'';
$conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey)?$dolibarr_main_db_cryptkey:'';
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
if ($db->connected)
{
print '<tr><td class="nowrap">';
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>";
dolibarr_install_syslog("repair: " . $langs->transnoentities("ServerConnection") . ": " . $dolibarr_main_db_host . $langs->transnoentities("OK"));
$ok = 1;
}
else
{
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->transnoentities("Error")."</td></tr>";
dolibarr_install_syslog("repair: " . $langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok = 0;
}
示例3: getDoliDBInstance
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/boutique/osc_master.inc.php
* \brief File of preparation of the environment Dolibarr for OSCommerce
*/
/*
* Creation objet $dbosc
*/
$dbosc = getDoliDBInstance($conf->db->type, $conf->global->OSC_DB_HOST, $conf->global->OSC_DB_USER, $conf->global->OSC_DB_PASS, $conf->global->OSC_DB_NAME, $conf->global->OSC_DB_PORT);
if (!$dbosc->connected) {
dol_syslog($dbosc, "host=" . $conf->global->OSC_DB_HOST . ", user=" . $conf->global->OSC_DB_USER . ", databasename=" . $conf->global->OSC_DB_NAME . ", " . $db->error, LOG_ERR);
llxHeader("", $langs->trans("OSCommerceShop"), "");
print '<div class="error">' . $langs->trans('FailedConnectDBCheckModuleSetup') . '</div>';
llxFooter();
exit;
}
示例4: getDoliDBInstance
// After this $db is a defined handler to database.
// Main
$version = '3.2';
@set_time_limit(0);
$error = 0;
$langs->load("main");
print "***** {$script_file} ({$version}) *****\n";
// -------------------- START OF BUILD_CLASS_FROM_TABLE SCRIPT --------------------
// Check parameters
if (!isset($argv[1]) || isset($argv[2]) && !isset($argv[6])) {
print "Usage: {$script_file} tablename [server port databasename user pass]\n";
exit;
}
if (isset($argv[2]) && isset($argv[3]) && isset($argv[4]) && isset($argv[5]) && isset($argv[6])) {
print 'Use specific database ids' . "\n";
$db = getDoliDBInstance('mysqli', $argv[2], $argv[5], $argv[6], $argv[4], $argv[3]);
}
if ($db->type != 'mysql' && $db->type != 'mysqli') {
print "Error: This script works with mysql or mysqli driver only\n";
exit;
}
// Show parameters
print 'Tablename=' . $argv[1] . "\n";
print "Current dir is " . getcwd() . "\n";
// Define array with list of properties
$property = array();
$table = $argv[1];
$foundprimary = 0;
$resql = $db->DDLDescTable($table);
if ($resql) {
$i = 0;
示例5: is_in_spip
/**
* Fonction qui dit si cet utilisateur est un redacteur existant dans spip
*
* @param Object $object Object with data (->login)
* @return int 1=exists, 0=does not exists, -1=error
*/
function is_in_spip($object)
{
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != '')
{
$query = "SELECT login FROM spip_auteurs WHERE login='".$object->login."'";
$mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
if ($mydb->ok)
{
$result = $mydb->query($query);
if ($result)
{
if ($mydb->num_rows($result))
{
// nous avons au moins une reponse
$mydb->close($result);
return 1;
}
else
{
// nous n'avons pas de reponse => n'existe pas
$mydb->close($result);
return 0;
}
}
else
{
$this->error=$mydb->lasterror();
$mydb->close();
return -1;
}
}
else
{
$this->error="Failed to connect ".ADHERENT_SPIP_SERVEUR." ".ADHERENT_SPIP_USER." ".ADHERENT_SPIP_PASS." ".ADHERENT_SPIP_DB;
return -1;
}
}
}