@@ -136,7 +136,7 @@ char* convertObjToStr(PyObject *string) {
136
136
%#if PY_MAJOR_VERSION < 3
137
137
return PyString_AsString (string);
138
138
%#else
139
- return PyUnicode_AsUTF8 (string);
139
+ return ( char *) PyUnicode_AsUTF8 (string);
140
140
%#endif
141
141
}
142
142
}
@@ -1466,13 +1466,13 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
1466
1466
return false ;
1467
1467
}
1468
1468
if (longValue) {
1469
- PyList_SetItem (outList, i, PyLong_FromLong (longValue));
1469
+ PyList_SetItem (outList, i, SWIG_From_dec ( long long ) (longValue));
1470
1470
} else if (checkNullField (row, i)) {
1471
1471
// NULL value
1472
1472
Py_INCREF (Py_None);
1473
1473
PyList_SetItem (outList, i, Py_None);
1474
1474
} else {
1475
- PyList_SetItem (outList, i, PyLong_FromLong (longValue));
1475
+ PyList_SetItem (outList, i, SWIG_From_dec ( long long ) (longValue));
1476
1476
}
1477
1477
break ;
1478
1478
}
@@ -1806,7 +1806,7 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
1806
1806
return false ;
1807
1807
}
1808
1808
for (int j = 0 ; j < size; j++) {
1809
- PyList_SetItem (list, j, PyLong_FromLong (longArr[j]));
1809
+ PyList_SetItem (list, j, SWIG_From_dec ( long long ) (longArr[j]));
1810
1810
}
1811
1811
if (size) {
1812
1812
PyList_SetItem (outList, i, list);
@@ -2265,12 +2265,7 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
2265
2265
%attribute(griddb::ExpirationInfo, int , division_count, get_division_count, set_division_count);
2266
2266
2267
2267
// Attribute ContainerInfo::columnInfoList
2268
- %extend griddb::ContainerInfo{
2269
- %pythoncode %{
2270
- __swig_getmethods__[" column_info_list" ] = get_column_info_list
2271
- __swig_setmethods__[" column_info_list" ] = set_column_info_list
2272
- %}
2273
- };
2268
+ %attributeval(griddb::ContainerInfo, ColumnInfoList, column_info_list, get_column_info_list, set_column_info_list);
2274
2269
2275
2270
/* *
2276
2271
* Typemap for Container::multi_put
@@ -2335,32 +2330,29 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
2335
2330
%typemap(doc, name = " row_list" ) (GSRow** listRowdata, int rowCount) " list[list[object]]" ;
2336
2331
2337
2332
// attribute ContainerInfo::column_info_list
2338
- %typemap(in, fragment = " SWIG_AsCharPtrAndSize" , fragment = " cleanString" ) (ColumnInfoList columnInfoList ) (int * alloc = NULL ){
2333
+ %typemap(in, fragment = " SWIG_AsCharPtrAndSize" , fragment = " cleanString" ) (ColumnInfoList* ) (int * alloc = NULL ){
2339
2334
2340
2335
if (!PyList_Check ($input)) {
2341
2336
PyErr_SetString (PyExc_ValueError, " Expected a List" );
2342
2337
SWIG_fail;
2343
2338
}
2344
- int res;
2345
- char * v = 0 ;
2346
- bool vbool;
2347
- size_t size = 0 ;
2348
- size = (size_t )PyInt_AsLong (PyLong_FromSsize_t (PyList_Size ($input)));
2349
- $1 .columnInfo = NULL ;
2350
- $1 .size = size;
2351
- size_t stringSize = 0 ;
2339
+
2340
+ $1 = NULL ;
2341
+ size_t size = (size_t )PyInt_AsLong (PyLong_FromSsize_t (PyList_Size ($input)));
2352
2342
if (size) {
2353
2343
try {
2354
- alloc = new int [size]();
2355
- $1 .columnInfo = new GSColumnInfo[size]();
2344
+ $1 = new ColumnInfoList ();
2345
+ alloc = new int [size]();
2346
+ $1 ->columnInfo = new GSColumnInfo[size]();
2356
2347
} catch (bad_alloc& ba) {
2357
2348
PyErr_SetString (PyExc_ValueError, " Memory allocation for set column_info_list is error" );
2358
2349
SWIG_fail;
2359
2350
}
2351
+ $1 ->size = size;
2360
2352
PyObject* columInfoList;
2361
2353
int option;
2362
2354
for (int i = 0 ; i < size; i++) {
2363
- $1 . columnInfo [i] = GS_COLUMN_INFO_INITIALIZER;
2355
+ $1 -> columnInfo [i] = GS_COLUMN_INFO_INITIALIZER;
2364
2356
columInfoList = PyList_GetItem ($input, i);
2365
2357
if (!PyList_Check (columInfoList)) {
2366
2358
PyErr_SetString (PyExc_ValueError, " Expected a List" );
@@ -2369,55 +2361,62 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
2369
2361
size_t sizeColumn = (size_t )PyInt_AsLong (PyLong_FromSsize_t (PyList_Size (columInfoList)));
2370
2362
if (sizeColumn == 3 ) {
2371
2363
option = PyInt_AsLong (PyList_GetItem (columInfoList, 2 ));
2372
- $1 . columnInfo [i].options = option;
2364
+ $1 -> columnInfo [i].options = option;
2373
2365
if (option != GS_TYPE_OPTION_NULLABLE && option != GS_TYPE_OPTION_NOT_NULL) {
2374
2366
PyErr_SetString (PyExc_ValueError, " Invalid value for column option" );
2375
2367
SWIG_fail;
2376
2368
}
2377
2369
} else if (sizeColumn == 2 ) {
2378
- if (i == 0 ) {
2379
- $ 1 . columnInfo [i].options = GS_TYPE_OPTION_NOT_NULL;
2380
- } else {
2381
- $ 1 . columnInfo [i].options = GS_TYPE_OPTION_NULLABLE;
2382
- }
2370
+ if (i == 0 ) {
2371
+ $ 1 -> columnInfo [i].options = GS_TYPE_OPTION_NOT_NULL;
2372
+ } else {
2373
+ $ 1 -> columnInfo [i].options = GS_TYPE_OPTION_NULLABLE;
2374
+ }
2383
2375
} else {
2384
2376
PyErr_SetString (PyExc_ValueError, " Invalid element number for List" );
2385
2377
SWIG_fail;
2386
2378
}
2387
2379
2380
+ char * v = 0 ;
2381
+ size_t stringSize = 0 ;
2382
+ int res;
2388
2383
res = SWIG_AsCharPtrAndSize (PyList_GetItem (columInfoList, 0 ), &v, &stringSize, &alloc[i]);
2389
2384
if (!SWIG_IsOK (res)) {
2390
2385
PyErr_SetString (PyExc_ValueError, " Can't convert field to string" );
2391
2386
SWIG_fail;
2392
2387
}
2393
- $1 . columnInfo [i].name = v;
2394
- $1 . columnInfo [i].type = PyInt_AsLong (PyList_GetItem (columInfoList, 1 ));
2388
+ $1 -> columnInfo [i].name = v;
2389
+ $1 -> columnInfo [i].type = PyInt_AsLong (PyList_GetItem (columInfoList, 1 ));
2395
2390
}
2396
2391
}
2397
2392
}
2398
2393
2399
- %typemap(freearg, fragment = " cleanString" ) (ColumnInfoList columnInfoList ) {
2394
+ %typemap(freearg, fragment = " cleanString" ) (ColumnInfoList* ) {
2400
2395
size_t size = 0 ;
2401
- if ($1 .size ) {
2402
- size = $1 .size ;
2403
- }
2404
- if ($1 .columnInfo != NULL ) {
2405
- if (alloc$argnum) {
2406
- for (int i = 0 ; i < size; i++) {
2407
- if ($1 .columnInfo [i].name ) {
2408
- cleanString ($1 .columnInfo [i].name , alloc$argnum[i]);
2396
+ if ($1 ) {
2397
+ if ($1 ->size ) {
2398
+ size = $1 ->size ;
2399
+ }
2400
+ if ($1 ->columnInfo != NULL ) {
2401
+ if (alloc$argnum) {
2402
+ for (int i = 0 ; i < size; i++) {
2403
+ if ($1 ->columnInfo [i].name ) {
2404
+ cleanString ($1 ->columnInfo [i].name , alloc$argnum[i]);
2405
+ }
2409
2406
}
2410
2407
}
2408
+ delete [] $1 ->columnInfo ;
2411
2409
}
2412
- delete [] $1 .columnInfo ;
2410
+
2411
+ delete $1 ;
2413
2412
}
2414
2413
if (alloc$argnum) {
2415
2414
delete [] alloc$argnum;
2416
2415
}
2417
2416
}
2418
2417
2419
- %typemap(out, fragment = " convertStrToObj" ) (ColumnInfoList) {
2420
- ColumnInfoList data = $1 ;
2418
+ %typemap(out, fragment = " convertStrToObj" ) (ColumnInfoList* ) {
2419
+ ColumnInfoList data = * $1 ;
2421
2420
size_t size = data.size ;
2422
2421
$result = PyList_New (size);
2423
2422
if ($result == NULL ) {
0 commit comments