Skip to content

Commit 2f2ba9c

Browse files
committed
Cut GS_COMPATIBILITY_SUPPORT_3_5 and GS_COMPATIBILITY_SUPPORT_1_5
1 parent ff7a257 commit 2f2ba9c

2 files changed

Lines changed: 1 addition & 39 deletions

File tree

src/gstype.i

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,8 @@ enum GSTypeTag {
7575
GS_TYPE_LONG_ARRAY,
7676
GS_TYPE_FLOAT_ARRAY,
7777
GS_TYPE_DOUBLE_ARRAY,
78-
GS_TYPE_TIMESTAMP_ARRAY
79-
80-
#if GS_COMPATIBILITY_SUPPORT_3_5
78+
GS_TYPE_TIMESTAMP_ARRAY,
8179
GS_TYPE_NULL = -1
82-
#endif
8380
};
8481
#endif
8582

@@ -97,15 +94,11 @@ enum GSFetchOptionTag {
9794

9895
GS_FETCH_LIMIT,
9996

100-
#if GS_COMPATIBILITY_SUPPORT_1_5
101-
10297
#if GS_INTERNAL_DEFINITION_VISIBLE
10398
#if !GS_COMPATIBILITY_DEPRECATE_FETCH_OPTION_SIZE
10499

105100
GS_FETCH_SIZE = (GS_FETCH_LIMIT + 1)
106101
#endif
107-
#endif
108-
109102
#endif
110103
};
111104

@@ -132,11 +125,9 @@ enum GSTypeOptionTag {
132125

133126
GS_TYPE_OPTION_KEY = 1 << 0,
134127

135-
#if GS_COMPATIBILITY_SUPPORT_3_5
136128
GS_TYPE_OPTION_NULLABLE = 1 << 1,
137129

138130
GS_TYPE_OPTION_NOT_NULL = 1 << 2,
139-
#endif
140131

141132
};
142133

src/gstype_python.i

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,15 @@ class FetchOption(IntEnum):
5656
def __int__(self):
5757
return int(self.value)
5858
LIMIT = 0
59-
%#if GS_COMPATIBILITY_SUPPORT_1_5
6059

6160
%#if GS_INTERNAL_DEFINITION_VISIBLE
6261
%#if !GS_COMPATIBILITY_DEPRECATE_FETCH_OPTION_SIZE
6362
SIZE = (LIMIT + 1)
6463
%#endif
6564
%#endif
66-
6765
%#if GS_COMPATIBILITY_SUPPORT_4_0
6866
PARTIAL_EXECUTION = (LIMIT + 2)
6967
%#endif
70-
71-
%#endif
7268
class TimeUnit(IntEnum):
7369
def __int__(self):
7470
return int(self.value)
@@ -102,9 +98,7 @@ class Type(IntEnum):
10298
FLOAT_ARRAY = 17
10399
DOUBLE_ARRAY = 18
104100
TIMESTAMP_ARRAY = 19
105-
%#if GS_COMPATIBILITY_SUPPORT_3_5
106101
NULL = -1
107-
%#endif
108102

109103
class TypeOption(IntEnum):
110104
def __int__(self):
@@ -224,10 +218,8 @@ static PyObject* convertFieldToObject(GSValue* value, GSType type, bool timestam
224218
return PyLong_FromLong(value->asLong);
225219
case GS_TYPE_STRING:
226220
return convertStrToObj(value->asString);
227-
%#if GS_COMPATIBILITY_SUPPORT_3_5
228221
case GS_TYPE_NULL:
229222
Py_RETURN_NONE;
230-
%#endif
231223
case GS_TYPE_INTEGER:
232224
return PyInt_FromLong(value->asInteger);
233225
case GS_TYPE_DOUBLE:
@@ -600,13 +592,8 @@ static bool convertToFieldWithType(GSRow *row, int column, PyObject* value, GSTy
600592
GSResult ret;
601593

602594
if (value == Py_None) {
603-
%#if GS_COMPATIBILITY_SUPPORT_3_5
604595
ret = gsSetRowFieldNull(row, column);
605596
return (ret == GS_RESULT_OK);
606-
%#else
607-
//Not support NULL
608-
return false;
609-
%#endif
610597
}
611598

612599
int checkConvert = 0;
@@ -999,7 +986,6 @@ static bool convertToFieldWithType(GSRow *row, int column, PyObject* value, GSTy
999986
}
1000987

1001988
$1[i].type = (int) PyInt_AsLong(PyList_GetItem(list, 1));
1002-
%#if GS_COMPATIBILITY_SUPPORT_3_5
1003989
int tupleLength = (int)PyInt_AsLong(PyLong_FromSsize_t(PyList_Size(list)));
1004990
//Case user input option parameter
1005991
if (tupleLength == 3) {
@@ -1015,7 +1001,6 @@ static bool convertToFieldWithType(GSRow *row, int column, PyObject* value, GSTy
10151001
} else if (tupleLength == 2) {
10161002
$1[i].options = 0;
10171003
}
1018-
%#endif
10191004
i++;
10201005
}
10211006
}
@@ -1436,11 +1421,7 @@ static bool convertToFieldWithType(GSRow *row, int column, PyObject* value, GSTy
14361421
%typemap(in, fragment = "convertToRowKeyFieldWithType") (griddb::Field* keyFields)(griddb::Field field) {
14371422
$1 = &field;
14381423
if ($input == Py_None) {
1439-
%#if GS_COMPATIBILITY_SUPPORT_3_5
14401424
$1->type = GS_TYPE_NULL;
1441-
%#else
1442-
%variable_fail(1, "String", "Not support for NULL");
1443-
%#endif
14441425
} else {
14451426
GSType* typeList = arg1->getGSTypeList();
14461427
GSType type = typeList[0];
@@ -1469,7 +1450,6 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
14691450
for (int i = 0; i < columnCount; i++) {
14701451
//Check NULL value
14711452
GSBool nullValue;
1472-
%#if GS_COMPATIBILITY_SUPPORT_3_5
14731453
ret = gsGetRowFieldNull(row, (int32_t) i, &nullValue);
14741454
if (ret != GS_RESULT_OK) {
14751455
*columnError = i;
@@ -1482,7 +1462,6 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
14821462
PyList_SetItem(outList, i, Py_None);
14831463
continue;
14841464
}
1485-
%#endif
14861465
switch(typeList[i]) {
14871466
case GS_TYPE_LONG: {
14881467
int64_t longValue;
@@ -2135,7 +2114,6 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
21352114
}
21362115
$1.columnInfo[i].name = v;
21372116
$1.columnInfo[i].type = PyLong_AsLong(PyList_GetItem(columInfoList, 1));
2138-
%#if GS_COMPATIBILITY_SUPPORT_3_5
21392117
if (sizeColumn == 3) {
21402118
option = PyInt_AsLong(PyList_GetItem(columInfoList, 2));
21412119
$1.columnInfo[i].options = option;
@@ -2146,7 +2124,6 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
21462124
} else if (sizeColumn == 2) {
21472125
$1.columnInfo[i].options = 0;
21482126
}
2149-
%#endif
21502127
}
21512128
}
21522129
}
@@ -2181,7 +2158,6 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
21812158
}
21822159
PyObject* info;
21832160
for (int i = 0; i < size; i++) {
2184-
%#if GS_COMPATIBILITY_SUPPORT_3_5
21852161
if ((data.columnInfo)[i].options != 0) {
21862162
info = PyList_New(3);
21872163
PyList_SetItem(info, 0, convertStrToObj((data.columnInfo)[i].name));
@@ -2192,11 +2168,6 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
21922168
PyList_SetItem(info, 0, convertStrToObj((data.columnInfo)[i].name));
21932169
PyList_SetItem(info, 1, PyInt_FromLong((data.columnInfo)[i].type));
21942170
}
2195-
%#else
2196-
info = PyList_New(2);
2197-
PyList_SetItem(info, 0, convertStrToObj((data.columnInfo)[i].name));
2198-
PyList_SetItem(info, 1, PyInt_FromLong((data.columnInfo)[i].type));
2199-
%#endif
22002171
PyList_SetItem($result, i, info);
22012172
}
22022173
}

0 commit comments

Comments
 (0)