#ifndef _DB_MAG_H #define _DB_MAG_H #include #include #include #include #include #include using namespace iPlature; using namespace baosight; class DBMag { public: DBMag(); virtual ~DBMag(); private: static iDA::Command cmd; public: //获取SEQUENCE的nextval static long GetSeqNext(string sequence); //获取表中某数字字段的最大值 static long GetMaxValue(const string& table, const string& column); //统计(平均,最大,最小) //返回到值data[0]平均,data[1]最大,data[2]最小 static short Avg(const string& field,const string& table, const string& where, float values[3]); //统计多个字段的(平均,最大,最小) static short Avg(const vector fields,const string& table, const string& where, vector& values); //求和 static short Sum(const vector fields,const string& table, const string& where, vector& values); //执行拼装完整的SQL语句 static short Execute(const string& sql , long* count); //统计相关数据计录数 static long Count(const string& field,const string& table, const string& where); //SQL方式读取字段 static short ReadDB(const string& sql,vector& values); private: //错误处理 static short SqlErr(long sqlcode); }; #endif