Ferreteria/v0.6/clade/Sys/Data/Engine/Conn: Difference between revisions

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | Sys‎ | Data‎ | Engine
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
{{l/ver/clade|IO/Aspect/Connx|Plug}}<br>
{{l/ver/clade|IO/Aspect/Connx|Plug}}<br>
{{l/ver/clade|Config/Roster/for|AnObject}}
{{l/ver/clade|Config/Roster/for|AnObject}}
{{!}} &rarr; {{l/ver/clade|Sys/Data/Engine|Conn}}
{{!}} align=center {{!}} &rarr; {{l/ver/clade|Sys/Data/Engine|Conn}}
{{!}} &rarr; {{l/ver/clade|Sys/Data/Engine/Conn|MyMar}}
{{!}} align=left {{!}} &rarr; {{l/ver/clade|Sys/Data/Engine/Conn|MyMar}}
|alia=
|alia=
{{!}}-
{{!}}-
{{!}} '''Base'''* [c,i] {{!}}{{!}} {{l/ver/clade|IO\Aspect\Connx|Plug}}
{{!}} '''ActionIface''' {{!!}} {{l/ver/clade|Sys\Events|ItWent}}
{{!}}-
{{!}}-
{{!}} '''Creds'''* [i] {{!}}{{!}} {{l/ver/clade|IO\Aspect|Creds}}
{{!}} '''Base'''* [c,i] {{!!}} {{l/ver/clade|IO\Aspect\Connx|Plug}}
{{!}}-
{{!}}-
{{!}} '''HasRost'''* [i,t] {{!}}{{!}} {{l/ver/clade|Config\Roster\for|AnObject}}
{{!}} '''Creds'''* [i] {{!!}} {{l/ver/clade|IO\Aspect|Creds}}
{{!}}-
{{!}}-
{{!}} '''Player'''* [i] {{!}}{{!}} {{l/ver/clade|Data\Base\Result|Player}}
{{!}} '''HasRost'''* [i,t] {{!!}} {{l/ver/clade|Config\Roster\for|AnObject}}
{{!}}-
{{!}}-
{{!}} '''Sock'''* [i] {{!}}{{!}} {{l/ver/clade|IO\Aspect|Socket}}
{{!}} '''Oper'''* [ca,i] {{!!}} {{l/ver/clade|Sys/Data/Engine|Ops}}
{{!}}-
{{!}}-
{{!}} '''View'''* [i] {{!}}{{!}} {{l/ver/clade|IO\O|View}}
{{!}} '''PlayerIface''' {{!!}} {{l/ver/clade|Data\Base\Result|Player}}
{{!}}-
{{!}} '''RostClass''' {{!!}} {{l/ver/clade|Data\Base\Result|DbList}}
{{!}}-
{{!}} '''SelfIface''' {{!!}} {{l/ver/clade|Sys/Data/Engine|Conn}}
{{!}}-
{{!}} '''SockIface''' {{!!}} {{l/ver/clade|IO\Aspect|Socket}}
{{!}}-
{{!}} '''ViewIface''' {{!!}} {{l/ver/clade|IO\O|View}}
}}
}}
==About==
==About==
* PURPOSE: base class for talking to a database engine
* PURPOSE: base class for talking to a database engine
** This ''is''a connection (to the DB engine), but it also ''contains'' a connection (to the shell endpoint).
** This ''is'' a connection (to the DB engine), but it also ''contains'' a connection (to the shell endpoint).
==Pages==
==Pages==
* {{l/sub|@history}}
* {{l/sub|@history}}
* {{l/sub|@removed}}
* {{l/sub|@removed}}
==Code==
==Code==
''as of 2025-10-01''
''as of 2025-10-15''
{{fmt/php/block|1=
{{fmt/php/block|1=
interface iConn extends BaseIface, HasRostIface {
interface iConn extends BaseIface, HasRostIface {
Line 47: Line 55:
     // #[Oper]
     // #[Oper]
     abstract protected function OperType() : string;
     abstract protected function OperType() : string;
    static protected function RosterClass() : string { return RostClass::class; }  // OVERRIDE


     // -- CONFIG -- //
     // -- CONFIG -- //

Revision as of 14:38, 15 October 2025

clade: Sys\Data\Engine\Conn
Clade Family

Plug
AnObject

Conn MyMar
Clade Aliases
Alias Clade
ActionIface ItWent
Base* [c,i] Plug
Creds* [i] Creds
HasRost* [i,t] AnObject
Oper* [ca,i] Ops
PlayerIface Player
RostClass DbList
SelfIface Conn
SockIface Socket
ViewIface View
Subpages

About

  • PURPOSE: base class for talking to a database engine
    • This is a connection (to the DB engine), but it also contains a connection (to the shell endpoint).

Pages

Code

as of 2025-10-15

interface iConn extends BaseIface, HasRostIface {
    // INVOCATION
    //#[BaseIface] function Open() : ActionIface;
    //#[BaseIface] function Shut() : ActionIface;
    // OBJECTS
    function OOper() : OperIface;
    function OSock() : SockIface;  // code-to-cmd-endpoint
    // UI
    //#[\Woozalia\Ferret\IO\iAspect] function DescribeInline() : string;
}

abstract class caConn extends BaseClass implements SelfIface {
    use HasRostTrait;

    // ++ CONFIG ++ //

    // #[Oper]
    abstract protected function OperType() : string;
    static protected function RosterClass() : string { return RostClass::class; }  // OVERRIDE

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

    public function __construct(string $sSlug, private SockIface $oSock) {
        $this->WithSlug($sSlug);
    }
    public function OSock() : SockIface { return $this->oSock; }

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

    public function Inspect() : ViewIface { return new ($this->InspectorClass())($this,$this->OSock(),$this->OCred(),$this); }

    // SHORTCUT
    protected function OCred() : CredsIface { return $this->OSock()->OCred(); }

    // #[Oper]
    private $oOper=NULL;
    #public function HoldOper(OperIface $o) : void { $this->oOper = $o; }
    // #[Oper]
    public function OOper() : OperIface { return $this->oOper ?? ($this->oOper = $this->OOperNew()); }
    // #[Oper]
    protected function OOperNew() : OperIface {
        $sType = $this->OperType();
        $osOper = OperAdmin::FromClassSlug($sType);
        if ($osOper->HasIt()) {
            $scOper = $osOper->GetIt();
            #$echo $this->ReflectThis()->Report();
            #echo $scOper::ReflectSelf()->Report();
            #$oOper = new ($scOper);
            $oOper = $scOper::AccessSelf();
            $oOper->WithConn($this);  // give new Oper a pointer to its Conn
        } else {
            echo self::CodingPrompt("This Connection expects an engine of type '$sType' to be defined.");
            $oOper = NULL;
        }
        return $oOper;
    }

    // -- OBJECTS -- //
}