00001 /* 00002 * This file is part of the Standard Portable Library (SPL). 00003 * 00004 * SPL is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * SPL is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with SPL. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 #include <spl/data/DataColumn.h> 00018 #include <spl/DateTime.h> 00019 #include <spl/Date.h> 00020 #include <spl/Decimal.h> 00021 00022 DataColumn::DataColumn() 00023 { 00024 } 00025 00026 DataColumn::DataColumn(const DataColumn& col) 00027 { 00028 } 00029 00030 DataColumn::DataColumn(const String& name, int index, int colType, int dataLen) 00031 : m_name(name), m_index(index), m_colType(colType), m_dataLen(dataLen) 00032 { 00033 } 00034 00035 DataColumn::~DataColumn() 00036 { 00037 } 00038 00039 DataColumn& DataColumn::operator =(const DataColumn& col) 00040 { 00041 m_name = col.m_name; 00042 m_index = col.m_index; 00043 m_colType = col.m_colType; 00044 m_dataLen = col.m_dataLen; 00045 00046 return *this; 00047 } 00048 00049 /*void DataColumn::InitCell(Variant& v) const 00050 { 00051 switch (m_colType) 00052 { 00053 case DbSqlType::SQL_TYPE_UNASSIGNED: 00054 break; 00055 case DbSqlType::SQL_TYPE_INT8: 00056 v = (byte)0; 00057 break; 00058 case DbSqlType::SQL_TYPE_INT16: 00059 v = (int16)0; 00060 break; 00061 case DbSqlType::SQL_TYPE_INT32: 00062 v = (int32)0; 00063 break; 00064 case DbSqlType::SQL_TYPE_INT64: 00065 v = (int64)0; 00066 break; 00067 case DbSqlType::SQL_TYPE_DECIMAL: 00068 v = Decimal(); 00069 break; 00070 case DbSqlType::SQL_TYPE_FLOAT32: 00071 v = (float32)0; 00072 break; 00073 case DbSqlType::SQL_TYPE_FLOAT64: 00074 v = (float64)0; 00075 break; 00076 case DbSqlType::SQL_TYPE_FLAG: 00077 v = (byte)0; 00078 break; 00079 case DbSqlType::SQL_TYPE_TIMESTAMP: 00080 v = DateTime(0, 0, 0); 00081 break; 00082 case DbSqlType::SQL_TYPE_DATE: 00083 v = Date(0, 0, 0); 00084 break; 00085 case DbSqlType::SQL_TYPE_DATETIME: 00086 v = DateTime(0, 0, 0); 00087 break; 00088 case DbSqlType::SQL_TYPE_CHAR: 00089 v = String(); 00090 break; 00091 case DbSqlType::SQL_TYPE_VARCHAR: 00092 v = String(); 00093 break; 00094 case DbSqlType::SQL_TYPE_BLOB: 00095 throw new InvalidArgumentException("Binary not supported"); 00096 } 00097 }*/ 00098 00099 DataColumnPtr DataColumn::Clone() const 00100 { 00101 return DataColumnPtr(new DataColumn(*this)); 00102 } 00103 00104 #if defined(DEBUG) 00105 void DataColumn::CheckMem() const 00106 { 00107 m_name.CheckMem(); 00108 } 00109 00110 void DataColumn::ValidateMem() const 00111 { 00112 m_name.ValidateMem(); 00113 } 00114 #endif