Beispiel #1
0
 function testConnection()
 {
     $con = new folksoDBconnect('localhost', 'root', 'hellyes', 'folksonomie');
     $this->assertTrue($con instanceof folksoDBconnect);
     $this->assertTrue($con->db_obj() instanceof mysqli);
     $con2 = new folksoDBconnect('localhost', 'tester_dude', 'testy', 'testostonomie');
     $this->assertIsA($con2, folksoDBconnect, 'problem with object creation');
     $this->assertIsA($con2->db_obj(), mysqli, 'Not creating mysqli object with db_obj()');
 }
Beispiel #2
0
 /**
  * On object creation, the caller should check error status to make
  * sure the connection succeeded.
  *
  * @param folksoDBconnect $dbc
  */
 public function __construct(folksoDBconnect $dbc)
 {
     $this->additional_results = array();
     $this->result_array = array();
     $this->db = $dbc->db_obj();
     $this->db->set_charset('utf8');
     if (mysqli_connect_errno()) {
         //      $this->connect_error =
         throw new dbConnectionException("Connect failed: " . mysqli_connect_error(), mysqli_connect_errno());
     }
 }