Added support for a usage during history (i.e. /dev/hda as /var;
authorJoey Schulze <joey@infodrom.org>
Sun, 3 Oct 2004 05:54:21 +0000 (05:54 +0000)
committerJoey Schulze <joey@infodrom.org>
Sun, 3 Oct 2004 05:54:21 +0000 (05:54 +0000)
/dev/hdb as /boot etc.)

src/InfoCon/hwdb/edit_component.wml
src/InfoCon/hwdb/scheme.sql
src/InfoCon/hwdb/update.wml

index 565044c..c554150 100644 (file)
@@ -63,7 +63,7 @@
            $row_select_values[] = $srow['name'];
        }
     }
-    $query = sprintf ("SELECT compound FROM screw "
+    $query = sprintf ("SELECT compound,usage FROM screw "
                     ."WHERE component = %d AND endtime is NULL "
                     ."ORDER BY starttime DESC LIMIT 1", $row['id']);
     $sth = pg_exec ($dbh, $query) or die_query("Cannot issue query!");
                title="<b>Compound</b>"
                selected="$srow['compound']"
                >
+<row_input     name=usage
+               title="<b>Usage</b>"
+               value="<? echo $srow['usage']; ?>"
+               >
 <?
     $query = "SELECT id,name FROM organisation ORDER BY name";
     $sth = pg_exec ($dbh, $query) or die_query("Cannot issue query!");
index 92a503f..6ff7da4 100644 (file)
@@ -75,6 +75,7 @@ GRANT  ALL on "compound_id_seq" to "joey";
 CREATE TABLE screw (
        component INT4 NOT NULL references component(id) on delete cascade,
        compound  INT4 NOT NULL references compound(id) on delete cascade,
+       usage TEXT NOT NULL DEFAULT '',
        starttime timestamp with time zone DEFAULT '1980-01-01 00:00:00+01'::timestamp with time zone NOT NULL,
        endtime timestamp with time zone DEFAULT NULL
 );
index e4c9b8d..24388c0 100644 (file)
            $query = sprintf ("UPDATE screw SET endtime = now() WHERE oid = %d", $row['oid']);
            $sth = pg_exec ($dbh, $query) or die_query("Cannot update component history!", $query);
 
-           $query = sprintf ("INSERT INTO screw (component,compound,starttime) "
-                            ."VALUES (%d,%d,now())", $id, $compound);
+           $query = sprintf ("INSERT INTO screw (component,compound,usage,starttime) "
+                            ."VALUES (%d,%d,'%s'now())", $id, $compound, addslashes ($usage));
            $sth = pg_exec ($dbh, $query) or die_query("Cannot update component history!", $query);
          }
        } else {
-         $query = sprintf ("INSERT INTO screw (component,compound,starttime) "
-                          ."VALUES (%d,%d,%s)", $id, $compound,
+         $query = sprintf ("INSERT INTO screw (component,compound,usage,starttime) "
+                          ."VALUES (%d,%d,'%s'%s)", $id, $compound,
+                          addslashes ($usage),
                           $starttime? "'".$starttime."'" : "now()");
          $sth = pg_exec ($dbh, $query) or die_query("Cannot update component history!", $query);
        }