Ferreteria/v0.6/clade/Sys/Data/Engine/Conn: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{page/clade | {{page/clade/v2 | ||
|fam= | |||
! | {{!}} align=right {{!}} | ||
<poem> | |||
<code>{{l/ver/clade|IO/Aspect/Connx|Plug}}</code> | |||
{{l/ver/clade|IO/Aspect/Connx|Plug}}< | <code>{{l/ver/clade|Config/Roster/for|AnObject}}</code> | ||
{{l/ver/clade|Config/Roster/for|AnObject}} | </poem> | ||
{{!}} align=center {{!}} ⇒ <code>{{l/ver/clade|Sys/Data/Engine|Conn}}</code> | |||
| | {{!}} align=left {{!}} ⇒ <code>{{l/ver/clade|Sys/Data/Engine/Conn|MyMar}}</code> | ||
|} | |||
|alia= | |||
{{!-!}} '''Base'''* [c,i] {{!!}} <code>{{l/ver/clade/full|IO\Aspect\Connx|Plug}}</code> | |||
{{!-!}} '''CredsIface''' {{!!}} <code>{{l/ver/clade/full|IO\Aspect|Creds}}</code> | |||
{{!-!}} '''HasClsRost'''* [i,t] {{!!}} <code>{{l/ver/clade/full|Config\Roster\for|AClass}}</code> | |||
{{!-!}} '''HasObjRost'''* [i,t] {{!!}} <code>{{l/ver/clade/full|Config\Roster\for|AnObject}}</code> | |||
{{!-!}} '''OperIface''' {{!!}} <code>{{l/ver/clade/full|Sys/Data/Engine|Ops}}</code> | |||
{{!-!}} '''RostClass''' {{!!}} <code>{{l/ver/clade/full|Sys\Data\Engine\aux|DbList}}</code> | |||
{{!-!}} '''SelfIface''' {{!!}} <code>{{l/ver/clade/full|Sys\Data\Engine|Conn}}</code> | |||
{{!-!}} '''SockIface''' {{!!}} <code>{{l/ver/clade/full|IO\Aspect|Socket}}</code> | |||
{{!-!}} '''ViewIface''' {{!!}} <code>{{l/ver/clade/full|IO\O|View}}</code> | |||
}} | |||
==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== | |||
* {{l/sub|@history}} | |||
* {{l/sub|@removed}} | |||
* clade subspace: | |||
** [[/MyMar/]] | |||
* auxiliary subspace: | |||
** [[/view/]] | |||
==Code== | |||
''as of {{fmt/date|2025|10|21}}:'' | |||
{{fmt/php/block|1= | |||
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 -- // | |||
} | |||
}} | |||
Latest revision as of 02:32, 4 December 2025
| ||||||||||||||||||||||||||||||
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
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 -- //
}