コード例 #1
0
ファイル: Db.php プロジェクト: Killerfun/galette
 /**
  * Test constructor
  *
  * @return void
  */
 public function testConstructor()
 {
     $db = new \Galette\Core\Db();
     $type = $db->type_db;
     $this->string($type)->isIdenticalTo(TYPE_DB);
     $dsn = array('TYPE_DB' => TYPE_DB, 'USER_DB' => USER_DB, 'PWD_DB' => PWD_DB, 'HOST_DB' => HOST_DB, 'PORT_DB' => PORT_DB, 'NAME_DB' => NAME_DB);
     $db = new \Galette\Core\Db($dsn);
     $is_pg = $db->isPostgres();
     $type = $db->type_db;
     switch (TYPE_DB) {
         case 'pgsql':
             $this->boolean($is_pg)->isTrue();
             $this->string($type)->isIdenticalTo(\Galette\Core\Db::PGSQL);
             break;
         case \Galette\Core\Db::MYSQL:
             $this->boolean($is_pg)->isFalse();
             $this->string($type)->isIdenticalTo(\Galette\Core\Db::MYSQL);
             break;
     }
     $this->exception(function () use($dsn) {
         $dsn['TYPE_DB'] = 'DOES_NOT_EXISTS';
         $db = new \Galette\Core\Db($dsn);
     });
 }
コード例 #2
0
ファイル: old.index.php プロジェクト: Killerfun/galette
     }
     if (empty($_POST['install_dbname'])) {
         $error_detected .= '<li>' . _T("No database name") . '</li>';
     }
 }
 if ($error_detected == '') {
     if (isset($_POST['install_dbconn_ok'])) {
         $dsn['TYPE_DB'] = $_POST['install_dbtype'];
         if ($dsn['TYPE_DB'] != 'sqlite') {
             $dsn['USER_DB'] = $_POST['install_dbuser'];
             $dsn['PWD_DB'] = $_POST['install_dbpass'];
             $dsn['HOST_DB'] = $_POST['install_dbhost'];
             $dsn['PORT_DB'] = $_POST['install_dbport'];
             $dsn['NAME_DB'] = $_POST['install_dbname'];
         }
         $zdb = new Galette\Core\Db($dsn);
         if ($_POST['install_type'] == 'install') {
             $step = 'i6';
         } elseif (substr($_POST['install_type'], 0, 7) == 'upgrade') {
             $step = 'u6';
         }
         if (isset($_POST['install_dbperms_ok'])) {
             if ($_POST['install_type'] == 'install') {
                 $step = 'i7';
             } elseif (substr($_POST['install_type'], 0, 7) == 'upgrade') {
                 $step = 'u7';
             }
         }
         if (isset($_POST["install_dbwrite_ok"])) {
             if ($_POST['install_type'] == 'install') {
                 $step = 'i8';