本文整理汇总了PHP中ConnectionFactory::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionFactory::getInstance方法的具体用法?PHP ConnectionFactory::getInstance怎么用?PHP ConnectionFactory::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionFactory
的用法示例。
在下文中一共展示了ConnectionFactory::getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJsonResponse
public function getJsonResponse($lat, $long, $distance)
{
$this->connection = ConnectionFactory::getInstance()->createConnection(false);
$posicaoAtualBI = new PosicaoAtualBI($this->connection);
$jsonResponse = $posicaoAtualBI->createJSONResponse($lat, $long, $distance);
$posicaoAtualBI->releaseConnection($this->connection);
return $jsonResponse;
}
示例2: getJsonResponse
public function getJsonResponse($cidade, $bairro, $rua)
{
$this->connection = ConnectionFactory::getInstance()->createConnection(false);
$locEspecificaBI = new LocEspecificaBI($this->connection);
$jsonResponse = $locEspecificaBI->getJsonResponse($cidade, $bairro, $rua);
$locEspecificaBI->releaseConnection($this->connection);
return $jsonResponse;
}
示例3: testGetConnection
public function testGetConnection()
{
$connFatory = ConnectionFactory::getInstance();
$config = (include dirname(__FILE__) . '/_files/database.cnf.php');
$connFatory->setConfiguration($config);
$test1Conn1 = $connFatory->getConnction('test1');
$this->assertType('PDO', $test1Conn1);
$test1Conn2 = $connFatory->getConnction('test1');
$this->assertType('PDO', $test1Conn2);
$this->assertSame($test1Conn1, $test1Conn2);
$test2Conn1 = $connFatory->getConnction('test2');
$this->assertType('PDO', $test2Conn1);
$test2Conn2 = $connFatory->getConnction('test2');
$this->assertType('PDO', $test2Conn2);
$this->assertSame($test2Conn1, $test2Conn2);
$this->assertNotSame($test1Conn1, $test2Conn1);
}
示例4: DBConn_Login
// sf_check_account - check user id with password
// sp_reset_password - reset user's password
// sp_create_account - create user account
require 'DbInterface.php';
/*
$conn = new DBConn_Login();
$conn->connect();
$user_id = 5000000;
$user_pass = 'password_e0';
$conn->login($user_id, $user_pass);
*/
$user_id = 5000000;
$user_pass = 'password_e0';
ConnectionFactory::getInstance($user_id, $user_pass);
function testFunc1()
{
// Connection Test Code
$conn = new mysqli('localhost', 'admin', 'admin1', 'auth');
/* check connection */
if ($conn->connect_errno) {
printf("Connect failed: %s\n", $conn->mysqli_connect_error);
exit;
}
// Stored Procedure Usage
$result = $conn->query('CALL sp_reset_password(0, \'e25558\', \'0000\')');
$result->mysqli_free_result();
$conn->close();
}
function testFunc2()
示例5: __construct
private function __construct()
{
$this->factory = ConnectionFactory::getInstance();
$config = RunlevelConfig::load(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DIRECTORY_SEPARATOR . 'config', 'database');
$this->factory->setConfiguration($config);
}
示例6: releaseConnection
public function releaseConnection($connection)
{
ConnectionFactory::getInstance()->releaseConnection($connection);
}