Skip to content

Commit d53da91

Browse files
committed
modify data-type mapping
1 parent ff45c91 commit d53da91

6 files changed

Lines changed: 177 additions & 310 deletions

File tree

src/RowKeyPredicate.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace griddb {
2222

23-
RowKeyPredicate::RowKeyPredicate(GSRowKeyPredicate *predicate): mPredicate(predicate),
23+
RowKeyPredicate::RowKeyPredicate(GSRowKeyPredicate *predicate, GSType type): mPredicate(predicate), mType(type),
2424
timestamp_output_with_float(false){
2525
}
2626
/**
@@ -149,12 +149,13 @@ namespace griddb {
149149
* Get key type. Convert from C-API: gsGetPredicateKeyType
150150
*/
151151
GSType RowKeyPredicate::get_key_type() {
152-
GSType key;
153-
GSResult ret = gsGetPredicateKeyType(mPredicate, &key);
154-
if (ret != GS_RESULT_OK) {
155-
throw new GSException(mPredicate, ret);
156-
}
157-
return key;
152+
return mType;
153+
// GSType key;
154+
// GSResult ret = gsGetPredicateKeyType(mPredicate, &key);
155+
// if (ret != GS_RESULT_OK) {
156+
// throw new GSException(mPredicate, ret);
157+
// }
158+
// return key;
158159
}
159160
/*
160161
* Returns the value of Row key at the start and end position of the range condition

src/RowKeyPredicate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ namespace griddb {
2929

3030
class RowKeyPredicate {
3131
GSRowKeyPredicate *mPredicate;
32+
GSType mType;
3233

3334
friend class Store;
3435

@@ -69,7 +70,7 @@ class RowKeyPredicate {
6970
GSType get_key_type();
7071

7172
private:
72-
RowKeyPredicate(GSRowKeyPredicate *predicate);
73+
RowKeyPredicate(GSRowKeyPredicate *predicate, GSType type);
7374

7475
};
7576

src/RowSet.cpp

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
namespace griddb {
2222

2323
RowSet::RowSet(GSRowSet *rowSet, GSContainerInfo *containerInfo, GSRow *gsRow) :
24-
mRowSet(rowSet), mContainerInfo(containerInfo), mRow(gsRow), timestamp_output_with_float(false) {
24+
mRowSet(rowSet), mContainerInfo(containerInfo), mRow(gsRow),
25+
timestamp_output_with_float(false), typeList(NULL) {
2526
if (mRowSet != NULL) {
2627
mType = gsGetRowSetType(mRowSet);
2728
} else {
28-
throw new GSException(mRowSet, "mRowSet is NULL");
29+
throw GSException(mRowSet, "mRowSet is NULL");
2930
}
3031
}
3132
/**
@@ -47,6 +48,9 @@ namespace griddb {
4748
}
4849
RowSet::~RowSet() {
4950
close();
51+
if (typeList) {
52+
free(typeList);
53+
}
5054
}
5155
/**
5256
* Close rowset.
@@ -66,7 +70,7 @@ namespace griddb {
6670
GSResult ret = gsUpdateCurrentRow(mRowSet, mRow);
6771

6872
if (ret != GS_RESULT_OK) {
69-
throw new GSException(mRowSet, ret);
73+
throw GSException(mRowSet, ret);
7074
}
7175
}
7276
/**
@@ -77,7 +81,7 @@ namespace griddb {
7781
if (*hasNextRow) {
7882
GSResult ret = gsGetNextRow(mRowSet, mRow);
7983
if (ret != GS_RESULT_OK) {
80-
throw new GSException(mRowSet, ret);
84+
throw GSException(mRowSet, ret);
8185
}
8286
rowdata->set_from_row(mRow);
8387
}
@@ -115,7 +119,7 @@ namespace griddb {
115119
void RowSet::remove() {
116120
GSResult ret = gsDeleteCurrentRow(mRowSet);
117121
if (ret != GS_RESULT_OK) {
118-
throw new GSException(mRowSet, ret);
122+
throw GSException(mRowSet, ret);
119123
}
120124
}
121125

@@ -167,4 +171,24 @@ namespace griddb {
167171
}
168172
}
169173

174+
/**
175+
* Support put row
176+
*/
177+
GSType* RowSet::getGSTypeList(){
178+
if (typeList == NULL){
179+
typeList = (GSType*) malloc(sizeof(GSType) * mContainerInfo->columnCount);
180+
for (int i = 0; i < mContainerInfo->columnCount; i++){
181+
typeList[i] = mContainerInfo->columnInfoList[i].type;
182+
}
183+
}
184+
return typeList;
185+
}
186+
187+
/**
188+
* Support put row
189+
*/
190+
int RowSet::getColumnCount(){
191+
return mContainerInfo->columnCount;
192+
}
193+
170194
}

src/RowSet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class RowSet {
3838
GSRowSet *mRowSet;
3939
GSContainerInfo *mContainerInfo;
4040
GSRow *mRow;
41+
GSType* typeList;
4142

4243
friend class Query;
4344

@@ -59,6 +60,8 @@ class RowSet {
5960
QueryAnalysisEntry* get_next_query_analysis();
6061
AggregationResult* get_next_aggregation();
6162
void next_row(Row* rowdata, bool* hasNextRow);
63+
GSType* getGSTypeList();
64+
int getColumnCount();
6265

6366
private:
6467
RowSet(GSRowSet *rowSet, GSContainerInfo *containerInfo, GSRow *mRow);

src/Store.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ namespace griddb {
143143
throw GSException(mStore, ret);
144144
}
145145

146-
return new RowKeyPredicate(predicate);
146+
return new RowKeyPredicate(predicate, type);
147147
}
148148
/**
149149
* New creation or update operation is carried out on an arbitrary number of rows of multiple Containers, with the request unit enlarged as much as possible.

0 commit comments

Comments
 (0)