35 int year, month, day, hour, minute;
61 sprintf(buf,
"%d", year);
64 sprintf(buf,
"%d%c%02d", year, ds, month);
67 sprintf(buf,
"%d%c%02d%c%02d", year, ds, month, ds, day);
70 sprintf(buf,
"%d%c%02d%c%02d %02d", year, ds, month, ds, day, hour);
73 sprintf(buf,
"%d%c%02d%c%02d %02d%c%02d",
74 year, ds, month, ds, day, hour, ts, minute);
78 sprintf(buf,
"%d%c%02d%c%02d %02d%c%02d%c%s%.10g",
79 year, ds, month, ds, day, hour, ts, minute, ts, xs,
87 sprintf(buf,
"%d", month);
90 sprintf(buf,
"%02d%c%02d", month, ds, day);
93 sprintf(buf,
"%02d%c%02d %02d", month, ds, day, hour);
96 sprintf(buf,
"%02d%c%02d %02d%c%02d", month, ds, day, hour, ts, minute);
100 sprintf(buf,
"%02d%c%02d %02d%c%02d%c%s%.10g",
101 month, ds, day, hour, ts, minute, ts, xs, seconds);
108 sprintf(buf,
"%02d", day);
111 sprintf(buf,
"%02d %02d", day, hour);
114 sprintf(buf,
"%02d %02d%c%02d", day, hour, ts, minute);
118 sprintf(buf,
"%02d %02d%c%02d%c%s%.10g",
119 day, hour, ts, minute, ts, xs, seconds);
126 sprintf(buf,
"%02d", hour);
129 sprintf(buf,
"%02d%c%02d", hour, ts, minute);
133 sprintf(buf,
"%02d%c%02d%c%s%.10g", hour, ts, minute, ts, xs,
141 sprintf(buf,
"%02d", minute);
145 sprintf(buf,
"%02d%c%s%.10g", minute, ts, xs, seconds);
154 sprintf(buf,
"%g", seconds);
161 sprintf(buf,
"%d%c%02d%c%02d", year, ds, month, ds, day);
164 sprintf(buf,
"%02d%c%02d%c%s%.10g",
165 hour, ts, minute, ts, xs, seconds);
168 sprintf(buf,
"%d%c%02d%c%02d %02d%c%02d%c%s%.10g",
169 year, ds, month, ds, day, hour, ts, minute, ts, xs,
201 int year, month, day, hour, minute;
204 year = month = day = 0;
218 sscanf(buf,
"%d", &year);
221 sscanf(buf,
"%d%*c%d", &year, &month);
224 sscanf(buf,
"%d%*c%d%*c%d", &year, &month, &day);
227 sscanf(buf,
"%d%*c%d%*c%d %d", &year, &month, &day, &hour);
230 sscanf(buf,
"%d%*c%d%*c%d %d%*c%d",
231 &year, &month, &day, &hour, &minute);
235 sscanf(buf,
"%d%*c%d%*c%d %d%*c%d%*c%lf",
236 &year, &month, &day, &hour, &minute, &seconds);
243 sscanf(buf,
"%d", &month);
246 sscanf(buf,
"%d%*c%d", &month, &day);
249 sscanf(buf,
"%d%*c%d %d", &month, &day, &hour);
252 sscanf(buf,
"%d%*c%d %d%*c%d", &month, &day, &hour, &minute);
256 sscanf(buf,
"%d%*c%d %d%*c%d%*c%lf",
257 &month, &day, &hour, &minute, &seconds);
264 sscanf(buf,
"%d", &day);
267 sscanf(buf,
"%d %d", &day, &hour);
270 sscanf(buf,
"%d %d%*c%d", &day, &hour, &minute);
274 sscanf(buf,
"%d %d%*c%d%*c%lf", &day, &hour, &minute, &seconds);
281 sscanf(buf,
"%d", &hour);
284 sscanf(buf,
"%d%*c%d", &hour, &minute);
288 sscanf(buf,
"%d%*c%d%*c%lf", &hour, &minute, &seconds);
295 sscanf(buf,
"%d", &minute);
299 sscanf(buf,
"%d%*c%lf", &minute, &seconds);
305 sscanf(buf,
"%lf", &seconds);
310 sscanf(buf,
"%d%*c%d%*c%d", &year, &month, &day);
313 sscanf(buf,
"%d%*c%d%*c%lf", &hour, &minute, &seconds);
316 sscanf(buf,
"%d%*c%d%*c%d %d%*c%d%*c%lf",
317 &year, &month, &day, &hour, &minute, &seconds);
#define DB_SQL_TYPE_TIMESTAMP
void db_set_value_hour(dbValue *, int)
Set hour value.
void db_set_value_day(dbValue *, int)
Set day value.
int db_get_value_hour(dbValue *)
Get hour value.
int db_get_value_minute(dbValue *)
Get minute value.
int db_set_string(dbString *, const char *)
Inserts string to dbString (enlarge string)
int db_convert_value_datetime_into_string(dbValue *value, int sqltype, dbString *string)
Convert datetime value into string.
int db_test_value_datetime_current(dbValue *)
Check if datatime is current.
void db_set_value_datetime_current(dbValue *)
Set datetime to current.
void db_set_value_minute(dbValue *, int)
Set minute value.
void db_set_value_month(dbValue *, int)
Set month value.
void db_set_value_seconds(dbValue *, double)
Set seconds value.
double db_get_value_seconds(dbValue *)
Get seconds value.
int db_get_value_year(dbValue *)
Get year value.
void db_set_value_year(dbValue *, int)
Set year value.
int db_nocase_compare(const char *, const char *)
Compare strings case-insensitive.
void db_interval_range(int, int *, int *)
Define range based on SQL data type.
int db_get_value_day(dbValue *)
Get day value.
int db_get_value_month(dbValue *)
Get month value.
int db_convert_Cstring_to_value_datetime(const char *buf, int sqltype, dbValue *value)
Convert datetime string to value.