WORM 0.2
A C++ DAL/ORM code generation framework

src/sql/wsqlfield.cpp

Go to the documentation of this file.
00001 /*
00002  *    WORM - a DAL/ORM code generation framework
00003  *    Copyright (C) 2011  Erik Winn <erikwinnmail@yahoo.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 3 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, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include "wsqlfield.h"
00020 #include "wsqldatum.h"
00021 
00022 namespace WSql
00023 {
00024 
00079 WSqlField::WSqlField()
00080 {
00081     _precision = 2;
00082     _isDirty = false;
00083 }
00084 
00092 WSqlField::WSqlField(const std::string& fieldName, const std::string& columnName)
00093 {
00094     _precision = 2;
00095     _isDirty = false;
00096     _name = fieldName;
00097     if(columnName.empty())
00098         _columnName = fieldName;
00099     else
00100     _columnName = columnName;
00101 }
00102 
00106 WSqlField& WSqlField::operator=(const WSqlField& other)
00107 {
00108     _precision = other._precision;
00109     _isDirty = other._isDirty;
00110     _columnName = other._columnName;
00111     _name = other._name;
00112     _data = other._data;
00113     return *this;
00114 }
00115 
00116 
00126 bool WSqlField::operator==(const WSqlField& other) const
00127 {
00128     return (
00129             _precision == other._precision
00130             && _isDirty == other._isDirty
00131             && _data == other._data
00132             && _name.compare(other._columnName) == 0
00133             && _columnName.compare(other._columnName) == 0
00134     );
00135 }
00136 
00141 WSqlField::~WSqlField()
00142 {
00143 }
00144 
00177 void WSqlField::clear()
00178 {
00179     _data.clear();
00180 }
00181 
00244 } //namespace WSql
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Defines