Compare commits

..

No commits in common. "a44da62b94f9c1e3eb49a0eaf4676fd05540dbf0" and "d704ce8c079562a9b31e08bd554d8a2502d179c2" have entirely different histories.

3 changed files with 3 additions and 29 deletions

View File

@ -45,19 +45,10 @@ abstract class CapacitorStorage {
const GENLIC_DEFINITION = "varchar(80)";
const GENLIB_DEFINITION = "varchar(255)";
const GENTEXT_DEFINITION = "mediumtext";
const GENBOOL_DEFINITION = "integer(1)";
const GENUUID_DEFINITION = "varchar(36)";
protected static function gencol($def): string {
if (!is_string($def)) $def = strval($def);
$def = trim($def);
$parts = preg_split('/\s+/', $def, 2);
if (count($parts) == 2) {
$def = $parts[0];
$rest = " $parts[1]";
} else {
$rest = null;
}
switch ($def) {
case "serdata": $def = static::SERDATA_DEFINITION; break;
case "sersum": $def = static::SERSUM_DEFINITION; break;
@ -66,10 +57,9 @@ abstract class CapacitorStorage {
case "genlic": $def = static::GENLIC_DEFINITION; break;
case "genlib": $def = static::GENLIB_DEFINITION; break;
case "gentext": $def = static::GENTEXT_DEFINITION; break;
case "genbool": $def = static::GENBOOL_DEFINITION; break;
case "genuuid": $def = static::GENUUID_DEFINITION; break;
}
return "$def$rest";
return $def;
}
const COLUMN_DEFINITIONS = [
@ -375,9 +365,8 @@ abstract class CapacitorStorage {
$values = func::call([$channel, "getItemValues"], $item, ...$args);
if ($values === [false]) return 0;
if (array_key_exists("item", $values)) {
$item = A::pop($values, "item");
}
$newItem = A::pop($values, "item");
if ($newItem !== null) $item = $newItem;
$row = cl::merge(
$channel->getSum("item", $item),

View File

@ -11,7 +11,6 @@ class PgsqlStorage extends CapacitorStorage {
const SERTS_DEFINITION = "timestamp";
const GENSERIAL_DEFINITION = "serial primary key";
const GENTEXT_DEFINITION = "text";
const GENBOOL_DEFINITION = "boolean";
const GENUUID_DEFINITION = "uuid";
function __construct($pgsql) {

View File

@ -117,18 +117,4 @@ class file {
}
return $file;
}
static function string_reader(string $content, ?callable $func=null): MemoryStream {
$file = new MemoryStream();
$file->fwrite($content);
$file->rewind();
if ($func !== null) {
try {
$func($file);
} finally {
$file ->close();
}
}
return $file;
}
}