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 "nsqlrecord.h" 00023 00024 NSqlRecord::NSqlRecord(void) 00025 : NObject(), 00026 m_record() 00027 { 00028 00029 } 00030 00031 00032 NSqlRecord::~NSqlRecord(void) { 00033 00034 } 00035 00036 00037 NVtype NSqlRecord::getData(const NString &rowName) const { 00038 if (!m_record.contains(rowName)) { 00039 NString msg = "There's no row named "; 00040 00041 msg += rowName; 00042 throw NException(msg, NException::DBAL); 00043 } 00044 00045 return m_record.value(rowName); 00046 } 00047 00048 00049 void NSqlRecord::add(const NString &rowName, const NVtype &rowData) { 00050 assert(rowName != ""); 00051 00052 if (m_record.contains(rowName, rowData)) { 00053 NWarning::print() << "You're trying to add a value already in " 00054 << "the record. Row name: " << rowName << " with value" 00055 << rowData.toString(); 00056 00057 NWarning::print() << "Currently this is being ignored"; 00058 00059 return; 00060 } 00061 00062 m_record.insert(rowName, rowData); 00063 }