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

Programme.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 "Programme.h"
00021 
00022 int Programme::insertSQL = 0;
00023 int Programme::updateSQL = 0;
00024 int Programme::deleteSQL = 0;
00025 
00026 int Programme::uniqueNameSQL = 0;
00027 int Programme::uniqueAbbrevSQL = 0;
00028 
00029 int Programme::errorSQL = 0;
00030 
00031 void Programme::PrepareSQL(sql * dbConn)
00032 {
00033         if (dbConn != 0)
00034         {
00035                 insertSQL = dbConn->prepare("basic.prog_insert",3,*dbConn->useModuleConn());
00036                 updateSQL = dbConn->prepare("basic.prog_update",4,*dbConn->useModuleConn());
00037                 deleteSQL = dbConn->prepare("basic.prog_delete",1,*dbConn->useModuleConn());
00038                 
00039                 uniqueNameSQL = dbConn->prepare("basic.is_prog_name_unique"
00040                                                ,2
00041                                                ,*dbConn->useModuleConn());
00042                 uniqueAbbrevSQL = dbConn->prepare("basic.is_prog_abbrev_unique"
00043                                                  ,2
00044                                                  ,*dbConn->useModuleConn());
00045                 
00046                 errorSQL = dbConn->prepare("basic.prog_error",1,*dbConn->useModuleConn());
00047         }
00048 }
00049 
00050 Programme::Programme()
00051 :DataClass()
00052 {
00053         name   = "";
00054         abbrev = "";
00055         p_rtti = PROGRAMME_CLASS;
00056 }
00057 
00058 Programme::Programme(int pID
00059                     ,QString pName
00060                     ,QString pAbbrev
00061                     ,Institute * pParent)
00062 :DataClass(pID)
00063 {
00064         name   = pName;
00065         abbrev = pAbbrev;
00066         parent = pParent;
00067         p_rtti = PROGRAMME_CLASS;
00068 }
00069 
00070 void Programme::bindValues(int preparedSQL, int start)
00071 {
00072         sql::Instance()->bind(start,name,preparedSQL);
00073         sql::Instance()->bind(++start,abbrev);
00074         sql::Instance()->bind(++start,getInstID());
00075 }
00076 
00077 bool Programme::uniqueName(QString name, int parentID)
00078 {
00079         sql::Instance()->bind(0,name,uniqueNameSQL);
00080         sql::Instance()->bind(1,parentID);
00081         return unique(uniqueNameSQL);
00082 }
00083 
00084 bool Programme::uniqueAbbrev(QString abbrev, int parentID)
00085 {
00086         sql::Instance()->bind(0,abbrev,uniqueAbbrevSQL);
00087         sql::Instance()->bind(1,parentID);
00088         return unique(uniqueAbbrevSQL);
00089 }
00090 

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