GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
interval.c
Go to the documentation of this file.
1 #include <grass/dbmi.h>
2 
9 void db_interval_range(int sqltype, int *from, int *to)
10 {
11  switch (sqltype) {
12  case DB_SQL_TYPE_DATE:
13  *from = DB_YEAR;
14  *to = DB_DAY;
15  return;
16  case DB_SQL_TYPE_TIME:
17  *from = DB_HOUR;
18  *to = DB_FRACTION;
19  return;
20  }
21 
22  if (sqltype & DB_YEAR)
23  *from = DB_YEAR;
24  else if (sqltype & DB_MONTH)
25  *from = DB_MONTH;
26  else if (sqltype & DB_DAY)
27  *from = DB_DAY;
28  else if (sqltype & DB_HOUR)
29  *from = DB_HOUR;
30  else if (sqltype & DB_MINUTE)
31  *from = DB_MINUTE;
32  else if (sqltype & DB_SECOND)
33  *from = DB_SECOND;
34  else if (sqltype & DB_FRACTION)
35  *from = DB_FRACTION;
36  else
37  *from = 0;
38 
39  if (sqltype & DB_FRACTION)
40  *to = DB_FRACTION;
41  else if (sqltype & DB_SECOND)
42  *to = DB_SECOND;
43  else if (sqltype & DB_MINUTE)
44  *to = DB_MINUTE;
45  else if (sqltype & DB_HOUR)
46  *to = DB_HOUR;
47  else if (sqltype & DB_DAY)
48  *to = DB_DAY;
49  else if (sqltype & DB_MONTH)
50  *to = DB_MONTH;
51  else if (sqltype & DB_YEAR)
52  *to = DB_YEAR;
53  else
54  *to = 0;
55 }
void db_interval_range(int sqltype, int *from, int *to)
Definition: interval.c:9