interval.c

Go to the documentation of this file.
00001 #include <grass/dbmi.h>
00002 
00009 void db_interval_range(int sqltype, int *from, int *to)
00010 {
00011     switch (sqltype) {
00012     case DB_SQL_TYPE_DATE:
00013         *from = DB_YEAR;
00014         *to = DB_DAY;
00015         return;
00016     case DB_SQL_TYPE_TIME:
00017         *from = DB_HOUR;
00018         *to = DB_FRACTION;
00019         return;
00020     }
00021 
00022     if (sqltype & DB_YEAR)
00023         *from = DB_YEAR;
00024     else if (sqltype & DB_MONTH)
00025         *from = DB_MONTH;
00026     else if (sqltype & DB_DAY)
00027         *from = DB_DAY;
00028     else if (sqltype & DB_HOUR)
00029         *from = DB_HOUR;
00030     else if (sqltype & DB_MINUTE)
00031         *from = DB_MINUTE;
00032     else if (sqltype & DB_SECOND)
00033         *from = DB_SECOND;
00034     else if (sqltype & DB_FRACTION)
00035         *from = DB_FRACTION;
00036     else
00037         *from = 0;
00038 
00039     if (sqltype & DB_FRACTION)
00040         *to = DB_FRACTION;
00041     else if (sqltype & DB_SECOND)
00042         *to = DB_SECOND;
00043     else if (sqltype & DB_MINUTE)
00044         *to = DB_MINUTE;
00045     else if (sqltype & DB_HOUR)
00046         *to = DB_HOUR;
00047     else if (sqltype & DB_DAY)
00048         *to = DB_DAY;
00049     else if (sqltype & DB_MONTH)
00050         *to = DB_MONTH;
00051     else if (sqltype & DB_YEAR)
00052         *to = DB_YEAR;
00053     else
00054         *to = 0;
00055 }

Generated on Sat Oct 24 03:24:24 2009 for GRASS Programmer's Manual by  doxygen 1.6.1