nsql.cpp

Go to the documentation of this file.
00001 // LICENSE: (Please see the file COPYING for details)
00002 //
00003 // NUS - Nemesis Utilities System: A C++ application development framework 
00004 // Copyright (C) 2006, 2008 Otavio Rodolfo Piske
00005 //
00006 //  This file is part of NUS
00007 //
00008 //  This library is free software; you can redistribute it and/or
00009 //  modify it under the terms of the GNU Lesser General Public
00010 //  License as published by the Free Software Foundation version 2.1
00011 //  of the License.
00012 //
00013 //  This library is distributed in the hope that it will be useful,
00014 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 //  Lesser General Public License for more details.
00017 //
00018 //  You should have received a copy of the GNU Lesser General Public
00019 //  License along with this library; if not, write to the Free Software
00020 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021 //
00022 #include "nsql.h"
00023 
00028 NSql::NSql(void)
00029       : NObject(),
00030       m_user(),
00031       m_password(),
00032       m_host(),
00033       m_port(0),
00034       m_database()
00035 {
00036 
00037 }
00038 
00039 
00040 NSql::NSql(const NString &user, const NString &password, 
00041       const NHostAddress &host)
00042       : NObject(),
00043       m_user(user),
00044       m_password(password),
00045       m_host(host),
00046       m_port(0),
00047       m_database()
00048 {
00049 
00050 }
00051 
00052 
00053 NSql::NSql(const NString &user, const NString &password, 
00054       const NHostAddress &host, nint16 port)
00055       : NObject(),
00056       m_user(user),
00057       m_password(password),
00058       m_host(host),
00059       m_port(port),
00060       m_database()
00061 {
00062 
00063 }
00064 
00065 
00066 NSql::~NSql(void) {
00067 
00068 }
00069 
00070 
00071 void NSql::setUser(const NString &user) {
00072       m_user = user;
00073 }
00074 
00075 
00076 void NSql::setPassword(const NString &password) {
00077       m_password = password;
00078 }
00079 
00080 
00081 void NSql::setHost(const NHostAddress &host) {
00082       NDebug::print() << "Setting the host";
00083       m_host = host;
00084 }
00085 
00086 
00087 void NSql::setPort(nint16 port) { 
00088       if (port == 0) { 
00089             NString msg = "Port number ";
00090 
00091             msg = msg + port + " is not valid";
00092 
00093             throw NException(msg, NException::DBAL);
00094       }
00095 
00096       m_port = port;
00097       NDebug::print() << "Setting the port to " << m_port;
00098 }
00099 
00100 
00101 void NSql::setDatabase(const NString &database) { 
00102       m_database = database;
00103 }
00104 
00105 
00106 NString NSql::getUser(void) const {
00107       return m_user;
00108 }
00109 
00110 NString NSql::getPassword(void) const {
00111       return m_password;
00112 }
00113 
00114 NHostAddress NSql::getHost(void) const {
00115       return m_host;
00116 }
00117 
00118 nint16 NSql::getPort(void) const { 
00119       return m_port;
00120 }
00121 
00122 NString NSql::getDatabase(void) const { 
00123       return m_database;
00124 }
00125 
00126 void NSql::setRecordData(NSqlRecord *record, const NString &rowName, 
00127       const NVtype &rowData) 
00128 {
00129       assert(record);
00130 
00131       record->add(rowName, rowData);
00132 }

Generated on Wed Mar 5 23:10:36 2008 for NemesisUtilitiesSystem by  doxygen 1.5.4