Commit a3209cd2 authored by yiwenshao's avatar yiwenshao

modify reuse.cc:rawMySQLReturnValue_to_ResType to handle null input

parent 49d287e7
...@@ -225,7 +225,8 @@ main(int argc,char**argv) { ...@@ -225,7 +225,8 @@ main(int argc,char**argv) {
SharedProxyState *shared_ps = SharedProxyState *shared_ps =
new SharedProxyState(ci, embeddedDir , master_key, determineSecurityRating()); new SharedProxyState(ci, embeddedDir , master_key, determineSecurityRating());
assert(shared_ps!=NULL); assert(shared_ps!=NULL);
std::string query1 = "insert into student values(1,\"ZHAOYUN\"),(2,'XC'),(3,'KK')"; //std::string query1 = "insert into student values(1,\"ZHAOYUN\"),(2,'XC'),(3,'KK')";
std::string query1 = "insert into student values(NULL)";
std::vector<std::string> querys{query1}; std::vector<std::string> querys{query1};
for(auto item:querys){ for(auto item:querys){
std::cout<<item<<std::endl; std::cout<<item<<std::endl;
......
...@@ -51,7 +51,7 @@ main() { ...@@ -51,7 +51,7 @@ main() {
ConnectionInfo ci("localhost", "root", "letmein",3306); ConnectionInfo ci("localhost", "root", "letmein",3306);
SharedProxyState *shared_ps = new SharedProxyState(ci, embeddedDir , master_key, determineSecurityRating()); SharedProxyState *shared_ps = new SharedProxyState(ci, embeddedDir , master_key, determineSecurityRating());
assert(shared_ps!=NULL); assert(shared_ps!=NULL);
std::string query1 = "insert into child values(1,\"zh Z D D\")"; std::string query1 = "insert into student values(NULL)";
std::vector<std::string> querys{query1}; std::vector<std::string> querys{query1};
for(auto item:querys){ for(auto item:querys){
std::cout<<item<<std::endl; std::cout<<item<<std::endl;
......
This diff is collapsed.
...@@ -121,8 +121,9 @@ ResType rawMySQLReturnValue_to_ResType(bool isNULL,rawMySQLReturnValue *inRow,in ...@@ -121,8 +121,9 @@ ResType rawMySQLReturnValue_to_ResType(bool isNULL,rawMySQLReturnValue *inRow,in
for(auto inRows:inRow->rowValues) { for(auto inRows:inRow->rowValues) {
std::vector<Item *> curTempRow = itemNullVector(types.size()); std::vector<Item *> curTempRow = itemNullVector(types.size());
for(int i=0;i< (int)(inRows.size());i++){ for(int i=0;i< (int)(inRows.size());i++){
curTempRow[i] = (MySQLFieldTypeToItem(types[i],inRows[i]) ); if(inRows[i]!="NULL")
} curTempRow[i] = (MySQLFieldTypeToItem(types[i],inRows[i]));//why unsinged processing is not needed here?
}
rows.push_back(curTempRow); rows.push_back(curTempRow);
} }
return ResType(true,0,in_last_insert_id,std::move(names),std::move(types),std::move(rows)); return ResType(true,0,in_last_insert_id,std::move(names),std::move(types),std::move(rows));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment