Main Page   Data Structures   File List   Data Fields  

MyMySQLPPField.cpp

Go to the documentation of this file.
00001 /*
00002         MyMySQL++ - Another MySQL++ API providing basic and easy access to MySQL functionality.
00003     Copyright (C) 2003 Stefan Schadt
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 2 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, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00028 #include "pch.h"
00029 #include "MyMySQLPPField.h"
00030 
00032 CMyMySQLPPField::CMyMySQLPPField(void)
00033 {
00034         m_field = NULL;
00035 }
00036 
00040 CMyMySQLPPField::CMyMySQLPPField(MYSQL_FIELD* field)
00041 {
00042         m_field = NULL;
00043         Attach(field);
00044 }
00045 
00047 CMyMySQLPPField::~CMyMySQLPPField(void)
00048 {
00049         Free();
00050 }
00051 
00055 void CMyMySQLPPField::Attach(MYSQL_FIELD* field)
00056 {
00057         m_field = field;
00058 }
00059 
00061 void CMyMySQLPPField::Free(void)
00062 {
00063         m_field = NULL;
00064 }
00065 
00069 char* CMyMySQLPPField::GetName(void)
00070 {
00071         return (m_field == NULL) ? (NULL) : (m_field->name);
00072 }
00073 
00077 char* CMyMySQLPPField::GetTable(void)
00078 {
00079         return (m_field == NULL) ? (NULL) : (m_field->table);
00080 }
00081 
00085 char* CMyMySQLPPField::GetDefaultValue(void)
00086 {
00087         return (m_field == NULL) ? (NULL) : (m_field->def);
00088 }
00089 
00093 enum enum_field_types CMyMySQLPPField::GetType(void)
00094 {
00095         return (m_field == NULL) ? ((enum_field_types)NULL) : (m_field->type);
00096 }
00097 
00101 char* CMyMySQLPPField::GetTypeString(void)
00102 {
00103         if(m_field == NULL)
00104                 return NULL;
00105         switch(GetType())
00106         {
00107         case FIELD_TYPE_TINY:
00108                 return "TINYINT";
00109         case FIELD_TYPE_SHORT:
00110                 return "SMALLINT";
00111         case FIELD_TYPE_LONG:
00112                 return "INTEGER";
00113         case FIELD_TYPE_INT24:
00114                 return "MEDIUMINT";
00115         case FIELD_TYPE_LONGLONG:
00116                 return "BIGINT";
00117         case FIELD_TYPE_DECIMAL:
00118                 return "DECIMAL or NUMERIC";
00119         case FIELD_TYPE_FLOAT:
00120                 return "FLOAT";
00121         case FIELD_TYPE_DOUBLE:
00122                 return "DOUBLE or REAL";
00123         case FIELD_TYPE_TIMESTAMP:
00124                 return "TIMESTAMP";
00125         case FIELD_TYPE_DATE:
00126                 return "DATE";
00127         case FIELD_TYPE_TIME:
00128                 return "TIME";
00129         case FIELD_TYPE_DATETIME:
00130                 return "DATETIME";
00131         case FIELD_TYPE_YEAR:
00132                 return "YEAR";
00133         case FIELD_TYPE_STRING:
00134                 return "CHAR or VARCHAR";
00135         case FIELD_TYPE_BLOB:
00136                 return "BLOB or TEXT";
00137         case FIELD_TYPE_SET:
00138                 return "SET";
00139         case FIELD_TYPE_ENUM:
00140                 return "ENUM";
00141         case FIELD_TYPE_NULL:
00142                 return "NULL";
00143         default:
00144                 return "UNKNOWN";
00145         }
00146 }

Generated on Thu Feb 20 16:15:49 2003 for MyMySQL++ by doxygen1.3-rc3