@@ -2265,14 +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
- #if SWIG_VERSION < 0x040000
2269
- %extend griddb::ContainerInfo{
2270
- %pythoncode %{
2271
- __swig_getmethods__[" column_info_list" ] = get_column_info_list
2272
- __swig_setmethods__[" column_info_list" ] = set_column_info_list
2273
- %}
2274
- };
2275
- #endif
2268
+ %attributeval(griddb::ContainerInfo, ColumnInfoList, column_info_list, get_column_info_list, set_column_info_list);
2276
2269
2277
2270
/* *
2278
2271
* Typemap for Container::multi_put
@@ -2337,32 +2330,29 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
2337
2330
%typemap(doc, name = " row_list" ) (GSRow** listRowdata, int rowCount) " list[list[object]]" ;
2338
2331
2339
2332
// attribute ContainerInfo::column_info_list
2340
- %typemap(in, fragment = " SWIG_AsCharPtrAndSize" , fragment = " cleanString" ) (ColumnInfoList columnInfoList ) (int * alloc = NULL ){
2333
+ %typemap(in, fragment = " SWIG_AsCharPtrAndSize" , fragment = " cleanString" ) (ColumnInfoList* ) (int * alloc = NULL ){
2341
2334
2342
2335
if (!PyList_Check ($input)) {
2343
2336
PyErr_SetString (PyExc_ValueError, " Expected a List" );
2344
2337
SWIG_fail;
2345
2338
}
2346
- int res;
2347
- char * v = 0 ;
2348
- bool vbool;
2349
- size_t size = 0 ;
2350
- size = (size_t )PyInt_AsLong (PyLong_FromSsize_t (PyList_Size ($input)));
2351
- $1 .columnInfo = NULL ;
2352
- $1 .size = size;
2353
- size_t stringSize = 0 ;
2339
+
2340
+ $1 = NULL ;
2341
+ size_t size = (size_t )PyInt_AsLong (PyLong_FromSsize_t (PyList_Size ($input)));
2354
2342
if (size) {
2355
2343
try {
2356
- alloc = new int [size]();
2357
- $1 .columnInfo = new GSColumnInfo[size]();
2344
+ $1 = new ColumnInfoList ();
2345
+ alloc = new int [size]();
2346
+ $1 ->columnInfo = new GSColumnInfo[size]();
2358
2347
} catch (bad_alloc& ba) {
2359
2348
PyErr_SetString (PyExc_ValueError, " Memory allocation for set column_info_list is error" );
2360
2349
SWIG_fail;
2361
2350
}
2351
+ $1 ->size = size;
2362
2352
PyObject* columInfoList;
2363
2353
int option;
2364
2354
for (int i = 0 ; i < size; i++) {
2365
- $1 . columnInfo [i] = GS_COLUMN_INFO_INITIALIZER;
2355
+ $1 -> columnInfo [i] = GS_COLUMN_INFO_INITIALIZER;
2366
2356
columInfoList = PyList_GetItem ($input, i);
2367
2357
if (!PyList_Check (columInfoList)) {
2368
2358
PyErr_SetString (PyExc_ValueError, " Expected a List" );
@@ -2371,55 +2361,62 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
2371
2361
size_t sizeColumn = (size_t )PyInt_AsLong (PyLong_FromSsize_t (PyList_Size (columInfoList)));
2372
2362
if (sizeColumn == 3 ) {
2373
2363
option = PyInt_AsLong (PyList_GetItem (columInfoList, 2 ));
2374
- $1 . columnInfo [i].options = option;
2364
+ $1 -> columnInfo [i].options = option;
2375
2365
if (option != GS_TYPE_OPTION_NULLABLE && option != GS_TYPE_OPTION_NOT_NULL) {
2376
2366
PyErr_SetString (PyExc_ValueError, " Invalid value for column option" );
2377
2367
SWIG_fail;
2378
2368
}
2379
2369
} else if (sizeColumn == 2 ) {
2380
- if (i == 0 ) {
2381
- $ 1 . columnInfo [i].options = GS_TYPE_OPTION_NOT_NULL;
2382
- } else {
2383
- $ 1 . columnInfo [i].options = GS_TYPE_OPTION_NULLABLE;
2384
- }
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
+ }
2385
2375
} else {
2386
2376
PyErr_SetString (PyExc_ValueError, " Invalid element number for List" );
2387
2377
SWIG_fail;
2388
2378
}
2389
2379
2380
+ char * v = 0 ;
2381
+ size_t stringSize = 0 ;
2382
+ int res;
2390
2383
res = SWIG_AsCharPtrAndSize (PyList_GetItem (columInfoList, 0 ), &v, &stringSize, &alloc[i]);
2391
2384
if (!SWIG_IsOK (res)) {
2392
2385
PyErr_SetString (PyExc_ValueError, " Can't convert field to string" );
2393
2386
SWIG_fail;
2394
2387
}
2395
- $1 . columnInfo [i].name = v;
2396
- $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 ));
2397
2390
}
2398
2391
}
2399
2392
}
2400
2393
2401
- %typemap(freearg, fragment = " cleanString" ) (ColumnInfoList columnInfoList ) {
2394
+ %typemap(freearg, fragment = " cleanString" ) (ColumnInfoList* ) {
2402
2395
size_t size = 0 ;
2403
- if ($1 .size ) {
2404
- size = $1 .size ;
2405
- }
2406
- if ($1 .columnInfo != NULL ) {
2407
- if (alloc$argnum) {
2408
- for (int i = 0 ; i < size; i++) {
2409
- if ($1 .columnInfo [i].name ) {
2410
- 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
+ }
2411
2406
}
2412
2407
}
2408
+ delete [] $1 ->columnInfo ;
2413
2409
}
2414
- delete [] $1 .columnInfo ;
2410
+
2411
+ delete $1 ;
2415
2412
}
2416
2413
if (alloc$argnum) {
2417
2414
delete [] alloc$argnum;
2418
2415
}
2419
2416
}
2420
2417
2421
- %typemap(out, fragment = " convertStrToObj" ) (ColumnInfoList) {
2422
- ColumnInfoList data = $1 ;
2418
+ %typemap(out, fragment = " convertStrToObj" ) (ColumnInfoList* ) {
2419
+ ColumnInfoList data = * $1 ;
2423
2420
size_t size = data.size ;
2424
2421
$result = PyList_New (size);
2425
2422
if ($result == NULL ) {
0 commit comments