attempt to fix machine table so also works with mysql, a=chris

Chris Pollett [2011-12-05 15:Dec:th]
attempt to fix machine table so also works with mysql, a=chris
Filename
configs/createdb.php
models/machine_model.php
views/machinestatus_view.php
diff --git a/configs/createdb.php b/configs/createdb.php
index ffc8ec806..8be0d86eb 100755
--- a/configs/createdb.php
+++ b/configs/createdb.php
@@ -243,7 +243,7 @@ $db->execute("CREATE TABLE MIX_COMPONENTS (

 $db->execute("CREATE TABLE MACHINE (
     NAME VARCHAR(16) PRIMARY KEY, URL VARCHAR(256) UNIQUE,
-    HAS_QUEUE_SERVER BOOLEAN, NUM_FETCHERS INT(4))");
+    HAS_QUEUE_SERVER INT, NUM_FETCHERS INT(4))");

 $db->disconnect();
 if(in_array(DBMS, array('sqlite','sqlite3' ))){
diff --git a/models/machine_model.php b/models/machine_model.php
index b89d81d75..d4e195675 100644
--- a/models/machine_model.php
+++ b/models/machine_model.php
@@ -100,15 +100,14 @@ class MachineModel extends Model
     {
         $this->db->selectDB(DB_NAME);
         if($has_queue_server == true) {
-            $has_string = "TRUE";
+            $has_string = "1";
         } else {
-            $has_string = "FALSE";
+            $has_string = "0";
         }
         $sql = "INSERT INTO MACHINE VALUES ('".
-            $this->db->escapeString($name)."',
-            '".$this->db->escapeString($url)."',
-            '".$has_string."',
-            '".$this->db->escapeString($num_fetchers)."')";
+            $this->db->escapeString($name)."','".
+            $this->db->escapeString($url)."',".$has_string.",'".
+            $this->db->escapeString($num_fetchers)."')";

         $this->db->execute($sql);
     }
diff --git a/views/machinestatus_view.php b/views/machinestatus_view.php
index 3ded40864..35d6640ba 100644
--- a/views/machinestatus_view.php
+++ b/views/machinestatus_view.php
@@ -74,7 +74,7 @@ class MachinestatusView extends View
                 $off_queue_server = $base_url . "update&name={$m['NAME']}".
                     "&action=stop";
             ?></p>
-            <?php if($m['HAS_QUEUE_SERVER'] == "TRUE") {
+            <?php if($m['HAS_QUEUE_SERVER'] == "1") {
                 $log_url = $base_url . "log&name={$m['NAME']}";
             ?>
                 <table class="machinetable">
ViewGit