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

Room.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 #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 

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