Revision f12fdfae include/LogDB.h
include/LogDB.h | ||
---|---|---|
65 | 65 |
/** |
66 | 66 |
* SQL callback to load logDBRecord from DB (SELECT commands) |
67 | 67 |
*/ |
68 |
int select_cb(void *nil, int num, char **values, char **names) |
|
69 |
{ |
|
70 |
if ( !values || !values[0] || !values[1] || !values[2] || !values[3] || |
|
71 |
!values[4] || !values[5] || num != 6 ) |
|
72 |
{ |
|
73 |
return -1; |
|
74 |
} |
|
75 |
|
|
76 |
index = static_cast<unsigned int>(atoi(values[0])); |
|
77 |
term = static_cast<unsigned int>(atoi(values[1])); |
|
78 |
sql = values[2]; |
|
79 |
|
|
80 |
timestamp = static_cast<unsigned int>(atoi(values[3])); |
|
81 |
|
|
82 |
prev_index = static_cast<unsigned int>(atoi(values[4])); |
|
83 |
prev_term = static_cast<unsigned int>(atoi(values[5])); |
|
84 |
|
|
85 |
return 0; |
|
86 |
} |
|
68 |
int select_cb(void *nil, int num, char **values, char **names); |
|
87 | 69 |
}; |
88 | 70 |
|
89 | 71 |
/** |
... | ... | |
112 | 94 |
/** |
113 | 95 |
* Applies the SQL command of the given record to the database. The |
114 | 96 |
* timestamp of the record is updated. |
115 |
* @param lr the log record |
|
116 | 97 |
* @param index of the log record |
117 | 98 |
*/ |
118 |
int apply_log_record(LogDBRecord * lr); |
|
119 |
|
|
120 | 99 |
int apply_log_records(unsigned int commit_index); |
121 | 100 |
|
122 | 101 |
/** |
... | ... | |
279 | 258 |
static const char * db_bootstrap; |
280 | 259 |
|
281 | 260 |
/** |
261 |
* Applies the SQL command of the given record to the database. The |
|
262 |
* timestamp of the record is updated. |
|
263 |
* @param lr the log record |
|
264 |
*/ |
|
265 |
int apply_log_record(LogDBRecord * lr); |
|
266 |
|
|
267 |
/** |
|
282 | 268 |
* Inserts or update a log record in the database |
283 | 269 |
* @param index of the log entry |
284 | 270 |
* @param term for the log entry |
Also available in: Unified diff