WORM 0.2
A C++ DAL/ORM code generation framework
|
00001 /* 00002 WORM - a DAL/ORM code generation framework 00003 Copyright (C) 2011 Erik Winn <sidewalksoftware@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 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 00020 #include "wsqlforeignkey.h" 00021 #include "wsqldatatype.h" 00022 namespace WSql{ 00023 00034 WSqlForeignKey::WSqlForeignKey() 00035 { 00036 } 00037 00038 WSqlForeignKey::WSqlForeignKey( const WSqlForeignKey& other ) 00039 { 00040 _keyName=other._keyName; 00041 _tableName=other._tableName; 00042 _schemaName=other._schemaName; 00043 _columnName=other._columnName; 00044 _referencedColumnName=other._referencedColumnName; 00045 _referencedTableName=other._referencedTableName; 00046 _referencedSchemaName=other._referencedSchemaName; 00047 } 00048 00049 WSqlForeignKey::~WSqlForeignKey() 00050 { 00051 } 00052 00053 WSqlForeignKey& WSqlForeignKey::operator=( const WSqlForeignKey & other ) 00054 { 00055 _keyName=other._keyName; 00056 _tableName=other._tableName; 00057 _schemaName=other._schemaName; 00058 _columnName=other._columnName; 00059 _referencedColumnName=other._referencedColumnName; 00060 _referencedTableName=other._referencedTableName; 00061 _referencedSchemaName=other._referencedSchemaName; 00062 return *this; 00063 } 00064 00065 bool WSqlForeignKey::operator==( const WSqlForeignKey& other ) const 00066 { 00067 return( _keyName.compare(other._keyName) == 0 00068 && _tableName.compare(other._tableName)== 0 00069 && _schemaName.compare(other._schemaName)== 0 00070 && _columnName.compare(other._columnName)== 0 00071 && _referencedColumnName.compare(other._referencedColumnName)== 0 00072 && _referencedSchemaName.compare(other._referencedSchemaName)== 0 00073 && _referencedTableName.compare(other._referencedTableName)== 0); 00074 } 00075 00076 std::string WSqlForeignKey::referencedClassName() const 00077 { 00078 return WSqlDataType::tableNameToClass(_referencedTableName); 00079 } 00080 std::string WSqlForeignKey::referencedClassNamePlural() const 00081 { 00082 return WSqlDataType::toPlural(referencedClassName()); 00083 } 00084 void WSqlForeignKey::dump() const 00085 { 00086 std::cerr << "***************** Foreign Key: *****************" << std::endl; 00087 std::cerr << "keyName()" << keyName() << std::endl; 00088 std::cerr << "tableName() " << tableName() << std::endl; 00089 std::cerr << "schemaName() " << schemaName() << std::endl; 00090 std::cerr << "columnName() " << columnName() << std::endl; 00091 std::cerr << "referencedColumnName() " << referencedColumnName() << std::endl; 00092 std::cerr << "referencedTableName() " << referencedTableName() << std::endl; 00093 std::cerr << "referencedSchemaName() " << referencedSchemaName() << std::endl; 00094 std::cerr << "referencedclassName() " << referencedClassName() << std::endl; 00095 std::cerr << "referencedclassNamePlural() " << referencedClassNamePlural() << std::endl; 00096 std::cerr << "*****************************************" << std::endl; 00097 } 00098 00099 }//namespace WSql