Futilities/v0.6/clade/Sys/dba/InReq/DoImport/@fx/Describe
Jump to navigation
Jump to search
DoImport::Describe() |
About
- General: Describe
- NOTE that this describes what is going to happen, but doesn't attempt to do it (except for necessary state-changes).
- However, what is going to happen can depend on kept settings -- so those need to be checked IF the current reqlet has no value.
- Apparently this can be called before validating the user's input.
- However, what is going to happen can depend on kept settings -- so those need to be checked IF the current reqlet has no value.
- #TODO 2025-02-11 This process needs tidying and normalizing.
Code
#
public function Describe() : string {
#echo $this->ReflectThis()->Report();
#echo $this->RenderStackDump();
$oScrn = self::Screen();
$oaData = $this->OAUserInput();
#$oaData = static::OAKeptInput();
$this->AmHere();
$osDbSlug = $oaData->QSDbConn();
$osScSlug = $oaData->QSSchema();
#echo $oaData->ReflectThis()->Report();
$doListFiles = FALSE; // flip this on if the user needs it
if ($osDbSlug->HasIt()) {
// Get DB Connection slug for UI display:
$sDbSlug = $osDbSlug->GetIt();
$ftDbSlug = $oScrn->BoldIt($sDbSlug);
// Has the Schema been specified?
if ($osScSlug->HasIt()) {
$sScSlug = $osScSlug->GetIt();
$ftScSlug = $oScrn->BoldIt($sScSlug);
$sRtn = "Import schema '$ftScSlug' into the '$ftDbSlug' database"; // TODO 2025-01-26 I think this will need refinement.
} else {
$sRtn = "Import into the '$ftDbSlug' database: can't complete because no schema specified.";
$doListFiles = TRUE;
}
} else {
$sRtn = 'Import data (need to know which schema).'.CRLF;
$doListFiles = TRUE;
}
if ($doListFiles) {
$sHelp = 'COMMANDS: file:<SQL filename>, schema:<schema name>, conn:<connection name>';
$sRtn .=
$this->RenderFiles() // ...so the user can see what's available
.CRLF
.$sHelp.CRLF // TODO: get these from the XML spec data
;
}
return $sRtn;
}