Ferreteria/v0.6/clade/Sys/Data/Engine/aux/ActionRq/Admin/dbase/EngDbExport: Difference between revisions

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | Sys‎ | Data‎ | Engine‎ | aux‎ | ActionRq‎ | Admin
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{page/clade/v2
{{page/clade/v2
|fam=
|fam=
{{!}} align=right {{!}} {{l/ver/clade|Sys\Data\Engine\aux\ActionRq\Admin|ToDbOper}}
{{!}} align=right {{!}} <code>{{l/ver/clade|Sys\Data\Engine\aux\ActionRq\Admin|ToDbOper}}</code>
{{!}} align=center {{!}} &rarr; {{l/ver/clade|Sys\Data\Engine\aux\ActionRq\Admin\ToDbOper|EngDbExport}} &rarr;  
{{!}} align=center {{!}} &rArr; <code>{{l/ver/clade|Sys\Data\Engine\aux\ActionRq\Admin\ToDbOper|EngDbExport}}</code> &rArr;
{{!}} align=left {{!}} ''(none)''
{{!}} align=left   {{!}} [WFu]<code>{{l/ver/clade|p=futilities|Sys\dba\InReq|DoExport}}</code>


|alia=
|alia=
{{!}}-
{{!-!}} '''Base'''* [ca,i] {{!!}} <code>{{l/ver/clade/full|Sys\Data\Engine\aux\ActionRq\Admin|ToDbOper}}</code>
{{!}} '''Base'''* [ca,i] {{!!}} {{l/ver/clade/full|p=ferreteria|Sys\Data\Engine\aux\ActionRq\Admin|ToDbOper}}
{{!-!}} '''File'''*   [c] {{!!}} <code>{{l/ver/clade/full|Sys\FileSys\Node|Fi}}</code>
{{!}}-
{{!-!}} '''Request'''* [i] {{!!}} <code>{{l/ver/clade/full|Sys\Data\Engine\aux\ActionRq|Admin}}</code>
{{!}} '''File'''* [c] {{!!}} {{l/ver/clade/full|p=ferreteria|Sys\FileSys\Node|Fi}}
{{!}}-
{{!}} '''Request'''* [i] {{!!}} {{l/ver/clade/full|p=ferreteria|Sys\Data\Engine\aux\ActionRq|Admin}}


}}
}}
==Pages==
==History==
* [[2025/10/08]]: fixing the call to <code>FromParams()</code>
* '''{{fmt/date|2024|12|03}}''' [NOTE] <code>mariadb-dump</code> has an <code>--xml</code> / <code>-X</code> option which outputs in XML.
** {{hashtag|TODO}}: experiment with this.
* '''{{fmt/date|2024|11|22}}''' started
* '''{{fmt/date|2025|01|21}}''' <code>AskEngine()</code> was calling a separate <code>DoDbaseBackup()</code> method right at the end, but I think this was just complicating things and confusing to read -- nothing else calls that. I've recombined them.
* '''{{fmt/date|2025|03|25}}''' moved from <code>AdminRq/</code> to <code>AdminRq/ToDbConn/</code>
* '''{{fmt/date|2025|09|21}}''' renaming from Backup to EngDbExport, for consistency and clarity
* '''[[2025/10/08]]''': fixing the call to <code>{{l/ver/fx|FromParams}}()</code>
* '''{{fmt/date|2025|10|09}}''' Had to split off a trait in order to avoid Go() always overriding Go() from included traits in podlings.
==Code==
==Code==
''as of 2025-10-07''
* [[/@removed/]]
* ''as of {{fmt/date|2025|10|07}}:''
{{fmt/php/block|1=
{{fmt/php/block|1=
interface iEngDbExport extends BaseIface {}
interface iEngDbExport extends BaseIface {}

Latest revision as of 13:40, 27 November 2025

clade: Sys\Data\Engine\aux\ActionRq\Admin\dbase\EngDbExport
Clade Family
ToDbOper EngDbExport [WFu]DoExport
Clade Aliases
Alias Clade
Base* [ca,i] Sys\Data\Engine\aux\ActionRq\Admin\ToDbOper
File* [c] Sys\FileSys\Node\Fi
Request* [i] Sys\Data\Engine\aux\ActionRq\Admin
Subpages

History

  • 2024-12-03 [NOTE] mariadb-dump has an --xml / -X option which outputs in XML.
    • #TODO: experiment with this.
  • 2024-11-22 started
  • 2025-01-21 AskEngine() was calling a separate DoDbaseBackup() method right at the end, but I think this was just complicating things and confusing to read -- nothing else calls that. I've recombined them.
  • 2025-03-25 moved from AdminRq/ to AdminRq/ToDbConn/
  • 2025-09-21 renaming from Backup to EngDbExport, for consistency and clarity
  • 2025/10/08: fixing the call to FromParams()
  • 2025-10-09 Had to split off a trait in order to avoid Go() always overriding Go() from included traits in podlings.

Code

interface iEngDbExport extends BaseIface {}
abstract class caEngDbExport extends BaseClass implements iEngDbExport {

    // ++ CONFIG ++ //

    abstract protected function EngScExportRequestClass() : string;

    // -- CONFIG -- //
    // ++ ACTION ++ //

    // CEMENT
    public function Go() {
        $oScrn = self::Screen();

        $oDBC = $this->QDbOper()->GetIt();
        $oTplt = $this->FileSpecTemplate();
        $oTplt->Lookup()->QEngine()->SetIt($oDBC);

        $oTplt = $this->FileSpecTemplate();
        $oLook = $oTplt->Lookup();  // filename template

        $arSch = $oDBC->SchemaList();
        $nSch = count($arSch);
        if ($nSch == 0) {
            echo $oScrn->ErrorIt('Problem').': no schemas found.'.CRLF;
            $ok = FALSE;
        } else {
            $ok = TRUE;
            echo $nSch.' schema'.(($nSch==1)?'':'s').' found.'.CRLF;
            foreach ($arSch as $oSchema) {
                $oLook->QSchema()->SetIt($oSchema); // provide schema info for template ($oTplt)
                $fsData = $oTplt->Render();
                $ofData = FileClass::FromSpec($fsData);

                #$oSchReq = $this->NewEngScExportRequest();
                $sc = $this->EngScExportRequestClass();
                echo $sc::ReflectSelf()->Report();
                $oSchReq = $sc::FromParams($oSchema,$ofData);
                $oSchReq->Go();

            }
        }
        if ($ok) {
            echo $oScrn->GreenIt('Ok!').' - Backup complete.'.CRLF;
        } else {
            echo $oScrn->YellowIt('Note').': - one or more issues were found during backup.'.CRLF;
        }
    }

    // -- ACTION -- //
    // ++ OBJECTS ++ //

    protected function FileSpecTemplate() : TemplateIface { return FilePaths::Me()->ExportFiTplt(); }

    // -- OBJECTS ++ //
}