--- /dev/null
+<?php
+global $BASE_URLS, $MENU_ITEMS, $GLOBAL_BASE_URL;
+
+$BASE_URLS["ds"]["base"] = "ds"; // ap for apt-proxy
+$BASE_URLS["ds"]["function"] = "ds_contentUrls"; // the page builder function for us
+$MENU_ITEMS["ds"]["title"] = "DataStores";
+$MENU_ITEMS["ds"]["link"] = "$GLOBAL_BASE_URL/ds/control";
+
+
+function ds_contentPane()
+{
+ echo "i am a ds content pane<br>";
+}
+
+function ds_leftMenu()
+{
+ echo "i am a ds leftmenu";
+}
+
+function ds_contentUrls()
+{
+ $calls["needs_base_page"] = true;
+ $calls["content_pane_function"] = "ds_contentPane";
+ $calls["left_menu_function"] = "ds_leftMenu";
+
+ return $calls;
+}
+
+function ds_createDS($ds_name, $store_location)
+{
+
+}
+
+function ds_fileds($ds_name, $file_id, $file_name)
+{
+}
+
+function ds_downloadAndStore($ds_name, $file_id, $file_name, $file_url)
+{
+
+}
+
+?>
\ No newline at end of file
}
// all columns end up as text
-function db_createTable($tablename, $ncolumns)
+function db_createTable($tablename)
{
$db = db_getDB();
$sql = "create table \"$tablename\" (\"".$tablename."_id\" INTEGER PRIMARY KEY AUTOINCREMENT";
- for($i=1; $i <= $ncolumns; $i++) {
- $colname = "column_$i";
+ for($i=1; $i < func_num_args(); $i++) {
+ $colname = func_get_arg($i);
$sql .= ", $colname text";
}
$sql .= ")";
+ echo "sql: $sql\n";
$db->query($sql);
}
{
$db = db_getDB();
- $sql = "select * from \"$tablename\" where column_$column like '%$value%'";
+ $sql = "select * from \"$tablename\" where $column like '%$value%'";
$res = $db->query($sql);
$data = $res->fetchAll();
}
+function db_updateData($tablename, $column, $newdata, $wherecol, $wheredata, $exact=true)
+{
+ $db = db_getDB();
+
+ if($exact) $sql = "update \"$tablename\" set $column='$newdata' where $wherecol='$wheredata'";
+ else $sql = "update \"$tablename\" set $column='$newdata' where $wherecol like '$wheredata'";
+ return $db->query($sql);
+}
+
function db_deleteTable($tablename)
{
$db = db_getDB();
require_once("../lib/lib.php");
-db_createTable("table1", 4);
-db_createTable("table2", 4);
-db_createTable("table3", 4);
+db_createTable("table1", "data1", "data2", "data3", "data4");
+db_createTable("table2", "data1", "data2", "data3", "data4");
+db_createTable("table3", "data1", "data2", "data3", "data4");
if(db_tableExists("table1")) echo "table 1 exists - correct\n";
else echo "table 1 not exists - wrong\n";
print_r($tabs);
// now try a select
-$ret = db_selectData("table1", "1", "data1");
+$ret = db_selectData("table1", "data1", "data1");
echo "did select 1 on table1 and got:\n";
print_r($ret);
if(isset($ret[0])) {
$GLOBAL_BASE_URL="/src/eclipse-workspace/glcas/www/";
$DB_URL="sqlite:$BASE_DIR/var/ds_store.db";
-global $GLOBAL_BASE_URL;
+global $GLOBAL_BASE_URL, $DB_URL;
?>
\ No newline at end of file