EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ReaderColumnContentDesc Class Reference

Helper class for column description. More...

#include "RowsetToSQL.h"

Public Types

enum  ColumnType {
  TYPE_INTEGER, TYPE_FLOAT, TYPE_STRING, TYPE_WSTRING,
  TYPE_UNKNOWN, TYPE_ERROR
}
 

Public Member Functions

 ReaderColumnContentDesc ()
 
ColumnType type () const
 
bool isNull () const
 
const char * typeString () const
 
const char * nullString () const
 
void Process (const PyRep::PyType t)
 Processes PyRep type to determine type of column. More...
 

Protected Attributes

ColumnType mType
 
bool mIsNull
 

Static Protected Attributes

static const char *const smTypeStrings []
 
static const char *const smNullStrings []
 

Detailed Description

Helper class for column description.

Describes single column.

Author
Zhur, Bloody.Rabbit

Definition at line 41 of file RowsetToSQL.h.

Member Enumeration Documentation

Known column types.

Enumerator
TYPE_INTEGER 
TYPE_FLOAT 
TYPE_STRING 
TYPE_WSTRING 
TYPE_UNKNOWN 
TYPE_ERROR 

Definition at line 45 of file RowsetToSQL.h.

Constructor & Destructor Documentation

ReaderColumnContentDesc::ReaderColumnContentDesc ( )

Primary constructor.

Definition at line 51 of file RowsetToSQL.cpp.

Member Function Documentation

bool ReaderColumnContentDesc::isNull ( ) const
inline
Returns
Whether column may be NULL.

Definition at line 62 of file RowsetToSQL.h.

References mIsNull.

Referenced by nullString().

62 { return mIsNull; }

Here is the caller graph for this function:

const char* ReaderColumnContentDesc::nullString ( ) const
inline
Returns
Whether column may be NULL, in SQL.

Definition at line 67 of file RowsetToSQL.h.

References isNull(), and smNullStrings.

Referenced by ReaderToSQL().

67 { return smNullStrings[ isNull() ]; }
static const char *const smNullStrings[]
Definition: RowsetToSQL.h:85
bool isNull() const
Definition: RowsetToSQL.h:62

Here is the call graph for this function:

Here is the caller graph for this function:

void ReaderColumnContentDesc::Process ( const PyRep::PyType  t)

Processes PyRep type to determine type of column.

Parameters
[in]tPyRep type.

Definition at line 57 of file RowsetToSQL.cpp.

References mIsNull, mType, PyRep::PyTypeBool, PyRep::PyTypeFloat, PyRep::PyTypeInt, PyRep::PyTypeLong, PyRep::PyTypeNone, PyRep::PyTypeString, PyRep::PyTypeWString, TYPE_ERROR, TYPE_FLOAT, TYPE_INTEGER, TYPE_STRING, TYPE_UNKNOWN, and TYPE_WSTRING.

58 {
59  switch( t )
60  {
61  case PyRep::PyTypeNone:
62  mIsNull = true;
63  break;
64 
65  case PyRep::PyTypeBool:
66  case PyRep::PyTypeInt:
67  case PyRep::PyTypeLong:
68  switch( mType )
69  {
70  case TYPE_UNKNOWN:
72  break;
73  case TYPE_INTEGER:
74  case TYPE_FLOAT:
75  break;
76  default:
77  mType = TYPE_ERROR;
78  break;
79  }
80  break;
81 
82  case PyRep::PyTypeFloat:
83  switch( mType )
84  {
85  case TYPE_UNKNOWN:
86  case TYPE_INTEGER:
87  mType = TYPE_FLOAT;
88  break;
89  case TYPE_FLOAT:
90  break;
91  default:
92  mType = TYPE_ERROR;
93  break;
94  }
95  break;
96 
98  switch( mType )
99  {
100  case TYPE_UNKNOWN:
101  mType = TYPE_STRING;
102  break;
103  case TYPE_STRING:
104  case TYPE_WSTRING:
105  break;
106  default:
107  mType = TYPE_ERROR;
108  break;
109  }
110  break;
111 
113  switch( mType )
114  {
115  case TYPE_UNKNOWN:
116  case TYPE_STRING:
118  break;
119  case TYPE_WSTRING:
120  break;
121  default:
122  mType = TYPE_ERROR;
123  break;
124  }
125  break;
126 
127  default:
128  mType = TYPE_ERROR;
129  break;
130  }
131 }
ColumnType ReaderColumnContentDesc::type ( ) const
inline
Returns
Type of column.

Definition at line 60 of file RowsetToSQL.h.

References mType.

Referenced by typeString().

60 { return mType; }

Here is the caller graph for this function:

const char* ReaderColumnContentDesc::typeString ( ) const
inline
Returns
Type of column, in SQL.

Definition at line 65 of file RowsetToSQL.h.

References smTypeStrings, and type().

Referenced by ReaderToSQL().

65 { return smTypeStrings[ type() ]; }
static const char *const smTypeStrings[]
Definition: RowsetToSQL.h:83
ColumnType type() const
Definition: RowsetToSQL.h:60

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

bool ReaderColumnContentDesc::mIsNull
protected

Whether column may be NULL.

Definition at line 80 of file RowsetToSQL.h.

Referenced by isNull(), and Process().

ColumnType ReaderColumnContentDesc::mType
protected

Type of column.

Definition at line 78 of file RowsetToSQL.h.

Referenced by Process(), and type().

const char *const ReaderColumnContentDesc::smNullStrings
staticprotected
Initial value:
=
{
"NOT NULL",
"NULL",
}

Whether column may be NULL, in SQL.

Definition at line 85 of file RowsetToSQL.h.

Referenced by nullString().

const char *const ReaderColumnContentDesc::smTypeStrings
staticprotected
Initial value:
=
{
"int",
"real",
"text /* ascii */",
"text /* utf8 */",
"UNKNOWN",
"ERROR",
}

Known types of column, in SQL.

Definition at line 83 of file RowsetToSQL.h.

Referenced by typeString().


The documentation for this class was generated from the following files: