Ferreteria/v0.6/clade/Sys/Data/Engine/endpt/Client

From Woozle Writes Code
Jump to navigation Jump to search
clade: Sys\Data\Engine\endpt\Client
Clade Family
Client MyMar
Clade Aliases
Alias Clade
Action* [i] Sys\Events\ItWent
AdminReq* [i] Sys\Data\Engine\aux\ActionRq\AdminRq
Base* [c,i] IO\Aspect
BkupMode* [e] Sys\Data\Engine\aux\ActionRq\Admin\aux\FileFormat
DataReq* [i] Sys\Data\Engine\aux\CommRq
HasRost* [i,t] Config\Roster\for\AClass
Schema* [i] Sys\Data\Engine\Schema
Schemas* [i] Sys\Data\aux\list\Schemas
Subpages

About

  • Purpose: Engine-agnostic objects for operating on a Database Engine.
    • This mainly descends from the I/O Aspect clade. The other major aspect of Database management is the Engine Connection clade, which handles the mechanics of connecting from the Ferreteria client code to the database server, wherever it may be, and handling I/O therewith.
  • Parallel: Server

History

  • 2025-05-30 started
  • 2025-11-11 renamed *Ops -> *Oper, for length-match with *Conn and consistency with related clade names
  • 2026-01-26 major reworking: Oper ⇒ Client, moved from Sys\Data\Engine\OperSys\Data\Engine\endpt\Client
  • 2026-01-31 replaced {constructor with params} with protected constructor and AsNew(), to match how Server works now that the latter is an Entry

Code

interface iOper extends BaseIface {
    // ACTION: requests
    function DoDataRequest(DataReqIface $oReq);
    // ACTION: parameterized
    function SchemaList() : SchemasIface;
    function DoUserSetup();
    // OBJECTS
    function GetSchema(string $sName) : SchemaIface;
    #function Register() : RegIface; // SHORTCUT
    // INFO
    function ConnSlug() : string;   // connection shortname
}
abstract class caOper extends BaseClass implements SelfIface {

    // ++ CONFIG ++ //

    abstract protected function CommOpClass() : string;
    abstract protected function SchemaClass() : string;
    abstract protected function ScribeClass() : string;

    // -- CONFIG -- //
    // ++ SETUP ++ //

    protected function __construct() {}

    // USAGE: Only call if constructing to pass to a Conn object's constructor
    static public function ForConn() : iOper {
        $oThis = new static;
        return $oThis;
    }
    static public function FromConn(ConnIface $oConn) : iOper {
        $oThis = new static;
        $oThis->WithConn($oConn);
        return $oThis;
    }

    // ++ SETUP: dynamic ++ //

    private $oConn=NULL;
    public function WithConn(ConnIface $oConn) : void {
        $this->oConn = $oConn;
        #$this->RegisterThis();
    }
    protected function OConn() : ConnIface { return $this->oConn; }

    // -- SETUP -- //
    // ++ OBJECTS ++ //

    // TODO: Rename to OSchema()
    public function GetSchema(string $sName) : SchemaIface { return new ($this->SchemaClass())($this->OConn(),$sName); }

    // -- OBJECTS -- //
    // ++ INFO ++ //

    public function ConnSlug() : string { return $this->OConn()->ObjectSlug(); }

    // -- INFO -- //
    // ++ UI ++ //

    // UNPROMPT
    public function DescribeInline() : string { return $this->OConn()->DescribeInline(); }  // sometimes not needed

    // -- UI -- //
}