renaming of sql methods to fit getRows/getEntities model

This commit is contained in:
azivner
2018-01-29 17:41:59 -05:00
parent 9b53a17168
commit b44412bc32
32 changed files with 134 additions and 123 deletions

View File

@@ -10,7 +10,7 @@ async function getNoteAttributeMap(noteId) {
}
async function getNoteIdWithAttribute(name, value) {
return await sql.getFirstValue(`SELECT notes.noteId FROM notes JOIN attributes USING(noteId)
return await sql.getValue(`SELECT notes.noteId FROM notes JOIN attributes USING(noteId)
WHERE notes.isDeleted = 0 AND attributes.name = ? AND attributes.value = ?`, [name, value]);
}
@@ -18,11 +18,11 @@ async function getNotesWithAttribute(dataKey, name, value) {
let notes;
if (value !== undefined) {
notes = await sql.getAll(`SELECT notes.* FROM notes JOIN attributes USING(noteId)
notes = await sql.getRows(`SELECT notes.* FROM notes JOIN attributes USING(noteId)
WHERE notes.isDeleted = 0 AND attributes.name = ? AND attributes.value = ?`, [name, value]);
}
else {
notes = await sql.getAll(`SELECT notes.* FROM notes JOIN attributes USING(noteId)
notes = await sql.getRows(`SELECT notes.* FROM notes JOIN attributes USING(noteId)
WHERE notes.isDeleted = 0 AND attributes.name = ?`, [name]);
}
@@ -40,7 +40,7 @@ async function getNoteWithAttribute(dataKey, name, value) {
}
async function getNoteIdsWithAttribute(name) {
return await sql.getFirstColumn(`SELECT DISTINCT notes.noteId FROM notes JOIN attributes USING(noteId)
return await sql.getColumn(`SELECT DISTINCT notes.noteId FROM notes JOIN attributes USING(noteId)
WHERE notes.isDeleted = 0 AND attributes.name = ?`, [name]);
}