/**
* A class that implements the Slony 1.0.x support plugin
*
- * $Id: Slony.php,v 1.1.2.3 2005/05/22 14:29:08 chriskl Exp $
+ * $Id: Slony.php,v 1.1.2.4 2005/05/24 13:02:02 chriskl Exp $
*/
include_once('./classes/plugins/Plugin.php');
$data->fieldClean($schema);
$data->clean($set_id);
- $sql = "SELECT c.relname
- FROM pg_catalog.pg_class c, \"{$schema}\".sl_table st
+ $sql = "SELECT c.relname, n.nspname
+ FROM pg_catalog.pg_class c, \"{$schema}\".sl_table st, pg_catalog.pg_namespace n
WHERE c.oid=st.tab_reloid
+ AND c.relnamespace=n.oid
AND st.tab_set='{$set_id}'
ORDER BY c.relname";
return $data->selectSet($sql);
}
+ /**
+ * Return all sequences in a replication set
+ * @param $set_id The ID of the replication set
+ * @return Sequences in the replication set, sorted alphabetically
+ */
+ function &getSequences($set_id) {
+ global $data;
+
+ $schema = $this->slony_schema;
+ $data->fieldClean($schema);
+ $data->clean($set_id);
+
+ $sql = "SELECT c.relname AS seqname, n.nspname
+ FROM pg_catalog.pg_class c, \"{$schema}\".sl_sequence ss, pg_catalog.pg_namespace n
+ WHERE c.oid=ss.seq_reloid
+ AND c.relnamespace=n.oid
+ AND ss.seq_set='{$set_id}'
+ ORDER BY c.relname";
+
+ return $data->selectSet($sql);
+ }
+
}
?>
/**
* Slony database tab plugin
*
- * $Id: plugin_slony.php,v 1.1.2.2 2005/05/22 14:29:08 chriskl Exp $
+ * $Id: plugin_slony.php,v 1.1.2.3 2005/05/24 13:02:01 chriskl Exp $
*/
// Include application functions
'action' => url('redirect.php',
$reqvars,
array(
- 'subject' => 'slony_node'
+ 'set_id' => field('set_id')
)
),
'branch' => url('plugin_slony.php',
$reqvars,
array(
- 'action' => 'sets_top'
+ 'action' => 'sets_top',
+ 'set_id' => field('set_id')
)
)
);
'branch' => url(field('url'),
$reqvars,
field('urlvars'),
- array('action' => 'subscriptions')
+ array('action' => 'subscriptions', 'set_id' => $_REQUEST['set_id'])
),
'nofoot' => true
);
'branch' => url(field('url'),
$reqvars,
field('urlvars'),
- array('action' => 'tables', 'set_id' => XXXXXXXXXHERE)
+ array('action' => 'tables', 'set_id' => $_REQUEST['set_id'])
),
'nohead' => true,
'nofoot' => true
'branch' => url(field('url'),
$reqvars,
field('urlvars'),
- array('action' => 'sequences')
+ array('action' => 'sequences', 'set_id' => $_REQUEST['set_id'])
),
'nohead' => true
);
'toolTip'=> field('relcomment'),
'action' => url('redirect.php',
$reqvars,
- array('table' => field('relname'))
+ array('table' => field('relname'), 'schema' => field('nspname'))
+ )
+ );
+
+ $misc->printTreeXML($tables, $attrs);
+
+ break;
+ case 'sequences':
+ $tables = &$slony->getSequences($_REQUEST['set_id']);
+
+ $reqvars = $misc->getRequestVars('sequence');
+
+ $attrs = array(
+ 'text' => field('seqname'),
+ 'icon' => 'sequences',
+ 'toolTip'=> field('seqcomment'),
+ 'action' => url('sequences.php',
+ $reqvars,
+ array (
+ 'action' => 'properties',
+ 'sequence' => field('seqname'),
+ 'schema' => field('nspname')
+ )
)
);