//$succ = WOOOF_MetaData::importMetaData( $wo, 'mdExp_20150714154548.json' ); //if ( $succ ) { // $succ = WOOOF_MetaData::updateMetaDataFromOtherMetaData($wo, $ddl, $dml, $sqlPerTable, false, true); //} /* // or that (create indexes for all Tables from metaData) $res = WOOOF_MetaData::buildIndexesForAllTables($wo, $database, false ); foreach( $res as $aTable => $aSQLArray ) { echo implode("<br>", $aSQLArray); } echo "<br><br>"; die("Finished with buildIndexesForAllTables"); */ /* // or that (create indexes for a Table from metaData) $objName = 'stories'; // applications $res = WOOOF_MetaData::buildIndexesForTable($wo, $database, $objName, false); foreach( $res as $aTable => $aSQLArray ) { echo implode("<br>", $aSQLArray); } echo "<br><br>"; die("Finished with buildIndexesForTable [$objName]"); */ if ($succ !== FALSE) { if ($doCommit) { $wo->db->commit(); } echo '<h4>Ok</h4>'; } else { $wo->db->rollback(); echo '<h4>***FAILED***</h4>'; echo $wo->getErrorsAsStringAndClear(); } //*/ echo '<h4>Finished</h4>';
<?php // _genericMetaData.php // CAUTION: TODO: Work in progress require_once '../setup.inc.php'; $requestedAction = 'read'; $pageLocation = '1'; $browserTitle = 'MetaData'; $timers = array(); $wo = new WOOOF(); if (!$wo->constructedOk) { $wo->handleShowStopperError("1000 Failed to init WOOOF."); } $paramNames = array('_tableName'); $in = $wo->getMultipleGetPost($paramNames); //$in['where'] = "region='Greece'"; $tableName = $in['_tableName']; $table = new Generic($tableName, $wo); // requires view : __v_columnMetaData $res = $table->showMetaData($in); // if ( $tpl === FALSE ) { $wo->handleShowStopperError( print_r($errors,true) ); } if ($res === FALSE) { // $wo->handleShowStopperError( $error ); $tpl = array('browserTitle' => $browserTitle, 'content' => 'Sorry, smg went wrong', 'errorMessage' => nl2br($wo->getErrorsAsStringAndClear()), 'message' => ''); } else { $tpl = array('browserTitle' => $tableName . ' ' . $browserTitle, 'content' => $res, 'message' => ''); } $wo->fetchApplicationFragment('structural/generic_template.php'); // UNREACHEABLE: As generic_template.php exits at its end! // End of file _genericMetaData.php
public static function returnJSON2(WOOOF $wo, $res) { if ($res !== FALSE) { self::returnJSON(true, $res, ''); } else { self::returnJSON(false, null, $wo->getErrorsAsStringAndClear()); } return true; }