Create PostgreSQL Metadata DAO instance

@return PostgreSQLMetaDataDAO
322809
public static function getInstance(DriverConfig $config)
    {
        $pdoDriver = PdoDriverFactory::getInstance();

        return new PostgreSQLMetaDataDAO(
            $pdoDriver->getConnection($config),
            $config,
            new SqlManager()
        );
    }
890133
public function schemaCompiler(): Schema\Compiler
    {
        if ($this->schemaCompiler === null) {
            switch ($this->getDriver()) {
                case 'mysql':
                    $this->schemaCompiler = new Schema\Compiler\MySQL($this);
                    break;
                case 'pgsql':
                    $this->schemaCompiler = new Schema\Compiler\PostgreSQL($this);
                    break;
                case 'dblib':
                case 'mssql':
                case 'sqlsrv':
                case 'sybase':
                    $this->schemaCompiler = new Schema\Compiler\SQLServer($this);
                    break;
                case 'sqlite':
                    $this->schemaCompiler = new Schema\Compiler\SQLite($this);
                    break;
                case 'oci':
                case 'oracle':
                    $this->schemaCompiler = new Schema\Compiler\Oracle($this);
                    break;
                default:
                    throw new \Exception('Schema not supported yet');
            }

            $this->schemaCompiler->setOptions($this->schemaCompilerOptions);
        }

        return $this->schemaCompiler;
    }
225388
public static function createDatabase()
  {
      $ddl = file_get_contents('verbs.sql');
      if (file_exists('verbs.db')) {
          unlink('verbs.db');
      }
      $connection = new PDO('sqlite:verbs.db');
      $connection->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
      $connection->exec($ddl);

      $entries = simplexml_load_file('JMdict');
      if ($entries === false) {
        echo 'Could not open JMdict file' . PHP_EOL;
      }

      $connection->beginTransaction();
      $sql = 'INSERT INTO verbs (kanji, kana, type) VALUES (:kanji, :kana, :type)';
      $statement = $connection->prepare($sql);

      foreach ($entries as $entry) {
        $poses = [];
        foreach ($entry->xpath('sense/pos') as $pos) {
          $poses[] = array_keys(get_object_vars($pos))[0];
        }

        foreach ($poses as $pos) {
          if (stripos($pos, 'v1') !== false || stripos($pos, 'v5') !== false || $pos == 'vz' || $pos == 'vk' || $pos == 'vn' || $pos == 'vr' || $pos == 'vs-s' || $pos == 'vs-i') {
            $kanji = $entry->k_ele->keb;
            $kana = $entry->r_ele->reb;
            $saved = $statement->execute(array(':kanji' => $kanji, ':kana' => $kana, ':type' => $pos));
            if ($saved === false) {
              die('Could not save entry : ' . implode(' ', $statement->errorInfo()));
            }
          }
        }
      }
      $connection->commit();
  }
679645
public function createCrud()
    {
        $fieldTypes        = FieldsDescriber::types();
        $fieldValidation   = FieldsDescriber::validation();
        $defaultValuesCbox = FieldsDescriber::default_cbox();
        $menusSelect       = Menu::whereNotIn('menu_type', [2, 3])->pluck('title', 'id');
        $roles             = Role::all();
        $parentsSelect     = Menu::where('menu_type', 2)->pluck('title', 'id')->prepend('-- no parent --', '');
        // Get columns for relationship
        $models = [];
        foreach (Menu::whereNotIn('menu_type', [2, 3])->get() as $menu) {
            // We are having a default User model
            if ($menu->title == 'User' && $menu->is_menu == 0) {
                $tableName = 'users';
            } else {
                $tableName = strtolower($menu->name);
            }
            $models[$menu->id] = Schema::getColumnListing($tableName);
        }

        return view("qa::menus.createCrud",
            compact('fieldTypes', 'fieldValidation', 'defaultValuesCbox', 'menusSelect', 'models', 'parentsSelect',
                'roles'));
    }
371456
public function createInstance()
    {
        switch ($this->method) {
            case 'addBigIntegerColumn':
            case 'addBinaryColumn':
            case 'addBooleanColumn':
            case 'addDateColumn':
            case 'addDateTimeColumn':
            case 'addDecimalColumn':
            case 'addFloatColumn':
            case 'addIntegerColumn':
            case 'addSmallIntegerColumn':
            case 'addStringColumn':
            case 'addTextColumn':
            case 'addTimeColumn':
                $namespace = 'Rentgen\\Database\\Column\\';
                $class = $namespace . ltrim($this->method, 'add');
                $options = isset($this->params[1]) ? $this->params[1] : array();

                if ('addStringColumn' === $this->method && !isset($options['limit'])) {
                    $options['limit'] = 255;
                }
                $column = new $class($this->params[0], $options);
                break;
            case 'addCustomColumn':
                $options = isset($this->params[2]) ? $this->params[2] : [];
                $column = new CustomColumn($this->params[0], $this->params[1], $options);
                break;
            default:
                throw new \Exception(sprintf("Unsupported method " . $this->method));
        }

        if (isset($options['comment'])) {
            $column->setDescription($options['comment']);
        }

        return $column;
    }
1104598
protected function createSchema()
    {
        $schema = new ModelSchema("tblMenuItem");

        $schema->addColumn(
            new AutoIncrementColumn("MenuItemID"),
            new ForeignKeyColumn("ParentMenuItemID", 0),
            new ForeignKeyColumn('MenuID', 0),
            new StringColumn("MenuName", 50),
            new StringColumn("Url", 200),
            new StringColumn("SecurityOption", 200),
            new StringColumn("ParentMenuItemIDs", 200),
            new StringColumn("CssClassName", 40),
            new IntegerColumn("Position", 0)
        );

        return $schema;
    }
441502
private MetadataReferenceDao getMetadataReferenceDao() throws SQLException {
		if (metadataReferenceDao == null) {
			metadataReferenceDao = DaoManager.createDao(connectionSource,
					MetadataReference.class);
		}
		return metadataReferenceDao;
	}
1181551
public function buildSql()
    {
        $sqlDbMapContent = "# Sqlfile -> Database map\n";
        foreach ($this->getDatabases() as $datasource => $database) {
            $platform = $database->getPlatform();
            $filename = $database->getName() . '.sql';

            $ddl = $platform->getAddTablesDDL($database);

            $file = $this->getWorkingDirectory() . DIRECTORY_SEPARATOR . $filename;
            // Check if the file changed
            if (!file_exists($file) || $ddl !== file_get_contents($file)) {
                file_put_contents($file, $ddl);
            }

            $sqlDbMapContent .= sprintf("%s=%s\n", $filename, $datasource);
        }

        if ($this->isOverwriteSqlMap() || !$this->existSqlMap()) {
            file_put_contents($this->getSqlDbMapFilename(), $sqlDbMapContent);
        }
    }
771522
public function createMetaEntityFactory(): MetaEntityFactory {
		if (!isset($this->metaEntityFactory)) {
			$this->metaEntityFactory = new PgsqlMetaEntityFactory($this);
		}
		
		return $this->metaEntityFactory;
	}
998729
public function createQueryBuilder()
	{
		$q = $this->flupdo->select();
		$this->queryAddFrom($q);
		$this->queryAddAccessPolicyCondition($this->read_access_policy, $q);
		return $q;
	}
172520
public function getAllMetadata()
    {
        $sth = $this->pdo->prepare('show tables');

        $sth->execute();

        return $this->pdoMetadataToGeneratorMetadata(
            $sth->fetchAll(
                PDO::FETCH_COLUMN,
                0
            )
        );
    }
1164412
public function buildSql()
    {
        $sqlDbMapContent = "# Sqlfile -> Database map\n";
        foreach ($this->getDatabases() as $datasource => $database) {
            $platform = $database->getPlatform();
            $filename = $database->getName() . '.sql';

            if ($this->getGeneratorConfig()->getBuildProperty('disableIdentifierQuoting')) {
                $platform->setIdentifierQuoting(false);
            }

            $ddl = $platform->getAddTablesDDL($database);

            $file = $this->getWorkingDirectory() . DIRECTORY_SEPARATOR . $filename;
            if (file_exists($file) && $ddl == file_get_contents($file)) {
                // Unchanged
            } else {
                file_put_contents($file, $ddl);
            }

            $sqlDbMapContent .= sprintf("%s=%s\n", $filename, $datasource);
        }

        file_put_contents($this->getSqlDbMapFilename(), $sqlDbMapContent);
    }
155639
public int create() throws SQLException {
		checkForDao();
		@SuppressWarnings("unchecked")
		T t = (T) this;
		return dao.create(t);
	}
868533
public function createTable()
    {
        $sql = $this->getSql();

        $createTable = new CreateTable($this->getTableName());
        $tableStructure = $this->getTableStructure();

        foreach($tableStructure['columns'] as $column) {
            $createTable->addColumn($column);
        }

        foreach($tableStructure['constraints'] as $constraint) {
            $createTable->addConstraint($constraint);
        }

        $sql->getAdapter()->query(
            $sql->getSqlStringForSqlObject($createTable),
            Adapter::QUERY_MODE_EXECUTE
        );

        return $this;
    }
486599
protected function createSchema()
    {
        $schema = new ModelSchema("tblAuthenticationUser");

        $schema->addColumn(
            new AutoIncrementColumn("UserID"),
            new StringColumn("Username", 30, null),
            new StringColumn("Password", 200),
            new StringColumn("Forename", 80),
            new StringColumn("Surname", 80),
            new StringColumn("Email", 150),
            new StringColumn("Token", 200),
            new DateTimeColumn("TokenExpiry"),
            new BooleanColumn("Enabled", false),
            new StringColumn("PasswordResetHash", 200),
            new DateTimeColumn("PasswordResetDate"),
            new DateTimeColumn("LastPasswordChangeDate")
        );

        $schema->labelColumnName = "FullName";

        return $schema;
    }
1321296
public function createMetaEntityFactory(): MetaEntityFactory {
		if (!(isset($this->metaEntityFactory))) {
			$this->metaEntityFactory = new OracleMetaEntityFactory($this);
		}
		return $this->metaEntityFactory;
	}
359971
public function getSchemaManager(){
        if($this->schemamanger == null){
            $this->schemamanger = new common_persistence_sql_pdo_pgsql_SchemaManager($this);
        }
        return $this->schemamanger;
    }