本文整理汇总了PHP中DBManager::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::connect方法的具体用法?PHP DBManager::connect怎么用?PHP DBManager::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: say_error
<?php
/* Test unit para comprobar los metodos de la clase DBManager
* Puede generar un monton de usuarios dummys que deberan de ser eliminados en su dia
* Felipe Vieira
*/
require "DBManager.php";
$man = new DBManager();
function say_error($correct)
{
if ($correct) {
echo "creacion realizada correctamente<br/>";
} else {
echo "Ya existia un dato asi en la base de datos<br/>";
}
}
if ($man->connect()) {
say_error($man->insertarRol("rolDummy1", "rol de test unit"));
say_error($man->insertarFun("funDummy1", "funcion de test unit"));
say_error($man->insertarPag("pagDummy1", "pagina de test unit"));
say_error($man->insertarUser("userDummy1", "12345", "usuario de test unit", "dummy@dummy"));
say_error($man->insertarRol("rolDummy2", "rol de test unit"));
say_error($man->insertarFun("funDummy2", "funcion de test unit"));
say_error($man->insertarPag("pagDummy2", "pagina de test unit"));
say_error($man->insertarUser("userDummy2", "12345", "usuario de test unit", "dummy@dummy"));
$result = $man->listRolesByUser("userDummy1");
$result = $man->listRolesByFun("userDummy1");
$result = $man->listUsersByRol("rolDummy1");
foreach ($result as $item) {
echo $item;
}
}
示例2: DBManager
print 'No Notifier Selected.';
break;
}
$objNotifier->notify();
print "</br>";
/*---------- Design Patterns: Strategy Pattern ----------*/
//$MM = new MySQLManager();
//$MM->setHost("localhost");
//$MM->setDB("db");
//$MM->setUserName("user");
//$MM->setPassword("password");
//$MM->connect();
// ... do all this to other database drivers ...
$DM = new DBManager();
$DM->setDriver('mysql');
$DM->connect('host', 'database', 'user_mysql', 'admin');
/*---------- Design Patterns: Abstract Pattern ----------*/
$manager = new MySQLManagerAbstract();
$manager->setUserName('wdarking');
$manager->connect();
/*---------- Design Patterns: Singleton Pattern ----------*/
$a = new MySQLManager();
$b = new MySQLManager();
$c = new MySQLManager();
$d = new MySQLManager();
$e = new MySQLManager();
/*---------- Design Patterns: Iterator Pattern ----------*/
/*$blogposts = getAllPosts();
$posts = new Posts($blogposts);
foreach ($posts as $post) {
echo($post->getTitle());
示例3: DBManager
$db->setHost("192.168.1.11");
$db->setUser("admin");
$db->setPassword("admin");
$db->setDBName("mambo");
$db->connect();
$SQLCmd = "select id, menutype, name from mos_menu";
*/
/*
$db = new DBManager($DB_MANAGER->DB_ORACLE8);
$db->parseURL("db.oci8://reward:reward2005@flexim");
$db->connect();
$SQLCmd = "select * from watch";
*/
$db = new DBManager($DB_MANAGER->DB_POSTGRES);
$db->parseURL("db.postgres://inms_md:rahasia@127.0.0.1:5432/flextor");
$db->connect();
$SQLCmd = "SELECT * FROM ipm_sc.modules";
if (!$db->isConnect) {
echo "not connected<br>";
echo $db->getHost() . "<br>";
echo $db->getPort() . "<br>";
echo $db->getUser() . "<br>";
echo $db->getPassword() . "<br>";
}
/* Querying Database */
//$resultsets = new ResultSet();
$resultsets = new ResultSet();
$resultsets = $db->query($SQLCmd);
echo "Result Count = " . $resultsets->size() . " column = " . $resultsets->columnSize() . "<br>";
$counter = 0;
while ($resultsets->next()) {