Exemplo n.º 1
0
 /**
  * Insert any missing slonyId and slonySetId as specifeid by dbsteward mode variables
  * 
  * @param SimpleXML $indoc
  * @return SimpleXML
  */
 public static function slonyid_number($indoc)
 {
     $outdoc = clone $indoc;
     // start with --slonyidsetvalue=
     $slony_set_id = dbsteward::$slonyid_set_value;
     // start slony ID at --slonyidstartvalue=
     $slony_id = dbsteward::$slonyid_start_value;
     foreach ($outdoc->schema as $schema) {
         xml_parser::slonyid_number_set($schema, $slony_set_id);
         foreach ($schema->table as $table) {
             xml_parser::slonyid_number_set($table, $slony_set_id);
             xml_parser::slonyid_number_id($table, $slony_id);
             foreach ($table->column as $column) {
                 // make sure any serial columns have slonySetId
                 if (sql99_column::is_serial($column['type'])) {
                     xml_parser::slonyid_number_set($column, $slony_set_id);
                     xml_parser::slonyid_number_id($column, $slony_id);
                 }
             }
         }
         foreach ($schema->trigger as $trigger) {
             xml_parser::slonyid_number_set($trigger, $slony_set_id);
         }
         foreach ($schema->sequence as $sequence) {
             xml_parser::slonyid_number_set($sequence, $slony_set_id);
             xml_parser::slonyid_number_id($sequence, $slony_id);
         }
         foreach ($schema->function as $function) {
             xml_parser::slonyid_number_set($function, $slony_set_id);
         }
         foreach ($schema->sql as $sql) {
             xml_parser::slonyid_number_set($sql, $slony_set_id);
         }
     }
     return $outdoc;
 }