51 #define MIN(x, y) ((x) < (y) ? (x) : (y))
52 #define MAX(x, y) ((x) > (y) ? (x) : (y))
169 status =
DbString(row, field_index, &buffer);
174 if (buffer != NULL) {
232 status =
DbString(row, field_index, &buffer);
237 if (buffer != NULL) {
300 if (status == SQLITE_OK) {
307 status =
DbInt(row, 0, value);
367 status =
DbString(row, field_index, &data);
407 return sqlite3_errcode((sqlite3*) handle);
430 return sqlite3_errmsg((sqlite3*) handle);
468 *
id = (
DB_ID) sqlite3_last_insert_rowid((sqlite3*) handle);
512 sqlite3_snprintf(buflen, buffer,
"%q", in);
514 return ( strlen(buffer) == 0 ) ? 1 : 0;
545 int DbDateDiff(
const char* start,
int delta,
int sign,
char* buffer,
size_t buflen)
554 nchar = snprintf(buffer, buflen,
555 "DATETIME('%s', '+%d SECONDS')", start, delta);
557 else if (sign == -1) {
558 nchar = snprintf(buffer, buflen,
559 "DATETIME('%s', '-%d SECONDS')", start, delta);
565 if (nchar >= (
int)buflen || nchar < 0) {