Find a shared notebook LID by its GUID
| 421 | |
| 422 | // Find a shared notebook LID by its GUID |
| 423 | qint32 SharedNotebookTable::findByNotebookGuid(QString id) { |
| 424 | NSqlQuery query(db); |
| 425 | db->lockForRead(); |
| 426 | query.prepare("Select lid from DataStore where key=:key and data=:id"); |
| 427 | query.bindValue(":key", SHAREDNOTEBOOK_NOTEBOOK_GUID); |
| 428 | query.bindValue(":id", id); |
| 429 | query.exec(); |
| 430 | while (query.next()) { |
| 431 | qint32 retval = query.value(0).toInt(); |
| 432 | query.finish(); |
| 433 | db->unlock(); |
| 434 | return retval; |
| 435 | } |
| 436 | query.finish(); |
| 437 | db->unlock(); |
| 438 | NotebookTable ntable(db); |
| 439 | return ntable.getLid(id); |
| 440 | } |
| 441 | |
| 442 | |
| 443 | // Find a shared notebook by the GUID |