00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "Room.h"
00021
00022
00023 int Room::insertSQL = 0;
00024 int Room::updateSQL = 0;
00025 int Room::deleteSQL = 0;
00026
00027 int Room::uniqueCodeSQL = 0;
00028
00029 int Room::errorSQL = 0;
00030
00031 void Room::PrepareSQL(sql * dbConn)
00032 {
00033 if (dbConn != 0)
00034 {
00035 insertSQL = dbConn->prepare("basic.room_insert",4,*dbConn->useModuleConn());
00036 updateSQL = dbConn->prepare("basic.room_update",5,*dbConn->useModuleConn());
00037 deleteSQL = dbConn->prepare("basic.room_delete",1,*dbConn->useModuleConn());
00038
00039 uniqueCodeSQL = dbConn->prepare("basic.is_room_code_unique",2,*dbConn->useModuleConn());
00040
00041 errorSQL = dbConn->prepare("basic.room_error",1,*dbConn->useModuleConn());
00042 }
00043 }
00044
00045 Room::Room()
00046 :DataClass()
00047 {
00048 name = "";
00049 code = "";
00050 capacity = 0;
00051 p_rtti = ROOM_CLASS;
00052 }
00053
00054 Room::Room(int pID, QString pName, QString pCode, int pCapacity, Institute * pParent)
00055 :DataClass(pID)
00056 {
00057 name = pName;
00058 code = pCode;
00059 capacity = pCapacity;
00060 parent = pParent;
00061 p_rtti = ROOM_CLASS;
00062 }
00063
00064 void Room::bindValues(int preparedSQL, int start)
00065 {
00066 sql::Instance()->bind(start,name,preparedSQL);
00067 sql::Instance()->bind(++start,code);
00068 sql::Instance()->bind(++start,getInstID());
00069 sql::Instance()->bind(++start,capacity);
00070 }
00071
00072 bool Room::uniqueCode(QString code, int parentID)
00073 {
00074 sql::Instance()->bind(0,code,uniqueCodeSQL);
00075 sql::Instance()->bind(1,parentID);
00076 return unique(uniqueCodeSQL);
00077 }
00078
00079