ikkez/f3-schema-builder

Need to add postgres schema support to getTable

joseffb-mla opened this issue · 0 comments

Can't add custom schema for postgress check. Currently only checks the public schema.

something like the following should work (not tested).

		$cmd=[
			'mysql'=>[
				"show tables"],
			'sqlite2?'=>[
				"SELECT name FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence'"],
			'pgsql|sybase|dblib'=>[
				"select table_name from information_schema.tables where table_schema = ?",$db_schema ],
			'mssql|sqlsrv|odbc'=>[
				"select table_name from information_schema.tables"],
			'ibm'=>["select TABLE_NAME from sysibm.tables"],
		];
		$query=$this->findQuery($cmd);
		if (!$query[0]) return FALSE;
		$tables=$this->db->exec($query[0], !this->devoid($query[1])?$query[1],null);
		if ($tables && is_array($tables) && count($tables)>0)
			foreach ($tables as &$table)
				$table=array_shift($table);
		return $tables;
	}```