49 #define MIN(x, y) ((x) < (y) ? (x) : (y))
50 #define MAX(x, y) ((x) > (y) ? (x) : (y))
167 status =
DbString(row, field_index, &buffer);
172 if (buffer != NULL) {
230 status =
DbString(row, field_index, &buffer);
235 if (buffer != NULL) {
298 if (status == SQLITE_OK) {
305 status =
DbInt(row, 0, value);
365 status =
DbString(row, field_index, &data);
405 return sqlite3_errcode((sqlite3*) handle);
428 return sqlite3_errmsg((sqlite3*) handle);
466 *
id = (
DB_ID) sqlite3_last_insert_rowid((sqlite3*) handle);
510 sqlite3_snprintf(buflen, buffer,
"%q", in);
512 return ( strlen(buffer) == 0 ) ? 1 : 0;
543 int DbDateDiff(
const char* start,
int delta,
int sign,
char* buffer,
size_t buflen)
552 nchar = snprintf(buffer, buflen,
553 "DATETIME('%s', '+%d SECONDS')", start, delta);
555 else if (sign == -1) {
556 nchar = snprintf(buffer, buflen,
557 "DATETIME('%s', '-%d SECONDS')", start, delta);
563 if (nchar >= (
int)buflen || nchar < 0) {