Futilities/v0.6/clade/Sys/dba/InReq/DoImport/@fx/Describe

From Woozle Writes Code
< Futilities‎ | v0.6‎ | clade‎ | Sys‎ | dba‎ | InReq‎ | DoImport
Revision as of 15:55, 17 November 2025 by Woozle (talk | contribs) (Created page with "{{fmt/title|<code>DoImport::Describe()</code>}} ==About== * '''General''': {{l/ver/fx|{{SUBPAGENAME}}}} * 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. * {{hashtag|TODO}} {{fmt/date|2025|02|...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.
  • #TODO 2025-02-11 This process needs tidying and normalizing.

Code

as of 2025-11-17:

#
    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;
    }