New requestData parameter 'afterTime'
- if afterTime parameter is passed in request, any data changed (tag, note) after given time is returned. (afterTime also combines with other condition parameters). - Request data now return all columns from the table
This commit is contained in:
parent
52571ccf8b
commit
fbd515137b
@ -289,6 +289,8 @@ function Database(user, password, dbname, host = 'localhost') {
|
||||
else if (request.upperVectorClock)
|
||||
conditionArr.push(`${H_struct.VECTOR_CLOCK} <= '${request.upperVectorClock}'`);
|
||||
}
|
||||
if (request.afterTime)
|
||||
conditionArr.push(`${L_struct.LOG_TIME} > ${request.afterTime}`);
|
||||
conditionArr.push(`${H_struct.APPLICATION} = '${request.application}'`);
|
||||
conditionArr.push(`${H_struct.RECEIVER_ID} = '${request.receiverID}'`)
|
||||
if (request.comment)
|
||||
@ -302,9 +304,9 @@ function Database(user, password, dbname, host = 'localhost') {
|
||||
conditionArr.push(`${H_struct.SENDER_ID} = '${request.senderID}'`);
|
||||
};
|
||||
//console.log(conditionArr);
|
||||
let attr = Object.keys(H_struct).map(a => H_struct[a]).concat(Object.keys(B_struct).map(a => B_struct[a]));
|
||||
let statement = "SELECT " + attr.join(", ") +
|
||||
" FROM _" + snID +
|
||||
//let attr = Object.keys(H_struct).map(a => H_struct[a]).concat(Object.keys(B_struct).map(a => B_struct[a]));
|
||||
//let statement = "SELECT " + attr.join(", ") + " FROM _" + snID +
|
||||
let statement = "SELECT * FROM _" + snID +
|
||||
" WHERE " + conditionArr.join(" AND ") +
|
||||
(request.mostRecent ? " LIMIT 1" : (" ORDER BY " + H_struct.VECTOR_CLOCK));
|
||||
db.query(statement)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user