File: interval.c

package info (click to toggle)
grass 6.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 104,028 kB
  • ctags: 40,409
  • sloc: ansic: 419,980; python: 63,559; tcl: 46,692; cpp: 29,791; sh: 18,564; makefile: 7,000; xml: 3,505; yacc: 561; perl: 559; lex: 480; sed: 70; objc: 7
file content (55 lines) | stat: -rw-r--r-- 1,057 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <grass/dbmi.h>

/*!
   \fn 
   \brief 
   \return 
   \param 
 */
void db_interval_range(int sqltype, int *from, int *to)
{
    switch (sqltype) {
    case DB_SQL_TYPE_DATE:
	*from = DB_YEAR;
	*to = DB_DAY;
	return;
    case DB_SQL_TYPE_TIME:
	*from = DB_HOUR;
	*to = DB_FRACTION;
	return;
    }

    if (sqltype & DB_YEAR)
	*from = DB_YEAR;
    else if (sqltype & DB_MONTH)
	*from = DB_MONTH;
    else if (sqltype & DB_DAY)
	*from = DB_DAY;
    else if (sqltype & DB_HOUR)
	*from = DB_HOUR;
    else if (sqltype & DB_MINUTE)
	*from = DB_MINUTE;
    else if (sqltype & DB_SECOND)
	*from = DB_SECOND;
    else if (sqltype & DB_FRACTION)
	*from = DB_FRACTION;
    else
	*from = 0;

    if (sqltype & DB_FRACTION)
	*to = DB_FRACTION;
    else if (sqltype & DB_SECOND)
	*to = DB_SECOND;
    else if (sqltype & DB_MINUTE)
	*to = DB_MINUTE;
    else if (sqltype & DB_HOUR)
	*to = DB_HOUR;
    else if (sqltype & DB_DAY)
	*to = DB_DAY;
    else if (sqltype & DB_MONTH)
	*to = DB_MONTH;
    else if (sqltype & DB_YEAR)
	*to = DB_YEAR;
    else
	*to = 0;
}