00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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 }