/**
  * Parses GRANT and REVOKE commands
  *
  * @param database database
  * @param command REVOKE command
  */
 public static function parse($database, $command)
 {
     $command = sql_parser::remove_last_semicolon($command);
     if (preg_match(self::PATTERN_CONFIG_PARAMETER, $command, $matches) > 0) {
         if (count($matches) != 3) {
             var_dump($matches);
             throw new exception("Database configuration parameter call preg exploded into " . count($matches) . ", panic!");
         }
         // just do what the call does push around the name -> value
         $configuration_parameter =& dbx::get_configuration_parameter($database, $matches[1], true);
         dbx::set_attribute($configuration_parameter, 'value', $matches[2]);
     } else {
         throw new exception("Cannot parse command: " . $command);
     }
 }
Beispiel #2
0
 /**
  * database configurationParameter difference calculator / setter
  * call dbsteward.db_config_parameter() to alter the database settings
  * because the database name is not known to dbsteward when creating the runnable sql
  *
  * @param  object $ofs  output file segmenter
  *
  * @return void
  */
 public static function update_database_config_parameters($ofs, $db_doc_old, $db_doc_new)
 {
     foreach (dbx::get_configuration_parameters($db_doc_new) as $new_param) {
         $old_param = null;
         if (is_object(dbsteward::$old_database)) {
             $old_param = dbx::get_configuration_parameter($db_doc_old, $new_param['name']);
         }
         if ($old_param == null || strcmp($old_param['value'], $new_param['value']) != 0) {
             $old_value = "not defined";
             if ($old_param != null) {
                 $old_value = $old_param['value'];
             }
             $sql = "SELECT dbsteward.db_config_parameter('" . $new_param['name'] . "', '" . $new_param['value'] . "'); -- old configurationParameter value: " . $old_value;
             $ofs->write($sql . "\n");
         }
     }
 }