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;
 }
 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;
 }
 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);
 }
Example #4
0
// 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 = '******';

$conn->login($user_id, $user_pass);
*/
$user_id = 5000000;
$user_pass = '******';
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()
 private function __construct()
 {
     $this->factory = ConnectionFactory::getInstance();
     $config = RunlevelConfig::load(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DIRECTORY_SEPARATOR . 'config', 'database');
     $this->factory->setConfiguration($config);
 }
Example #6
0
 public function releaseConnection($connection)
 {
     ConnectionFactory::getInstance()->releaseConnection($connection);
 }