Ferreteria/v0.6/clade/Sys/Data/Engine/Oper: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 21: | Line 21: | ||
* '''Purpose''': engine-agnostic objects for doing ''operations'' on a {{l/ver/clade|Sys\Data|Engine|Database Engine}} via an open DB connection ([[/Conn/]]). | * '''Purpose''': engine-agnostic objects for doing ''operations'' on a {{l/ver/clade|Sys\Data|Engine|Database Engine}} via an open DB connection ([[/Conn/]]). | ||
** This mainly descends from the {{l/ver/clade|IO|Aspect|I/O Aspect}} clade. The other major aspect of {{l/ver/clade|Sys\Data|Engine|Database}} management is the {{l/ver/clade|Sys/Data/Engine|Conn|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. | ** This mainly descends from the {{l/ver/clade|IO|Aspect|I/O Aspect}} clade. The other major aspect of {{l/ver/clade|Sys\Data|Engine|Database}} management is the {{l/ver/clade|Sys/Data/Engine|Conn|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. | ||
* | ** Tentatively, must be initialized with a [[/Conn/]] object. | ||
* '''Naming''': short for "operator" or "operations" | * '''Naming''': short for "operator" or "operations" | ||
* '''Parallel''': [[../Conn/]] | |||
==History== | ==History== | ||
* {{fmt/date|2025|05|30}} started | * {{fmt/date|2025|05|30}} started | ||
* {{fmt/date|2025|11|11}} renamed *Ops -> *Oper, for length-match with *Conn | * {{fmt/date|2025|11|11}} renamed *Ops -> *Oper, for length-match with *Conn and consistency with related clade names | ||
==Code== | ==Code== | ||
''as of {{fmt/date|2025|11|11}}'' | |||
{{fmt/php/block|1= | {{fmt/php/block|1= | ||
interface | interface iOper extends BaseIface { | ||
// ACTION: requests | // ACTION: requests | ||
function DoDataRequest(DataReqIface $oReq); | function DoDataRequest(DataReqIface $oReq); | ||
| Line 37: | Line 38: | ||
// OBJECTS | // OBJECTS | ||
function GetSchema(string $sName) : SchemaIface; | function GetSchema(string $sName) : SchemaIface; | ||
#function Register() : RegIface; // SHORTCUT | |||
// INFO | // INFO | ||
function ConnSlug() : string; // connection shortname | function ConnSlug() : string; // connection shortname | ||
} | } | ||
abstract class | abstract class caOper extends BaseClass implements SelfIface { | ||
// ++ CONFIG ++ // | // ++ CONFIG ++ // | ||
| Line 55: | Line 56: | ||
// USAGE: Only call if constructing to pass to a Conn object's constructor | // USAGE: Only call if constructing to pass to a Conn object's constructor | ||
static public function ForConn() : | static public function ForConn() : iOper { | ||
$oThis = new static; | $oThis = new static; | ||
return $oThis; | return $oThis; | ||
} | } | ||
static public function FromConn(ConnIface $oConn) : | static public function FromConn(ConnIface $oConn) : iOper { | ||
$oThis = new static; | $oThis = new static; | ||
$oThis->WithConn($oConn); | $oThis->WithConn($oConn); | ||
| Line 78: | Line 79: | ||
// TODO: Rename to OSchema() | // TODO: Rename to OSchema() | ||
public function GetSchema(string $sName) : SchemaIface { return new ($this->SchemaClass())($this,$sName); } | public function GetSchema(string $sName) : SchemaIface { return new ($this->SchemaClass())($this->OConn(),$sName); } | ||
// -- OBJECTS -- // | // -- OBJECTS -- // | ||
Latest revision as of 17:16, 11 November 2025
| ||||||||||||||||||||||||||||
About
- Purpose: engine-agnostic objects for doing operations on a Database Engine via an open DB connection (Conn).
- 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.
- Tentatively, must be initialized with a Conn object.
- Naming: short for "operator" or "operations"
- Parallel: Conn
History
- 2025-05-30 started
- 2025-11-11 renamed *Ops -> *Oper, for length-match with *Conn and consistency with related clade names
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 -- //
}
Removed
2025-11-11
// 2025-06-06 default should take care of this now
protected function RegisterThis() {
$oConn = $this->OConn();
#echo $oConn->ReflectThis()->Report(); // how do we get the ObjectSlug()?
$sSlug = $oConn->Slug();
$this->Register()->SetIt($sSlug,$oConn);
}