This commit is contained in:
@ -104,10 +104,14 @@ function qdb_save_structure_snapshot(PDO $pdo, string $qnID, int $revision, arra
|
||||
}
|
||||
$pdo->prepare(
|
||||
'INSERT INTO questionnaire_structure_snapshot (questionnaireID, structureRevision, createdAt, manifestJson)
|
||||
VALUES (:qn, :rev, :ts, :mj)
|
||||
ON CONFLICT(questionnaireID, structureRevision) DO UPDATE SET
|
||||
manifestJson = excluded.manifestJson,
|
||||
createdAt = excluded.createdAt'
|
||||
VALUES (:qn, :rev, :ts, :mj) '
|
||||
. qdb_upsert_update(
|
||||
['questionnaireID', 'structureRevision'],
|
||||
[
|
||||
'manifestJson' => 'excluded.manifestJson',
|
||||
'createdAt' => 'excluded.createdAt',
|
||||
]
|
||||
)
|
||||
)->execute([
|
||||
':qn' => $qnID,
|
||||
':rev' => $revision,
|
||||
@ -168,10 +172,7 @@ function qdb_option_has_client_data(PDO $pdo, string $answerOptionID): bool {
|
||||
if ($stmt->fetchColumn()) {
|
||||
return true;
|
||||
}
|
||||
$chk = $pdo->query(
|
||||
"SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'client_answer_submission' LIMIT 1"
|
||||
);
|
||||
if (!$chk || !$chk->fetchColumn()) {
|
||||
if (!qdb_table_exists($pdo, 'client_answer_submission')) {
|
||||
return false;
|
||||
}
|
||||
$stmt = $pdo->prepare(
|
||||
@ -187,10 +188,7 @@ function qdb_question_has_client_data(PDO $pdo, string $questionID): bool {
|
||||
if ($stmt->fetchColumn()) {
|
||||
return true;
|
||||
}
|
||||
$chk = $pdo->query(
|
||||
"SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'client_answer_submission' LIMIT 1"
|
||||
);
|
||||
if (!$chk || !$chk->fetchColumn()) {
|
||||
if (!qdb_table_exists($pdo, 'client_answer_submission')) {
|
||||
return false;
|
||||
}
|
||||
$stmt = $pdo->prepare(
|
||||
|
||||
Reference in New Issue
Block a user