示例#1
0
 private function __construct()
 {
     try {
         self::$db = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASSWORD);
         //            self::$db = new PDO('mysql:host=localhost;dbname=FMC', 'root', '');
         self::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $e) {
         echo 'blad polaczenia z baza danych';
     }
 }
function migrateJomSocialStreamNameSpace()
{
    jimport('joomla.filesystem.file');
    jimport('joomla.filesystem.folder');
    $jsCoreFile = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'community.php';
    if (JFile::exists($jsCoreFile)) {
        $db = DBHelper::db();
        $query = 'UPDATE `#__community_activities` SET `app` = ' . $db->Quote('easyblog') . ' WHERE `app` = ' . $db->Quote('com_easyblog');
        $db->setQuery($query);
        $db->query();
    }
}
示例#3
0
 static function init_test_db()
 {
     @unlink('test.db');
     self::$db = new SQLite3('test.db');
     self::initTables();
     // Invitations
     $password = md5('Pipiroot667');
     self::$db->exec("INSERT INTO `users` (user_id, user_name, user_password) VALUES (1, 'Admin','{$password}');");
     self::$db->exec("INSERT INTO `invitations` (user_id, invitation) VALUES (1, 'VVK');");
 }