Skip to content

Commit

Permalink
- Fixed API query
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonHanley committed May 16, 2011
1 parent 0a9ec18 commit 20714a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ function logAction($version, $type, $attrs) {
$lastWriteServer = $user['last_write'];

// Retrieve ids and mod times for docs modified before local was last updated
$sth = $dbh->prepare('SELECT doc_id,last_write FROM docs WHERE last_write <= ?');
$sth->execute(array($localLastWrite));
$sth = $dbh->prepare('SELECT doc_id,last_write FROM docs WHERE last_write <= ? AND user_id=?');
$sth->execute(array($localLastWrite, $user_id));
$oldDocs = $sth->fetchAll(PDO::FETCH_ASSOC);

// Retrieve all documents modified since local was last updated
$sth = $dbh->prepare('SELECT * FROM docs WHERE last_write > ?');
$sth->execute(array($localLastWrite));
$sth = $dbh->prepare('SELECT * FROM docs WHERE last_write > ? AND user_id=?');
$sth->execute(array($localLastWrite, $user_id));
$newDocs = $sth->fetchAll(PDO::FETCH_ASSOC);
} else {
$ret['error'] = 'User not found.';
Expand Down

0 comments on commit 20714a9

Please sign in to comment.