Futilities/v0.6/clade/Sys/dba/InRqData: Difference between revisions
< Futilities | v0.6 | clade | Sys | dba
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
| Line 17: | Line 17: | ||
* PURPOSE: input-request data manager for DBA | * PURPOSE: input-request data manager for DBA | ||
This | This clade encapsulates the user input handled by The [[Futilities]] [[Futilities/dba|DBA command]], adding access-functions for DBA-specific command-inputs. | ||
Note: It provides the interface to the data ''storage'', not the interface to input data ''parsing''. | |||
Access-functions generally act on named entries in the base c{{l/ver/clade|p=Ferreteria|Sys\Events\InputRq\aux|InRqData}} object, using names supplied by DBA's KioskEnum (e{{l/ver/clade|Sys\dba|Kiosk}}). | Access-functions generally act on named entries in the base c{{l/ver/clade|p=Ferreteria|Sys\Events\InputRq\aux|InRqData}} object, using names supplied by DBA's KioskEnum (e{{l/ver/clade|Sys\dba|Kiosk}}). | ||
==History== | |||
* '''{{fmt/date|2025|01|23}}''' (InReq/data/in/Dbase.php) created | |||
==Code== | ==Code== | ||
===Sources=== | |||
* '''docs''': [https://gitlab.com/woozalia/ferreteria/-/blob/v0.6-dev/apps/futils/src/Sys/dba/InRqData.md v0.6-dev] | |||
===Functions=== | ===Functions=== | ||
* // DATA | * // DATA | ||
| Line 39: | Line 38: | ||
===Source=== | ===Source=== | ||
* '''repo''': [https://gitlab.com/woozalia/ferreteria/-/blob/v0.6-dev/apps/futils/src/Sys/dba/InRqData.php v0.6-dev] | |||
''as of 2025-10-23'' | ''as of 2025-10-23'' | ||
{{fmt/php/block|1= | {{fmt/php/block|1= | ||
Revision as of 14:58, 24 October 2025
| ||||||||||||||||||||||||
About
- PURPOSE: input-request data manager for DBA
This clade encapsulates the user input handled by The Futilities DBA command, adding access-functions for DBA-specific command-inputs.
Note: It provides the interface to the data storage, not the interface to input data parsing.
Access-functions generally act on named entries in the base cInRqData object, using names supplied by DBA's KioskEnum (eKiosk).
History
Code
Sources
- docs: v0.6-dev
Functions
- // DATA
function QDbConnSlug() : QStrIface;function QSchemaSlug() : QStrIface;function OkToReplace() : bool;
- // OBJECTS
Source
- repo: v0.6-dev
as of 2025-10-23
trait tInRqData { // for users of this format
// ++ CONFIG ++ //
// UNPROMPT for dba command (do not override in podlings)
static protected function InputClass() : string { return cInRqData::class; }
// -- CONFIG -- //
}
interface iInRqData extends BaseIface {
// DATA
function QDbConnSlug() : QStrIface;
function QSchemaSlug() : QStrIface;
function OkToReplace() : bool;
// OBJECTS
function QODbConn() : QObjIface;
function QOSchema() : QObjIface;
}
class cInRqData extends BaseClass implements iInRqData {
// ++ DATA ++ //
public function QDbConnSlug() : QStrIface { return $this->FetchItQ(KioskEnum::VAL_CONN->value); }
public function QSchemaSlug() : QStrIface { return $this->FetchItQ(KioskEnum::VAL_SCHEMA->value); }
public function OkToReplace() : bool {
#$sName = 'xf.replace';
$sName = KioskEnum::VAL_REPLACE->value;
$obVal = $this->FetchItQ($sName);
$bVal = $obVal->HasIt() ? $obVal->GetIt() : FALSE;
return $bVal;
}
// -- DATA -- //
// ++ OBJECTS ++ //
private $oqDbConn=NULL;
public function QODbConn() : QObjIface {
$oo = $this->oqDbConn;
if (is_object($oo)) {
$bDoGet = !$oo->HasIt();
} else {
$qo = QObjClass::AsNew();
$bDoGet = TRUE;
$this->oqDbConn = $oo;
}
if ($bDoGet) {
echo $this->ReflectThis()->Report();
$qo->SetIt($this->ODbConn());
}
return $qo;
}
/*
protected function NewDbConn() : DbConnIface {
// TODO
}
*/
private $oqSchema=NULL;
public function QOSchema() : QObjIface {
$oo = $this->oqSchema;
if (is_object($oo)) {
$bDoGet = !$oo->HasIt();
} else {
$oo = QObjClass::AsNew();
$bDoGet = TRUE;
$this->oqSchema = $oo;
}
#$this->AmHere("bDoGet=[$bDoGet]");
if ($bDoGet) {
$os = $this->QSchemaSlug(); // Schema name-slug
#$this->AmHere();
if ($os->HasIt()) {
$this->AmHere();
$sSch = $os->GetIt();
$oqDbConn = $this->QODbConn();
if ($oqDbConn->HasIt()) {
$oDbConn = $oqDbConn->GetIt();
$oSch = $oDbConn->GetSchema($sSch);
$oo->SetIt($oSch);
}
} else {
echo 'INPUT: '.$this->Inspect()->Render().CRLF;
}
}
return $oo;
}
// -- OBJECTS -- //
// ++ OUTPUT ++ //
// OVERRIDE
public function Debug_Render() : string {
$ar = $this->GetVals();
$nAr = count($ar);
if ($nAr > 0) {
if ($nAr > 1) {
$sOut = $nAr.' input elements:'.CRLF;
} else {
$sOut = 'One input element: ';
}
foreach ($ar as $sKey => $sVal) {
$sOut .= "[$sKey] => [$sVal]".CRLF;
}
} else {
$sOut = 'No elements in input array.'.CRLF;
}
return $sOut;
}
// -- OUTPUT -- //
}
Removed
2025-10-08
Commented out at the end of July:
// 2025-07-29 added but probably don't need
use Woozalia\Ferret\Sys\Data\Engine\{
iConn as OperIface,
caOps as OperAdmin,
iOps as OperIface,
};
2025-03-10
Added code yesterday to see if this code is still in use, and it was not triggered:
// ++ SETUP: pieces ++ //
// CEMENT
protected function UseContent(string $s) : void {
self::GotToHere('2025-03-08 Is this still being called?'); die();
#$arPcs = explode('/',$s); // 2025-01-22 This is a bit of a kluge
$this->QRaw()->SetIt($s);
$arPcs = $this->ValueArray();
$nPcs = count($arPcs);
switch($nPcs) {
case 0:
echo 'Indicate what and where to import like this: "write:{db name}/{schema name}".'.CRLF;
break;
case 1:
$sDB = $arPcs[0];
echo 'Indicate which file to import like this: "write:'.$sDB.'/{schema name}".'.CRLF;
$this->QDbConnSlug()->SetIt($sDB);
break;
default: // 2 or more
[$sDbase,$sSchema] = $arPcs;
$this->QDbConnSlug()->SetIt($sDbase);
$this->QSchemaName()->SetIt($sSchema);
break;
}
}
// -- SETUP -- //
Commented out days/weeks ago, not sure why except that it seemed to be unused (and looking at it now, it's probably the wrong way to do it anyway):
// ++ ACCESS: kept ++ //
static private $osSch = NULL;
public function KeptQSchema() : QObjIface { return self::$osSch ?? (self::$osSch = $this->NewQSchema()); }
protected function NewQSchema() : QObjIface { return QObjClass::FromNone(); }
// ++ ACCESS: best ++ //
public function QSchemaName() : QStrIface {
$os = $this->GetItQ('xf.schema');
if (!$os->HasIt()) {
$os = $this->Latest()->GetItQ('xf.schema');
}
return $os;
}