Futilities/v0.6/clade/Sys/dba/InReq: Difference between revisions

From Woozle Writes Code
< Futilities‎ | v0.6‎ | clade‎ | Sys‎ | dba
Jump to navigation Jump to search
No edit summary
No edit summary
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{page/clade}}
{{page/clade/v2
{| style="border: 1px solid black; float: left;"
|fam=
|-
{{!}} align=right {{!}}
| align=right |
[WFe]{{l/ver/clade|p=Ferreteria|Sys\Data\Engine\aux\is|RqActor}} [t]<br>
{{l/ver/clade|Sys\dba\InReq\infmts|DbStuff}}<br>
(base){{l/ver/clade/base|InReq}}
{{l/ver/clade|Sys\Events\InputRq|Settable}}
{{!}} align=center {{!}} &rArr; {{l/ver/clade|Sys\dba|InReq}} &rArr;
| &rarr; '''InReq'''
{{!}}
|
&rarr; {{l/ver/clade|Sys\dba\InReq|DoExport}}<br>
&rarr; {{l/ver/clade|Sys\Events\InputRq|DoExport}}<br>
&rarr; {{l/ver/clade|Sys\dba\InReq|DoImport}}<br>
&rarr; {{l/ver/clade|Sys\Events\InputRq|DoImport}}<br>
&rarr; {{l/ver/clade|Sys\dba\InReq|DoList}}<br>
&rarr; {{l/ver/clade|Sys\Events\InputRq|DoList}}<br>
&rarr; {{l/ver/clade|Sys\dba\InReq|DoSetup}}<br>
&rarr; {{l/ver/clade|Sys\Events\InputRq|DoSetup}}<br>
&rarr; {{l/ver/clade|Sys\dba\InReq|DoTest}}<br>
&rarr; {{l/ver/clade|Sys\Events\InputRq|DoImport}}<br>
&rarr; {{l/ver/clade|Sys\dba\InReq|SetFile}}<br>
&rarr; {{l/ver/clade|Sys\Events\InputRq|DoTest}}<br>
&rarr; {{l/ver/clade|Sys\dba\InReq|SetFolder}}<br>
&rarr; {{l/ver/clade|Sys\Events\InputRq|SetFile}}<br>
&rarr; {{l/ver/clade|Sys\dba\InReq|Value}}
&rarr; {{l/ver/clade|Sys\Events\InputRq|SetFolder}}<br>
 
&rarr; {{l/ver/clade|Sys\Events\InputRq|Value}}
|alia=
|}
{{!-!}} '''Array'''*    [i] {{!!}} [WFe]{{l/ver/clade/full|p=ferreteria|Sys\Data\Things|Array}}
==Purpose==
{{!-!}} '''Base'''*    [c,i] {{!!}} {{l/ver/clade/full||InReq}}
Each object encapsulates a given input (request) term (its name, type, and value(s) if any).
{{!-!}} '''DbStuff'''* [i,t] {{!!}} {{l/ver/clade/full|Sys\dba\InReq\infmts|DbStuff}}
{{!-!}} '''FilePaths'''* [c] {{!!}} [WFe]{{l/ver/clade/full|p=ferreteria|Sys\Data\tplts\FileName|Config}}
{{!-!}} '''Kiosk'''*    [e] {{!!}} {{l/ver/clade/full|Sys\dba|Kiosk}}
{{!-!}} '''InData'''*    [t] {{!!}} {{l/ver/clade/full|Sys\dba|InRqData}}
{{!-!}} '''QObj'''*    [c,i] {{!!}} [WFe]{{l/ver/clade/full|p=ferreteria|Data\Mem\QVar|Obj}}
{{!-!}} '''QStr'''*      [i] {{!!}} [WFe]{{l/ver/clade/full|p=ferreteria|Data\Mem\QVar|Str}}
{{!-!}} '''Self'''*      [i] {{!!}} {{l/ver/clade/full|Sys\dba|InReq}}
 
}}
==About==
* '''Purpose''': base class for DBA Action-classes
 
Each object encapsulates a given input (request) term. Podling-clades will implement actions and provide functions to access needed values from the input, which is encapsulated by a <code>c{{l/ver/clade|Sys\dba|InRqData}}</code> object which can be retrieved from <code>function {{l/ver/fx|OAUserInput}}()</code>.
 
To make use of additional user arguments (after the first), <code>{{l/ver/clade|p=Ferreteria|Sys\Events|InputRq}}</code> podlings (aka <code>{{l/ver/clade/base|InReq}}</code> podlings) can implement <code>function {{l/ver/fx|ParseInputArgs}}(array $ar)</code>.
==Doing Stuff==
==Doing Stuff==
* To access input arguments, get an appropriate {{l/ver/clade|Sys\dba|InRqData|pfx=c}} object:
* To access input arguments, get an appropriate <code>c{{l/ver/clade|Sys\dba|InRqData}}</code> object:
** {{fmt/php/inline|$this->OAThisInput()}} returns the values for ''just the current request term'' (used in e.g. Describe())
** <code>$this->{{l/ver/fx|OAUserInput}}()</code> returns the raw input value strings (split but not parsed), one element for each term in the user input
** {{fmt/php/inline|static::OAKeptInput()}} returns the ''latest'' set values across all terms (used for doing actions)
==History==
* {{fmt/date|2024|10|30}} started
* {{fmt/date|2025|01|28}} renamed Actor -> InReq
* {{fmt/date|2025|02|02}} added SchemaTrait
* {{fmt/date|2025|09|21}} moved all the <code>New*Request()</code> functions to respective [WFe]<code>{{l/ver/clade/full|Sys\Data\reqs\Engine\ActionRq\Admin\dbase|EngDb}}</code>* traits
** ...or maybe in some cases [WFe]<code>{{l/ver/clade/full|Sys\Data\reqs\Engine\ActionRq\Admin\ToSchema|EngSc}}</code>*; still sorting this out as of {{fmt/date|2025|09|25}}.
* {{fmt/date|2025|09|25}} reparenting all <code>Do</code>* clades to their respective [WFe]<code>{{l/ver/clade/full|Sys\Data\reqs\Engine\ActionRq\Admin\ToSchema|EngSc}}</code>* clades
** ...and moving most of the code into a trait
 
==Code==
* [[/@removed/]]
* ''as of {{fmt/date|2025|10|25}}:''
{{fmt/php/block|1=
interface iInReq extends BaseIface, DbStuffIface {
    // OUTPUT
    function ListHosts() : string;
}
trait tInReq {
    use DbStuffTrait; // 2025-10-11 needed for QOFData()
    use InDataTrait;  // 2025-09-25 might create a conflict
 
    // ++ OBJECTS: requests ++ //
 
    protected function QOSchemaMeta() : QObjIface {
        // check to see if we *can* get a Schema object
        $of = FilePaths::Me()->ImportFoNode();
        $oStat = $of->IndexIt();
        echo $oStat->RenderMessages();  // any messages, error or otherwise
        if ($oStat->GetOkay()) {
            $sScSlug = $this->QSSchema()->GetIt();
            $osSchNode = $of->FindSchema($sScSlug); // TODO: possibly this should go in aux\has\tSchema
        } else {
            $osSchNode = QObjClass::AsNew();
        }
        return $osSchNode;
    }
 
    // -- OBJECTS -- //
    // ++ INPUTS: processing ++ //
 
    // CEMENT
    protected function ParseInputArgs(array $ar) {
        $nXArgs = count($ar);
        if ($nXArgs > 0) {
            $this->AmHere('TODO 2025-10-04: interpret optional additional arguments');
        }
    }
 
    protected function SaveAsEngConnName(string $s) {
        $this->OAUserInput()->QDbConnSlug()->SetIt($s); // 2025-10-08 Does this work? (Fix it, if not.)
    }
 
    // ++ INPUTS: parsed/stored ++ //
 
    protected function QDbConnSlug() : QStrIface {
        return $this->OAUserInput()->QDbConnSlug();
    }
    protected function QSchemaSlug() : QStrIface {
        return $this->OAUserInput()->QSchemaSlug();
    }
 
    // -- INPUT -- //
}
}}

Latest revision as of 17:39, 20 November 2025

clade: Sys\dba\InReq
Clade Family

[WFe]RqActor [t]
(base)InReq

InReq

DoExport
DoImport
DoList
DoSetup
DoTest
SetFile
SetFolder
Value

Clade Aliases
Alias Clade
Array* [i] [WFe]Sys\Data\Things\Array
Base* [c,i] \InReq
DbStuff* [i,t] Sys\dba\InReq\infmts\DbStuff
FilePaths* [c] [WFe]Sys\Data\tplts\FileName\Config
Kiosk* [e] Sys\dba\Kiosk
InData* [t] Sys\dba\InRqData
QObj* [c,i] [WFe]Data\Mem\QVar\Obj
QStr* [i] [WFe]Data\Mem\QVar\Str
Self* [i] Sys\dba\InReq
Subpages

About

  • Purpose: base class for DBA Action-classes

Each object encapsulates a given input (request) term. Podling-clades will implement actions and provide functions to access needed values from the input, which is encapsulated by a cInRqData object which can be retrieved from function OAUserInput().

To make use of additional user arguments (after the first), InputRq podlings (aka InReq podlings) can implement function ParseInputArgs(array $ar).

Doing Stuff

  • To access input arguments, get an appropriate cInRqData object:
    • $this->OAUserInput() returns the raw input value strings (split but not parsed), one element for each term in the user input

History

  • 2024-10-30 started
  • 2025-01-28 renamed Actor -> InReq
  • 2025-02-02 added SchemaTrait
  • 2025-09-21 moved all the New*Request() functions to respective [WFe]Sys\Data\reqs\Engine\ActionRq\Admin\dbase\EngDb* traits
    • ...or maybe in some cases [WFe]Sys\Data\reqs\Engine\ActionRq\Admin\ToSchema\EngSc*; still sorting this out as of 2025-09-25.
  • 2025-09-25 reparenting all Do* clades to their respective [WFe]Sys\Data\reqs\Engine\ActionRq\Admin\ToSchema\EngSc* clades
    • ...and moving most of the code into a trait

Code

interface iInReq extends BaseIface, DbStuffIface {
    // OUTPUT
    function ListHosts() : string;
}
trait tInReq {
    use DbStuffTrait; // 2025-10-11 needed for QOFData()
    use InDataTrait;  // 2025-09-25 might create a conflict

    // ++ OBJECTS: requests ++ //

    protected function QOSchemaMeta() : QObjIface {
        // check to see if we *can* get a Schema object
        $of = FilePaths::Me()->ImportFoNode();
        $oStat = $of->IndexIt();
        echo $oStat->RenderMessages();  // any messages, error or otherwise
        if ($oStat->GetOkay()) {
            $sScSlug = $this->QSSchema()->GetIt();
            $osSchNode = $of->FindSchema($sScSlug); // TODO: possibly this should go in aux\has\tSchema
        } else {
            $osSchNode = QObjClass::AsNew();
        }
        return $osSchNode;
    }

    // -- OBJECTS -- //
    // ++ INPUTS: processing ++ //

    // CEMENT
    protected function ParseInputArgs(array $ar) {
        $nXArgs = count($ar);
        if ($nXArgs > 0) {
            $this->AmHere('TODO 2025-10-04: interpret optional additional arguments');
        }
    }

    protected function SaveAsEngConnName(string $s) {
        $this->OAUserInput()->QDbConnSlug()->SetIt($s); // 2025-10-08 Does this work? (Fix it, if not.)
    }

    // ++ INPUTS: parsed/stored ++ //

    protected function QDbConnSlug() : QStrIface {
        return $this->OAUserInput()->QDbConnSlug();
    }
    protected function QSchemaSlug() : QStrIface {
        return $this->OAUserInput()->QSchemaSlug();
    }

    // -- INPUT -- //
}