database api start

This commit is contained in:
2023-01-09 20:27:01 +01:00
parent a8af7fa700
commit f14a7a4762
9 changed files with 174 additions and 31 deletions

View File

@@ -14,8 +14,11 @@ use Core\Driver\SQL\Column\DateTimeColumn;
use Core\Driver\SQL\Column\BoolColumn;
use Core\Driver\SQL\Column\JsonColumn;
use Core\Driver\SQL\Condition\Compare;
use Core\Driver\SQL\Condition\CondLike;
use Core\Driver\SQL\Condition\CondRegex;
use Core\Driver\SQL\Expression\Add;
use Core\Driver\SQL\Expression\Count;
use Core\Driver\SQL\Expression\CurrentTimeStamp;
use Core\Driver\SQL\Expression\Expression;
use Core\Driver\SQL\Query\CreateProcedure;
@@ -444,6 +447,17 @@ class PostgreSQL extends SQL {
return $query;
}
public function tableExists(string $tableName): bool {
$tableSchema = $this->connectionData->getProperty("database");
$res = $this->select(new Count())
->from("pg_tables")
->whereEq("tablename", $tableName)
->whereEq("schemaname", $tableSchema)
->execute();
return $res && $res[0]["count"] > 0;
}
}
class RowIteratorPostgreSQL extends RowIterator {