feat: implement dynamic database connection service with MySQL driver and API schema endpoints

This commit is contained in:
Ümit Tunç
2026-04-24 07:21:59 +03:00
parent 1a75c32469
commit ce67df1067
12 changed files with 417 additions and 78 deletions
@@ -64,6 +64,11 @@ class MySqlDriver implements DatabaseDriverInterface, SchemaDiscoveryInterface
return $this->query("DESCRIBE `{$table}`");
}
public function getTableData(string $table, int $limit = 100, int $offset = 0): array
{
return $this->query("SELECT * FROM `{$table}` LIMIT ? OFFSET ?", [$limit, $offset]);
}
public function getForeignKeys(string $table): array
{
$sql = "
+8
View File
@@ -74,4 +74,12 @@ class DatabaseService
}
throw new \Exception("Driver does not support schema discovery.");
}
/**
* Get table data.
*/
public function getTableData(string $table, int $limit = 100, int $offset = 0): array
{
return $this->getDriver()->getTableData($table, $limit, $offset);
}
}