Ferreteria/v0.6/clade/Sys/Data/Engine/need/UseEngine/@code/removed

From WoozleCodes
Jump to navigation Jump to search
  • 2026-02-14 actually, what do we need Engine for?
#
    protected function QOEngine() : QEngineIface {
        $oScrn = self::Screen();

        $qsName = $this->QSDbase();
        // QSDbase() is implemented in the application (which determines how it is set).
        // - It reflects the name (slug) of the requested DB for a given operation.
        $oItWent = $this->OFindStatus();
        $didFind = FALSE;
        if ($qsName->HasIt()) {
            $sName = $qsName->GetIt();
            if ($sName !== '') {
                $didFind = TRUE;
            }
        } else {
            $oItWent->SetError($oItWent::N_ERR_DB_SLUG);
            $oItWent->AddMsgString(self::Screen()->ErrorIt('No DB connection-name specified.'));
        }

        $qoEngine = QEngineClass::AsNew();

        if ($didFind) {

        // STEP 2: try to get the DB connection spec object for that name:

            $ftName = $oScrn->BoldIt($sName);
            $oItWent->AddMsgString($oScrn->GreenIt("Using")." data engine on [$ftName].");

            $oaCables = CableClass::ObjectRoster();
            $qoClient = $oaCables->QryIt($sName);
            if ($qoClient->HasIt()) {
                $oClient = $qoClient->GetIt();
            echo $oClient->ReflectThis()->Report();
                $oEngine = $oClient->OEngine();
                $oItWent->SetOkay(TRUE);
                $qoEngine->SetIt($oEngine);
            } else {
                $noFind = TRUE;
                $oItWent->SetError($oItWent::N_ERR_DB_DEFN);
                $oItWent->AddMsgString($oScrn->ErrorIt('Input Error').": Could not find DB access specs for [$ftName].");
            }
        }
        return $qoEngine;
    }
   // // Connection:
  • 2026-02-14 Shouldn't we be using OCable() instead, now?
#
    protected function OServer(?ServerIface $o=NULL) : ServerIface {
        if (is_object($o)) {
            $this->QOServer()->SetIt($o);
        }
        return $this->QOServer()->GetIt();
    }
  • 2026-02-14 Updated -- but do we actually want to have access to this?
#
    private $qoServer = NULL;
    public function QOServer() : QServerIface { return $this->qoServer ?? ($this->qoServer = QServerClass::AsNew()); }
    */

    /* 2026-01-25 partly revised, but really needs to be called FetchDbOper()... or DbOperFind(), actually.
    protected function FetchOServer() : QServerIface {
        $oScrn = self::Screen();
        $qoConn = QServerClass::AsNew();
        $oItWent = $qoConn->ItWentLike();

        // STEP 1: retrieve the name for the requested DB (if any)

        $qsName = $this->QSDbase();
        // QSDbase() is implemented in the application (which determines how it is set).
        // - It reflects the name (slug) of the requested DB for a given operation.

        $didFind = FALSE;
        if ($qsName->HasIt()) {
            $sName = $qsName->GetIt();
            if ($sName !== '') {
                $didFind = TRUE;
            }
        } else {
            $oItWent->SetError($oItWent::N_ERR_DB_SLUG);
            $oItWent->AddMsgString(self::Screen()->ErrorIt('No DB connection-name specified.'));
        }

        if ($didFind) {

        // STEP 2: try to get the DB connection spec object for that name:

            $ftName = $oScrn->BoldIt($sName);
            $oItWent->AddMsgString($oScrn->GreenIt("Using")." DB connection [$ftName].");

            #$oaDBs = DbConnAdmin::ObjectRoster();
            $oaOpers = CableClass::ObjectRoster();  // returns an Engine Oper object
            #echo $oaDBs->ReflectThis()->Report();
            $qsOper = $oaOpers->QryIt($sName);
            if ($qsOper->HasIt()) {
                $oOper = $qsOper->GetIt();
                $oConn = $oOper->OConn();
                #echo $oDB->ReflectThis()->Report();
                $qoConn->SetIt($oConn);
                $oItWent->SetOkay(TRUE);
            } else {
                $noFind = TRUE;
                $oItWent->SetError($oItWent::N_ERR_DB_DEFN);
                $oItWent->AddMsgString($oScrn->ErrorIt('Input Error').": Could not find DB access specs for [$ftName].");
            }
        }
        return $qoConn;
    }