本文整理汇总了PHP中qnum函数的典型用法代码示例。如果您正苦于以下问题:PHP qnum函数的具体用法?PHP qnum怎么用?PHP qnum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qnum函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetText
function SetText($text)
{
if ($this->ProjectId == -1) {
echo "Banner::SetText(): no ProjectId specified";
return false;
}
$this->Text = pdo_real_escape_string($text);
// Check if the project is already
if ($this->Exists()) {
// Update the project
$query = "UPDATE banner SET";
$query .= " text='" . $this->Text . "'";
$query .= " WHERE projectid='" . $this->ProjectId . "'";
if (!pdo_query($query)) {
add_last_sql_error("Banner:SetText", $this->ProjectId);
echo $query;
return false;
}
} else {
$query = "INSERT INTO banner (projectid,text)\n VALUES (" . qnum($this->ProjectId) . ",'" . $this->Text . "')";
if (!pdo_query($query)) {
add_last_sql_error("Banner:SetText", $this->ProjectId);
echo $query;
return false;
}
}
return true;
}
示例2: GetNumberOfFailures
/** Get the number of tests that are failing */
function GetNumberOfFailures($checktesttiming, $testtimemaxstatus)
{
if (!$this->BuildId) {
echo "BuildTest::GetNumberOfFailures(): BuildId not set";
return false;
}
$sql = "SELECT testfailed,testnotrun,testtimestatusfailed FROM build WHERE id=" . qnum($this->BuildId);
$query = pdo_query($sql);
if (!$query) {
add_last_sql_error("BuildTest:GetNumberOfFailures", 0, $this->BuildId);
return false;
}
$nfail_array = pdo_fetch_array($query);
$sumerrors = 0;
if ($nfail_array['testfailed'] > 0) {
$sumerrors += $nfail_array['testfailed'];
}
if ($nfail_array['testnotrun'] > 0) {
$sumerrors += $nfail_array['testnotrun'];
}
// Find if the build has any test failings
if ($checktesttiming) {
if ($nfail_array['testtimestatusfailed'] > 0) {
$sumerrors += $nfail_array['testtimestatusfailed'];
}
}
return $sumerrors;
}
示例3: Insert
/** Update the content of the file */
function Insert()
{
if (!$this->BuildId || !is_numeric($this->BuildId)) {
add_log("BuildId not set", "CoverageFileLog::Insert()", LOG_ERR, 0, $this->BuildId, CDASH_OBJECT_COVERAGE, $this->FileId);
return false;
}
if (!$this->FileId || !is_numeric($this->FileId)) {
add_log("FileId not set", "CoverageFileLog::Insert()", LOG_ERR, 0, $this->BuildId, CDASH_OBJECT_COVERAGE, $this->FileId);
return false;
}
$log = '';
foreach ($this->Lines as $lineNumber => $code) {
$log .= $lineNumber . ':' . $code . ';';
}
foreach ($this->Branches as $lineNumber => $code) {
$log .= 'b' . $lineNumber . ':' . $code . ';';
}
if ($log != '') {
$sql = "INSERT INTO coveragefilelog (buildid,fileid,log) VALUES ";
$sql .= "(" . qnum($this->BuildId) . "," . qnum($this->FileId) . ",'" . $log . "')";
pdo_query($sql);
add_last_sql_error("CoverageFileLog::Insert()");
}
return true;
}
示例4: Save
/** Save in the database */
function Save()
{
if (!$this->BuildId) {
echo "BuildConfigureErrorDiff::Save(): BuildId not set";
return false;
}
if ($this->Exists()) {
// Update
$query = "UPDATE configureerrordiff SET";
$query .= " type=" . qnum($this->Type);
$query .= ",difference=" . qnum($this->Difference);
$query .= " WHERE buildid=" . qnum($this->BuildId);
if (!pdo_query($query)) {
add_last_sql_error("BuildConfigureErrorDiff:Update", 0, $this->BuildId);
return false;
}
} else {
$query = "INSERT INTO configureerrordiff (buildid,type,difference)\n VALUES (" . qnum($this->BuildId) . "," . qnum($this->Type) . "," . qnum($this->Difference) . ")";
if (!pdo_query($query)) {
add_last_sql_error("BuildConfigureErrorDiff:Create", 0, $this->BuildId);
return false;
}
}
return true;
}
示例5: GetAuthors
/** Get all the authors of a file */
public function GetAuthors($filename, $onlylast = false)
{
if (!$this->ProjectId) {
echo 'DailyUpdate::GetAuthors(): ProjectId is not set<br>';
return false;
}
// Check if the note already exists
$filename = pdo_real_escape_string($filename);
// Remove
if (substr($filename, 0, 2) == './') {
$filename = substr($filename, 2);
}
$sql = '';
if ($onlylast) {
$sql = ' ORDER BY dailyupdate.id DESC LIMIT 1';
}
$query = pdo_query('SELECT DISTINCT up.userid,dailyupdate.id FROM user2project AS up,user2repository AS ur,dailyupdatefile,dailyupdate
WHERE dailyupdatefile.dailyupdateid=dailyupdate.id
AND dailyupdate.projectid=up.projectid
AND ur.credential=dailyupdatefile.author
AND up.projectid=' . qnum($this->ProjectId) . '
AND up.userid=ur.userid
AND (ur.projectid=0 OR ur.projectid=' . qnum($this->ProjectId) . ")\n AND dailyupdatefile.filename LIKE '%" . $filename . "'" . $sql);
if (!$query) {
add_last_sql_error('DailyUpdate GetAuthors', $this->ProjectId);
return false;
}
$authorids = array();
while ($query_array = pdo_fetch_array($query)) {
$authorids[] = $query_array['userid'];
}
return $authorids;
}
示例6: Save
/** Save in the database */
public function Save()
{
if (!$this->BuildId) {
echo 'BuildConfigureErrorDiff::Save(): BuildId not set';
return false;
}
if ($this->Exists()) {
// Update
$query = 'UPDATE configureerrordiff SET';
$query .= ' type=' . qnum($this->Type);
$query .= ',difference=' . qnum($this->Difference);
$query .= ' WHERE buildid=' . qnum($this->BuildId);
if (!pdo_query($query)) {
add_last_sql_error('BuildConfigureErrorDiff:Update', 0, $this->BuildId);
return false;
}
} else {
// insert
$query = 'INSERT INTO configureerrordiff (buildid,type,difference)
VALUES (' . qnum($this->BuildId) . ',' . qnum($this->Type) . ',' . qnum($this->Difference) . ')';
if (!pdo_query($query)) {
add_last_sql_error('BuildConfigureErrorDiff:Create', 0, $this->BuildId);
return false;
}
}
return true;
}
示例7: removeFirstBuilds
/** Remove the first builds that are at the beginning of the queue */
function removeFirstBuilds($projectid, $days, $maxbuilds, $force = false)
{
require 'config/config.php';
require_once 'include/pdo.php';
require_once 'include/common.php';
@set_time_limit(0);
if (!$force && !isset($CDASH_AUTOREMOVE_BUILDS)) {
return;
}
if (!$force && $CDASH_AUTOREMOVE_BUILDS != '1') {
return;
}
if ($days < 2) {
return;
}
// First remove the builds with the wrong date
$currentdate = time() - 3600 * 24 * $days;
$startdate = date(FMT_DATETIME, $currentdate);
add_log('about to query for builds to remove', 'removeFirstBuilds');
$builds = pdo_query("SELECT id FROM build\n WHERE parentid IN (0, -1) AND\n starttime<'{$startdate}' AND\n projectid=" . qnum($projectid) . "\n ORDER BY starttime ASC LIMIT {$maxbuilds}");
add_last_sql_error('dailyupdates::removeFirstBuilds');
$buildids = array();
while ($builds_array = pdo_fetch_array($builds)) {
$buildids[] = $builds_array['id'];
}
$s = 'removing old buildids for projectid: ' . $projectid;
add_log($s, 'removeFirstBuilds');
echo ' -- ' . $s . "\n";
// for "interactive" command line feedback
remove_build($buildids);
// Remove any job schedules that are older than our cutoff date
// and not due to repeat again.
require_once 'models/constants.php';
require_once 'models/clientjobschedule.php';
$sql = 'SELECT scheduleid FROM client_job AS cj
LEFT JOIN client_jobschedule AS cjs ON cj.scheduleid = cjs.id
WHERE cj.status > ' . CDASH_JOB_RUNNING . "\n AND cjs.projectid={$projectid} AND cj.startdate < '{$startdate}'\n AND (cjs.repeattime = 0.00 OR\n (cjs.enddate < '{$startdate}' AND cjs.enddate != '1980-01-01 00:00:00'))";
$job_schedules = pdo_query($sql);
while ($job_schedule = pdo_fetch_array($job_schedules)) {
$ClientJobSchedule = new ClientJobSchedule();
$ClientJobSchedule->Id = $job_schedule['scheduleid'];
$ClientJobSchedule->Remove();
}
// Remove any jobs that are older than our cutoff date.
// This occurs when a job schedule is set to continue repeating, but
// some of its past runs are older than our autoremove threshold.
require_once 'models/clientjob.php';
$sql = 'SELECT cj.id FROM client_job AS cj
LEFT JOIN client_jobschedule AS cjs ON cj.scheduleid = cjs.id
WHERE cj.status > ' . CDASH_JOB_RUNNING . "\n AND cjs.projectid={$projectid} AND cj.startdate < '{$startdate}'";
$jobs = pdo_query($sql);
while ($job = pdo_fetch_array($jobs)) {
$ClientJob = new ClientJob();
$ClientJob->Id = $job['id'];
$ClientJob->Remove();
}
}
示例8: GetVersion
/** Get version */
function GetVersion()
{
if (!$this->Id) {
add_log("ClientOS::GetVersion()", "Id not set");
return;
}
$name = pdo_query("SELECT version FROM client_os WHERE id=" . qnum($this->Id));
$row = pdo_fetch_array($name);
return $row[0];
}
示例9: GetVersion
/** Get version */
public function GetVersion()
{
if (!$this->Id) {
add_log('ClientOS::GetVersion()', 'Id not set');
return;
}
$name = pdo_query('SELECT version FROM client_os WHERE id=' . qnum($this->Id));
$row = pdo_fetch_array($name);
return $row[0];
}
示例10: Exists
/** Return whether or not a CoverageSummaryDiff exists for this build. */
public function Exists()
{
if (!$this->BuildId) {
return false;
}
$exists_result = pdo_single_row_query('SELECT COUNT(1) AS numrows FROM coveragesummarydiff
WHERE buildid=' . qnum($this->BuildId));
if ($exists_result && array_key_exists('numrows', $exists_result)) {
$numrows = $exists_result['numrows'];
if ($numrows > 0) {
return true;
}
}
return false;
}
示例11: Save
/** Save the site information */
function Save()
{
if ($this->OSName != "" || $this->OSPlatform != "" || $this->OSRelease != "" || $this->OSVersion != "") {
if (empty($this->BuildId)) {
return false;
}
// Check if we already have a buildinformation for that build. If yes we just skip it
$query = pdo_query("SELECT buildid FROM buildinformation WHERE buildid=" . qnum($this->BuildId));
add_last_sql_error("BuildInformation Insert", 0, $this->BuildId);
if (pdo_num_rows($query) == 0) {
pdo_query("INSERT INTO buildinformation (buildid,osname,osrelease,osversion,osplatform,compilername,compilerversion) \n VALUES (" . qnum($this->BuildId) . ",'{$this->OSName}','{$this->OSRelease}',\n '{$this->OSVersion}','{$this->OSPlatform}','{$this->CompilerName}','{$this->CompilerVersion}')");
add_last_sql_error("BuildInformation Insert", 0, $this->BuildId);
}
return true;
}
}
示例12: Insert
function Insert()
{
if (strlen($this->DynamicAnalysisId) == 0) {
echo "DynamicAnalysisDefect::Insert DynamicAnalysisId not set";
return false;
}
$this->Type = pdo_real_escape_string($this->Type);
$this->Value = pdo_real_escape_string($this->Value);
$this->DynamicAnalysisId = pdo_real_escape_string($this->DynamicAnalysisId);
$query = "INSERT INTO dynamicanalysisdefect (dynamicanalysisid,type,value)\n VALUES (" . qnum($this->DynamicAnalysisId) . ",'{$this->Type}','{$this->Value}')";
if (!pdo_query($query)) {
add_last_sql_error("DynamicAnalysisDefect Insert");
return false;
}
return true;
}
示例13: Insert
public function Insert()
{
if (strlen($this->UpdateId) == 0) {
echo 'BuildUpdateFile:Insert UpdateId not set';
return false;
}
$this->Filename = pdo_real_escape_string($this->Filename);
// Sometimes the checkin date is not found in that case we put the usual date
if ($this->CheckinDate == 'Unknown') {
$this->CheckinDate = '1980-01-01';
}
if (strtotime($this->CheckinDate) === false && is_numeric($this->CheckinDate)) {
$this->CheckinDate = date(FMT_DATETIME, $this->CheckinDate);
} elseif (strtotime($this->CheckinDate) !== false) {
$this->CheckinDate = date(FMT_DATETIME, strtotime($this->CheckinDate));
} else {
$this->CheckinDate = '1980-01-01';
}
$this->Author = pdo_real_escape_string($this->Author);
$this->UpdateId = pdo_real_escape_string($this->UpdateId);
// Check if we have a robot file for this build
$robot = pdo_query('SELECT authorregex FROM projectrobot,build,build2update
WHERE projectrobot.projectid=build.projectid
AND build2update.buildid=build.id
AND build2update.updateid=' . qnum($this->UpdateId) . " AND robotname='" . $this->Author . "'");
if (pdo_num_rows($robot) > 0) {
$robot_array = pdo_fetch_array($robot);
$regex = $robot_array['authorregex'];
preg_match($regex, $this->Log, $matches);
if (isset($matches[1])) {
$this->Author = $matches[1];
}
}
$this->Email = pdo_real_escape_string($this->Email);
$this->Committer = pdo_real_escape_string($this->Committer);
$this->CommitterEmail = pdo_real_escape_string($this->CommitterEmail);
$this->Log = pdo_real_escape_string($this->Log);
$this->Revision = pdo_real_escape_string($this->Revision);
$this->PriorRevision = pdo_real_escape_string($this->PriorRevision);
$query = 'INSERT INTO updatefile (updateid,filename,checkindate,author,email,log,revision,priorrevision,status,committer,committeremail)
VALUES (' . qnum($this->UpdateId) . ",'{$this->Filename}','{$this->CheckinDate}','{$this->Author}','{$this->Email}',\n '{$this->Log}','{$this->Revision}','{$this->PriorRevision}','{$this->Status}','{$this->Committer}','{$this->CommitterEmail}')";
if (!pdo_query($query)) {
add_last_sql_error('BuildUpdateFile Insert', 0, $this->UpdateId);
return false;
}
}
示例14: GetFiles
/** Return the name of a build */
function GetFiles()
{
if (!$this->BuildId) {
echo "Coverage GetFiles(): BuildId not set";
return false;
}
$fileids = array();
$coverage = pdo_query("SELECT fileid FROM coverage WHERE buildid=" . qnum($this->BuildId));
if (!$coverage) {
add_last_sql_error("Coverage GetFiles");
return false;
}
while ($coverage_array = pdo_fetch_array($coverage)) {
$fileids[] = $coverage_array['fileid'];
}
return $fileids;
}
示例15: Insert
public function Insert()
{
if (!$this->BuildId) {
echo 'BuildError::Insert(): BuildId not set<br>';
return false;
}
$text = pdo_real_escape_string($this->Text);
if (strlen($this->PreContext) == 0) {
$precontext = 'NULL';
} else {
$precontext = "'" . pdo_real_escape_string($this->PreContext) . "'";
}
if (strlen($this->PostContext) == 0) {
$postcontext = 'NULL';
} else {
$postcontext = "'" . pdo_real_escape_string($this->PostContext) . "'";
}
if (empty($this->SourceLine)) {
$this->SourceLine = 0;
}
if (empty($this->RepeatCount)) {
$this->RepeatCount = 0;
}
$crc32 = 0;
// Compute the crc32
if ($this->SourceLine == 0) {
$crc32 = crc32($text);
// no need for precontext or postcontext, this doesn't work for parallel build
} else {
$crc32 = crc32($text . $this->SourceFile . $this->SourceLine);
// some warning can be on the same line
}
$query = 'INSERT INTO builderror (buildid,type,logline,text,sourcefile,sourceline,precontext,
postcontext,repeatcount,newstatus,crc32)
VALUES (' . qnum($this->BuildId) . ',' . qnum($this->Type) . ',' . qnum($this->LogLine) . ",'{$text}','{$this->SourceFile}'," . qnum($this->SourceLine) . ',
' . $precontext . ',' . $postcontext . ',' . qnum($this->RepeatCount) . ',0,' . qnum($crc32) . ')';
if (!pdo_query($query)) {
add_last_sql_error('BuildError Insert', 0, $this->BuildId);
return false;
}
return true;
}