EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RowsetToSQL.cpp
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur, Bloody.Rabbit
24 */
25 
26 #include "eve-common.h"
27 
28 #include "database/RowsetToSQL.h"
29 
30 const size_t INSERT_QUERY_ROW_LIMIT = 1024;
31 
32 /************************************************************************/
33 /* ReaderColumnContentDesc */
34 /************************************************************************/
35 const char* const ReaderColumnContentDesc::smTypeStrings[] =
36 {
37  "int", /* TYPE_INT */
38  "real", /* TYPE_FLOAT */
39  "text /* ascii */", /* TYPE_STRING */
40  "text /* utf8 */", /* TYPE_WSTRING */
41  "UNKNOWN", /* TYPE_UNKNOWN */
42  "ERROR", /* TYPE_ERROR */
43 };
44 
45 const char* const ReaderColumnContentDesc::smNullStrings[] =
46 {
47  "NOT NULL", /* !isNull */
48  "NULL", /* isNull */
49 };
50 
52 : mType( TYPE_UNKNOWN ),
53  mIsNull( false )
54 {
55 }
56 
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 }
const size_t INSERT_QUERY_ROW_LIMIT
Definition: RowsetToSQL.cpp:30
static const char *const smTypeStrings[]
Definition: RowsetToSQL.h:83
static const char *const smNullStrings[]
Definition: RowsetToSQL.h:85
void Process(const PyRep::PyType t)
Processes PyRep type to determine type of column.
Definition: RowsetToSQL.cpp:57
PyType
Python wire object types.
Definition: PyRep.h:72