Exemple #1
0
 public function execSQL($query, $multi = false)
 {
     $res = DBHelper::exec($query, $multi);
     if ($res != null) {
         $this->error++;
         $this->printStepMsg($res, true);
     }
     return true;
 }
Exemple #2
0
        $sql = "UPDATE tabDataToNode SET ";
        for ($i = 1; $i <= 10; $i++) {
            $paramName = "data" . $i;
            if (isset($_POST[$paramName])) {
                if ($isFirstParam) {
                    //如果是第一个参数,无需加逗号分割,且要把标志设为false了
                    $isFirstParam = false;
                } else {
                    //如果不是第一个参数,则需要加逗号来分割
                    $sql = $sql . ",";
                }
                $sql = $sql . "fldData" . $i . "=" . $_POST[$paramName];
            }
        }
        if ($isFirstParam) {
            //如果isFirstParam还为真,那么说明data1, data2, ..., data10 一个都没有POST过来
            echo "Error!  At least one paramater (data1-10) must be posted.";
        } else {
            $sql = $sql . ", fldUpdatedBy='webAPI', fldUpdatedOn=datetime('now', 'localtime') WHERE fldNodeID=" . $nodeID;
            //$sql = $sql . ", fldUpdatedBy='robot', fldUpdatedOn=datetime('now', 'localtime') WHERE fldNodeID1=".$nodeID1." AND fldNodeID2=".$nodeID2;
            echo $sql;
            $db = new DBHelper();
            $db->exec($sql);
            // or die("Error: " .sqlite_error_string(sqlite_last_error($conn)));
            $db->close();
            echo "OK";
        }
    }
} else {
    echo "Error, [nodeID] must be set";
}
Exemple #3
0
            echo '<i style="padding-left:30px;" >|_ Update reports in (' . implode(', ', $issue['reports']) . ') with issue id ' . $issueId . ' ... </i>';
            if (DBHelper::updateReportsIssue($issue['reports'], $issueId)) {
                echo '<i>OK</i><br/>';
            } else {
                echo '<i style="color:red" >FAILED</i><br/>';
            }
        } else {
            echo '<i style="color:red" >FAILED</i><br/>';
            echo '<i style="padding-left:30px; color:red; font-weight:bold;" >' . DBHelper::getLastError() . '</i><br/>';
        }
    }
} catch (Exception $e) {
    echo '<b style="padding-left:30px; color:red;" >' . $e->getMessage() . '</b><br/>';
    exit;
}
echo '<b>Step 5.</b> ... OK<br/>';
echo '<b>Step 6.</b> Create database triggers ... ';
$res = DBHelper::exec($sql[1], true);
if ($res != null) {
    echo '<br/><b style="padding-left:30px; color:red;" >' . $res . '</b>';
    exit;
}
DBHelper::clearStoredResults();
// count triggers
$res = DBHelper::countRows('information_schema.triggers', null, true);
if ($res != 4) {
    echo '<b style="color:red" >FAILED</b><br/><b style="padding-left:30px; color:red;" >All triggers not created properly !</b>';
} else {
    echo 'OK<br/>';
}
echo '<p><b style="color:green" >UPDATE IS COMPLETE !</b></p>';