Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Institute.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Graeme Foster                                   *
00003  *   email    foster.graeme@gmail.com                                      *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
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 }

Generated on Thu Apr 6 16:27:16 2006 for time-table by  doxygen 1.4.4