private final ApplicationLogger logger;\r
DatabaseConnection db;\r
private final String dbName;\r
+ NSqlQuery notebookCountQuery;\r
\r
// Constructor\r
public NotebookTable(ApplicationLogger l, DatabaseConnection d) {\r
"published=:published, isDirty=:isDirty, publishinguri=:uri, "+\r
"publishingOrder=:order, " + \r
"publishingAscending=:ascending, " +\r
- "publishingPublicDescription=:desc " +\r
+ "publishingPublicDescription=:desc, " +\r
+ "stack=:stack " +\r
"where guid=:guid ");\r
\r
query.bindValue(":sequence", tempNotebook.getUpdateSequenceNum());\r
}\r
\r
query.bindValue(":guid", tempNotebook.getGuid());\r
+ query.bindValue(":stack", tempNotebook.getStack());\r
\r
check = query.exec();\r
if (!check) {\r
// Get a note tag counts\r
public List<Pair<String,Integer>> getNotebookCounts() {\r
List<Pair<String,Integer>> counts = new ArrayList<Pair<String,Integer>>(); \r
- NSqlQuery query = new NSqlQuery(db.getConnection());\r
- if (!query.exec("select notebookGuid, count(guid) from note where active=1 group by notebookguid;")) {\r
+ if (notebookCountQuery == null) {\r
+ notebookCountQuery = new NSqlQuery(db.getConnection());\r
+ notebookCountQuery.prepare("select notebookGuid, count(guid) from note where active=1 group by notebookguid;");\r
+ }\r
+ if (!notebookCountQuery.exec()) {\r
logger.log(logger.EXTREME, "NoteTags SQL getTagCounts has failed.");\r
- logger.log(logger.MEDIUM, query.lastError());\r
+ logger.log(logger.MEDIUM, notebookCountQuery.lastError());\r
return null;\r
}\r
- while (query.next()) {\r
+ while (notebookCountQuery.next()) {\r
Pair<String,Integer> newCount = new Pair<String,Integer>();\r
- newCount.setFirst(query.valueString(0));\r
- newCount.setSecond(query.valueInteger(1));\r
+ newCount.setFirst(notebookCountQuery.valueString(0));\r
+ newCount.setSecond(notebookCountQuery.valueInteger(1));\r
counts.add(newCount);\r
} \r
return counts;\r