3 #include <grass/dbmi.h>
18 int year, month, day, hour, minute;
47 sprintf(buf,
"%d%c%02d", year, ds, month);
50 sprintf(buf,
"%d%c%02d%c%02d", year, ds, month, ds, day);
53 sprintf(buf,
"%d%c%02d%c%02d %02d", year, ds, month, ds, day, hour);
56 sprintf(buf,
"%d%c%02d%c%02d %02d%c%02d",
57 year, ds, month, ds, day, hour, ts, minute);
61 sprintf(buf,
"%d%c%02d%c%02d %02d%c%02d%c%s%.10g",
62 year, ds, month, ds, day, hour, ts, minute, ts, xs,
73 sprintf(buf,
"%02d%c%02d", month, ds, day);
76 sprintf(buf,
"%02d%c%02d %02d", month, ds, day, hour);
79 sprintf(buf,
"%02d%c%02d %02d%c%02d", month, ds, day, hour, ts, minute);
83 sprintf(buf,
"%02d%c%02d %02d%c%02d%c%s%.10g",
84 month, ds, day, hour, ts, minute, ts, xs, seconds);
94 sprintf(buf,
"%02d %02d", day, hour);
97 sprintf(buf,
"%02d %02d%c%02d", day, hour, ts, minute);
101 sprintf(buf,
"%02d %02d%c%02d%c%s%.10g",
102 day, hour, ts, minute, ts, xs, seconds);
112 sprintf(buf,
"%02d%c%02d", hour, ts, minute);
116 sprintf(buf,
"%02d%c%02d%c%s%.10g", hour, ts, minute, ts, xs,
128 sprintf(buf,
"%02d%c%s%.10g", minute, ts, xs, seconds);
143 case DB_SQL_TYPE_DATE:
144 sprintf(buf,
"%d%c%02d%c%02d", year, ds, month, ds, day);
146 case DB_SQL_TYPE_TIME:
147 sprintf(buf,
"%02d%c%02d%c%s%.10g",
148 hour, ts, minute, ts, xs, seconds);
150 case DB_SQL_TYPE_TIMESTAMP:
151 sprintf(buf,
"%d%c%02d%c%02d %02d%c%02d%c%s%.10g",
152 year, ds, month, ds, day, hour, ts, minute, ts, xs,
186 int year, month, day, hour, minute;
189 year = month = day = 0;
203 sscanf(buf,
"%d", &year);
206 sscanf(buf,
"%d%*c%d", &year, &month);
209 sscanf(buf,
"%d%*c%d%*c%d", &year, &month, &day);
212 sscanf(buf,
"%d%*c%d%*c%d %d", &year, &month, &day, &hour);
215 sscanf(buf,
"%d%*c%d%*c%d %d%*c%d",
216 &year, &month, &day, &hour, &minute);
220 sscanf(buf,
"%d%*c%d%*c%d %d%*c%d%*c%lf",
221 &year, &month, &day, &hour, &minute, &seconds);
228 sscanf(buf,
"%d", &month);
231 sscanf(buf,
"%d%*c%d", &month, &day);
234 sscanf(buf,
"%d%*c%d %d", &month, &day, &hour);
237 sscanf(buf,
"%d%*c%d %d%*c%d", &month, &day, &hour, &minute);
241 sscanf(buf,
"%d%*c%d %d%*c%d%*c%lf",
242 &month, &day, &hour, &minute, &seconds);
249 sscanf(buf,
"%d", &day);
252 sscanf(buf,
"%d %d", &day, &hour);
255 sscanf(buf,
"%d %d%*c%d", &day, &hour, &minute);
259 sscanf(buf,
"%d %d%*c%d%*c%lf", &day, &hour, &minute, &seconds);
266 sscanf(buf,
"%d", &hour);
269 sscanf(buf,
"%d%*c%d", &hour, &minute);
273 sscanf(buf,
"%d%*c%d%*c%lf", &hour, &minute, &seconds);
280 sscanf(buf,
"%d", &minute);
284 sscanf(buf,
"%d%*c%lf", &minute, &seconds);
290 sscanf(buf,
"%lf", &seconds);
294 case DB_SQL_TYPE_DATE:
295 sscanf(buf,
"%d%*c%d%*c%d", &year, &month, &day);
297 case DB_SQL_TYPE_TIME:
298 sscanf(buf,
"%d%*c%d%*c%lf", &hour, &minute, &seconds);
300 case DB_SQL_TYPE_TIMESTAMP:
301 sscanf(buf,
"%d%*c%d%*c%d %d%*c%d%*c%lf",
302 &year, &month, &day, &hour, &minute, &seconds);
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
void db_set_value_year(dbValue *value, int year)
int db_get_value_day(dbValue *value)
int db_get_value_month(dbValue *value)
void db_set_value_month(dbValue *value, int month)
int db_test_value_datetime_current(dbValue *value)
int db_get_value_minute(dbValue *value)
void db_set_value_seconds(dbValue *value, double seconds)
int db_convert_value_datetime_into_string(dbValue *value, int sqltype, dbString *string)
int db_nocase_compare(const char *a, const char *b)
void db_set_value_day(dbValue *value, int day)
double db_get_value_seconds(dbValue *value)
void db_set_value_minute(dbValue *value, int minute)
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int db_get_value_hour(dbValue *value)
int db_get_value_year(dbValue *value)
void db_interval_range(int sqltype, int *from, int *to)
int db_set_string(dbString *x, const char *s)
void db_set_value_hour(dbValue *value, int hour)
void db_set_value_datetime_current(dbValue *value)
int db_convert_Cstring_to_value_datetime(const char *buf, int sqltype, dbValue *value)