- WIP on first 'doc' and also minimal support for enums where added

This commit is contained in:
mcndave committed 2023-01-13 21:27:56 -05:00
1 parent 497fe5547b
commit d600908f47
22 files changed
+367 -35

No files matched your search

+7 -2
View File
@@ -87,7 +87,7 @@ class SQLite implements AdapterInterface {
return substr($base, 0, strrpos($base, '.') ?: strlen($base));
}
public function schemaTable(string $databaseName, string $tableName) /* : ? object */
public function schemaTable(string $databaseName, string $tableName) : null|object
{
return Table::repository()->loadOneFromField(Table::field('tableName'), $tableName);
}
@@ -131,9 +131,12 @@ class SQLite implements AdapterInterface {
return $typeOnly ? $type : $type . ( $length ? "($length" . ( isset($precision) ? ",$precision" : "" ) . ")" : "" );
}
public function writableValue(/* mixed */ $value) /*: mixed*/
public function writableValue(mixed $value) /*: mixed*/
{
switch (true) {
case $value instanceof \UnitEnum:
return Ulmus::convertEnum($value);
case is_object($value):
return Ulmus::convertObject($value);
@@ -168,6 +171,8 @@ class SQLite implements AdapterInterface {
public function exportFunctions(PdoObject $pdo) : void
{
$pdo->sqliteCreateFunction('if', fn($comparison, $yes, $no) => $comparison ? $yes : $no, 3);
$pdo->sqliteCreateFunction('length', fn($string) => strlen($string), 1);
$pdo->sqliteCreateFunction('lcase', fn($string) => strtolower($string), 1);
$pdo->sqliteCreateFunction('ucase', fn($string) => strtoupper($string), 1);
$pdo->sqliteCreateFunction('left', fn($string, $length) => substr($string, 0, $length), 2);