Add qualifier functions; bump to PHP 8.5

This commit is contained in:
2026-01-24 14:58:02 -05:00
parent 8ff7a36752
commit 33038c2f41
8 changed files with 728 additions and 595 deletions

View File

@@ -57,8 +57,9 @@ class Configuration
if (empty($dsn)) {
self::$mode = self::$pdoDSN = Option::None();
} else {
self::$mode = Option::Some(Mode::deriveFromDSN($dsn));
self::$pdoDSN = Option::Some($dsn);
self::$mode = Mode::deriveFromDSN($dsn)
|> Option::Some(...);
}
}

View File

@@ -35,6 +35,7 @@ class Field
*
* @param array<string, mixed> $existing The existing parameters
* @return array<string, mixed> The given parameter array with this field's name and value(s) appended
* @throws Exception If the database mode has not been set
*/
public function appendParameter(array $existing): array
{
@@ -121,6 +122,33 @@ class Field
: $fieldPath . ' ' . $this->op->toSQL() . $criteria;
}
/**
* Set a qualifier for the field, returning the modified field
*
* @param string $qualifier The table qualifier to use for the field
* @return Field The field instance with the qualifier set
*/
public function andQualifier(string $qualifier): Field
{
$this->qualifier = $qualifier;
return $this;
}
/**
* Create a new `Field` instance based on the given field, using the qualifier provided
*
* @param string $qualifier The table qualifier to use for the field
* @return callable<Field, Field> A new `Field` instance with the qualifier set
*/
public static function withQualifier(string $qualifier): callable
{
return function (Field $field) use ($qualifier) {
return clone($field, [
"qualifier" => $qualifier
]);
};
}
/**
* Create parameter names for an IN clause
*