00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "Institute.h"
00022
00023 int Institute::insertSQL = 0;
00024 int Institute::updateSQL = 0;
00025 int Institute::deleteSQL = 0;
00026
00027 int Institute::uniqueNameSQL = 0;
00028 int Institute::uniqueAbbrevSQL = 0;
00029
00030 int Institute::errorSQL = 0;
00031
00032 void Institute::PrepareSQL(sql * dbConn)
00033 {
00034 if (dbConn != 0)
00035 {
00036 insertSQL = dbConn->prepare("basic.inst_insert",2,*dbConn->useModuleConn());
00037 updateSQL = dbConn->prepare("basic.inst_update",3,*dbConn->useModuleConn());
00038 deleteSQL = dbConn->prepare("basic.inst_delete",1,*dbConn->useModuleConn());
00039
00040 uniqueNameSQL = dbConn->prepare("basic.is_inst_name_unique",1,*dbConn->useModuleConn());
00041 uniqueAbbrevSQL = dbConn->prepare("basic.is_inst_abbrev_unique",1,*dbConn->useModuleConn());
00042
00043 errorSQL = dbConn->prepare("basic.inst_error",1,*dbConn->useModuleConn());
00044 }
00045 }
00046
00047 Institute::Institute()
00048 :DataClass()
00049 {
00050 name = "";
00051 abbrev = "";
00052 p_rtti = INSTITUTE_CLASS;
00053 }
00054
00055 Institute::Institute(int pID, QString pName, QString pAbbrev)
00056 :DataClass(pID)
00057 {
00058 name = pName;
00059 abbrev = pAbbrev;
00060 p_rtti = INSTITUTE_CLASS;
00061 }
00062
00063 void Institute::bindValues(int preparedSQL, int start)
00064 {
00065 sql::Instance()->bind(start,name,preparedSQL);
00066 sql::Instance()->bind(start+1,abbrev);
00067 }
00068
00069 bool Institute::uniqueName(QString name, int)
00070 {
00071 sql::Instance()->bind(0,name,uniqueNameSQL);
00072 return unique(uniqueNameSQL);
00073 }
00074
00075 bool Institute::uniqueAbbrev(QString abbrev, int)
00076 {
00077 sql::Instance()->bind(0,abbrev,uniqueAbbrevSQL);
00078 return unique(uniqueAbbrevSQL);
00079 }