Example #1
0
 /**
  * This method is used to connect to the current config database
  *
  * @return $this
  */
 public function connect()
 {
     $dsn = 'mysql:host=' . Config::read('db.host') . ';dbname=' . Config::read('db.name') . ';connect_timeout=15';
     //We use the @ symbol to suppress "mysql server has gone away" errors
     $this->dbh = @new PDO($dsn, Config::read('db.user'), Config::read('db.password'), [PDO::ATTR_PERSISTENT => true]);
     $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     //PDO::ERRMODE_SILENT
     $this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
     $this->query = new QueryHandler();
     return $this;
 }
Example #2
0
 public function setUp()
 {
     self::$db_table_name = "MySQL_User";
     $object = self::$db_table_name;
     Config::write('db.host', 'localhost');
     Config::write('db.name', 'logos_unit');
     Config::write('db.user', 'travis');
     Config::write('db.password', '');
     $this->user = new $object();
     $this->TableCount = $this->getConnection()->getRowCount(self::$db_table_name);
 }
Example #3
0
 public function __construct()
 {
     $dsn = new MongoClient();
     $this->dbh = $dsn->{Config::read('db.name')};
 }