Futilities/v0.6/clade/Sys/dba/InReq/DoExport/@retired
Jump to navigation
Jump to search
|
code removed from DoExport
|
2025-10-06
Commented out 2 days ago:
// ++ ACTION ++ //
// 2025-10-04 Probably just redundant now.
public function Go() {
// TODO 2025-09-20: This should check for a valid DbConn *object*, not just the slug (might not exist)
if ($this->OAUserInput()->QDbConnSlug()->HasIt()) {
// Get the DB Connection object:
#$oConn = $this->ODbConn();
// Get the Engine Request object to use:
$oRq = $this->NewEngDbExportRequest();
#echo 'XFER REQUEST CLASS: '.get_class($oRq).CRLF;
// Run the request on it:
#$oRq->AskEngine($oDBC);
$oRq->Go();
} else {
echo 'Quitting because no DB connection was specified.'.CRLF;
}
}
// -- ACTION -- //
2025-03-09
Commented out yesterday:
// 2025-03-08 I don't think this is applicable anymore.
protected function DbSlugToUse() : ?string {
$sInput = $this->Input(); // input for this term
$sDbSlug = NULL;
if ($sInput === '') {
// if no input, look for value in kept settings:
$oSet = $this->OInput();
$osDbase = $oSet->QDbConnSlug();
if ($osDbase->HasIt()) {
$sDbSlug = $osDbase->GetIt();
}
} else {
$sDbSlug = $sInput;
}
return $sDbSlug;
}
2025-03-05
// PURPOSE: Export was requested without specifying a DB -- so list the available DBs
// 2025-03-05 This does not seem to be called by anything anymore.
public function HandleMissing() : void {
$oStat = $this->HowItWent();
$oMsg = new NoDbaseMsgClass($this);
$oStat->AddMsgObject($oMsg);
$oStat->SetOkay(FALSE);
}
2024-12-05
This is from the previous version of Go(), mostly replaced by $this->FetchEngine();. Some of the code after that call is the same as before, but indented less since FetchEngine() currently die()s if unsuccessful (TODO: improve that).
// 2024-12-05 pre-FetchEngine() version:
$oaDBs = EngineBase::Registry();
// Check to be sure we know where to dump the output data file(s).
// 2024-11-16 Actually, let's do checks like this in a separate sequence.
// That way we can just assume here that we have everything we need.
// get the name(s) of the DB(s) we want to read
#echo $this->ReflectThis()->Report();
$sName = $this->QSetting()->GetIt(); // name of DB to read
// TODO: split off table names, if given
$osDB = $oaDBs->QGetIt($sName);
if ($osDB->HasIt()) {
$oDB = $osDB->GetIt();
#echo $oDB->ReflectThis()->Report();
$ftName = $oScrn->BoldIt($sName);
echo $oScrn->GreenIt("Accessing")." DB [$ftName]...".CRLF;
#echo $this->ReflectThis()->Report();
$oReg = self::Registry();
// get the relevant settings
#echo 'VAL MODE = '.KioskEnum::VAL_DFMT->value.CRLF;
$osMode = $oReg->QRetrieve(KioskEnum::VAL_DFMT->value);
$osPath = $oReg->QRetrieve(KioskEnum::VAL_PATH->value);
if (!$osPath->HasIt()) {
// use default
$fpData = sys_get_temp_dir();
echo self::Screen()->InfoIt('Note').": Using default temp folder [$fpData] for exported data.".CRLF;
} else {
$fpData = $osPath->GetIt()->QSetting()->GetIt();
}
if ($osMode->HasIt()) {
$oMode = $osMode->GetIt();
$sMode = $oMode->QSetting()->GetIt();
#echo $oMode->ReflectThis()->Report();
switch($sMode) {
case 'sql': $eMode = MyRqEnum::USE_SQL; break;
case 'json': $eMode = MyRqEnum::USE_JSON; break;
default:
echo self::Screen()->ErrorIt('Internal Error').": The string '$sMode' does not match any known backup-modes.".CRLF;
#echo 'Available modes: '.print_r(MyRqEnum::cases(),TRUE).CRLF;
// TODO 2024-11-23: list the available modes -- probably should be in an array somewhere and matched automatically instead of with switch/case.
die();
}
$oRq = new MyRqClass($eMode,$fpData);
} else {
echo self::Screen()->ErrorIt('Internal Error').": Backup mode has not been set.".CRLF; die();
}
$oDB->DoAdminRequest($oRq);
} else {
echo $oScrn->ErrorIt('Error').": Could not find database object for [$sName].".CRLF;
echo 'Available:'.CRLF;
echo $oaDefs->DumpAsTable();
}