Ferreteria/v0.6/clade/Sys/Data/Engine/Conn

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | Sys‎ | Data‎ | Engine
Revision as of 02:32, 4 December 2025 by Woozle (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
clade: Sys\Data\Engine\Conn
Clade Family
Conn MyMar
Clade Aliases
Alias Clade
Base* [c,i] IO\Aspect\Connx\Plug
CredsIface IO\Aspect\Creds
HasClsRost* [i,t] Config\Roster\for\AClass
HasObjRost* [i,t] Config\Roster\for\AnObject
OperIface Sys\Data\Engine\Ops
RostClass Sys\Data\Engine\aux\DbList
SelfIface Sys\Data\Engine\Conn
SockIface IO\Aspect\Socket
ViewIface IO\O\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-21:

interface iConn extends BaseIface, HasClsRostIface, HasObjRostIface {
    // OBJECTS
    function OOper() : OperIface;
    function OSock() : SockIface;  // code-to-cmd-endpoint
}
abstract class caConn extends BaseClass implements SelfIface {
    use HasClsRostTrait;
    use HasObjRostTrait;

    // ++ CONFIG ++ //

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

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

    // $sSlug is the name for this Connection
    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;
    // #[Oper]
    public function OOper() : OperIface { return $this->oOper ?? ($this->oOper = $this->OOperNew()); }
    // #[Oper]
    protected function OOperNew() : OperIface {
        $scOper = $this->OperClass();
        $this->AmHere("Making NEW $scOper");
        $oOper = $scOper::FromConn($this);
        return $oOper;
    }

    // -- OBJECTS -- //
}