00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 namespace stactiverecord {
00029
00030 class Where {
00031 public:
00032 int ivalue, ivaluetwo;
00033 std::string svalue;
00034 std::vector<int> ivalues;
00035 wheretype type;
00036 coltype ct;
00037 bool isnot;
00038 Where(int _ivalue, wheretype _wt, bool _isnot=false) :
00039 ivalue(_ivalue), type(_wt), ct(INTEGER), isnot(_isnot) {};
00040 Where(DateTime _dtvalue, wheretype _wt, bool _isnot=false) :
00041 ivalue(_dtvalue.to_int()), type(_wt), ct(DATETIME), isnot(_isnot) {};
00042 Where(std::vector<int> _ivalues, wheretype _wt, bool _isnot=false) :
00043 ivalues(_ivalues), type(_wt), ct(INTEGER), isnot(_isnot) {};
00044 Where(int _ivalue, int _valuetwo, wheretype _wt, bool _isnot=false) :
00045 ivalue(_ivalue), ivaluetwo(_valuetwo), type(_wt), ct(INTEGER), isnot(_isnot) {};
00046 Where(DateTime _dtvalue, DateTime _dtvaluetwo, wheretype _wt, bool _isnot=false) :
00047 ivalue(_dtvalue.to_int()), ivaluetwo(_dtvaluetwo.to_int()), type(_wt), ct(DATETIME), isnot(_isnot) {};
00048 Where(std::string _svalue, wheretype _wt, bool _isnot=false) :
00049 svalue(_svalue), type(_wt), ct(STRING), isnot(_isnot) {};
00050
00051 Where(std::string _svalue, int _ivalue, wheretype _wt, bool _isnot=false) :
00052 svalue(_svalue), ivalue(_ivalue), type(_wt), ct(RECORD), isnot(_isnot) {};
00053
00054 Where(wheretype _wt, bool _isnot=false) : type(_wt), ct(ALL), isnot(_isnot) {};
00055 };
00056
00057 Where * startswith(std::string value);
00058 Where * endswith(std::string value);
00059 Where * contains(std::string value);
00060 Where * lessthan(int value);
00061 Where * greaterthan(int value);
00062 Where * between(int value, int valuetwo);
00063 Where * lessthan(DateTime value);
00064 Where * greaterthan(DateTime value);
00065 Where * between(DateTime value, DateTime valuetwo);
00066 Where * equals(DateTime value);
00067 Where * equals(int value);
00068 Where * equals(std::string value);
00069 Where * equals(bool value);
00070 Where * equals(const char * value);
00071 Where * in(std::vector<int> values);
00072 Where * isnull();
00073 template <class T> Where * hasobject(Record<T>& r) {
00074 return new Where(r.classname, r.id, OBJECTRELATION);
00075 };
00076
00077
00078
00079 Where * nstartswith(std::string value);
00080 Where * nendswith(std::string value);
00081 Where * ncontains(std::string value);
00082 Where * nlessthan(int value);
00083 Where * ngreaterthan(int value);
00084 Where * nbetween(int value, int valuetwo);
00085 Where * nequals(int value);
00086 Where * nlessthan(DateTime value);
00087 Where * ngreaterthan(DateTime value);
00088 Where * nbetween(DateTime value, DateTime valuetwo);
00089 Where * nequals(DateTime value);
00090 Where * nequals(std::string value);
00091 Where * nequals(bool value);
00092 Where * nequals(const char * value);
00093 Where * nin(std::vector<int> values);
00094 Where * nisnull();
00095 };