@@ -79,49 +79,52 @@ game_value Result::cmd_toParsedArray(game_state& state, game_value_parameter rig
7979 while (res->next ()) {
8080 auto_array<game_value> row;
8181
82+ auto addParsedString = [&row](const r_string& content) {
83+
84+ if (content.front () == ' [' ) {// array
85+ // attempt parse
86+ auto arrayContent = sqf::parse_simple_array (content);
87+
88+ if (state.get_evaluator ()->_errorType == game_state::game_evaluator::evaluator_error_type::gen
89+ ||
90+ (!arrayContent.empty () && arrayContent.front ().is_null ())
91+ ) {
92+ state.get_evaluator ()->_errorType = game_state::game_evaluator::evaluator_error_type::ok; // Force ignore
93+ row.emplace_back (std::move (content));
94+ } else
95+ row.emplace_back (game_value (arrayContent));
96+ } else if (
97+ content.front () == ' t' // true
98+ || content.front () == ' T' // True
99+ || content.front () == ' f' // false
100+ || content.front () == ' F' // False
101+ || (content.front () >= ' 0' && content.front () <= ' 9' )// number
102+ ) {
103+
104+ auto arrayContent = sqf::parse_simple_array (r_string (" [" sv)+content+" ]" sv);
105+
106+ if (state.get_evaluator ()->_errorType == game_state::game_evaluator::evaluator_error_type::gen
107+ || arrayContent.empty ()
108+ || arrayContent.front ().is_null ()) {
109+ state.get_evaluator ()->_errorType = game_state::game_evaluator::evaluator_error_type::ok; // Force ignore
110+ row.emplace_back (std::move (content));
111+ } else
112+ row.emplace_back (arrayContent.front ());
113+ } else {
114+ row.emplace_back (std::move (content));
115+ }
116+ };
117+
118+
82119 for (size_t i = 0u ; i < res->column_count (); ++i) {
83120
84121 switch (res->column_type (i)) {
85122 case mariadb::value::null: row.emplace_back (game_value{}); break ;
86123 case mariadb::value::date: row.emplace_back (res->get_date (i).str ()); break ;
87124 case mariadb::value::date_time: row.emplace_back (res->get_date_time (i).str ()); break ;
88125 case mariadb::value::time: row.emplace_back (res->get_time (i).str_time ()); break ;
89- case mariadb::value::string: {
90- auto content = res->get_string (i);
91-
92- if (content.front () == ' [' ) {// array
93- // attempt parse
94- auto arrayContent = sqf::parse_simple_array (content);
95-
96- if (state.get_evaluator ()->_errorType == game_state::game_evaluator::evaluator_error_type::gen
97- ||
98- (!arrayContent.empty () && arrayContent.front ().is_null ())
99- ) {
100- state.get_evaluator ()->_errorType = game_state::game_evaluator::evaluator_error_type::ok; // Force ignore
101- row.emplace_back (std::move (content));
102- } else
103- row.emplace_back (game_value (arrayContent));
104- } else if (
105- content.front () == ' t' // true
106- || content.front () == ' T' // True
107- || content.front () == ' f' // false
108- || content.front () == ' F' // False
109- || (content.front () >= ' 0' && content.front () <= ' 9' )// number
110- ) {
111-
112- auto arrayContent = sqf::parse_simple_array (r_string (" [" sv)+content+" ]" sv);
113-
114- if (state.get_evaluator ()->_errorType == game_state::game_evaluator::evaluator_error_type::gen
115- || arrayContent.empty ()
116- || arrayContent.front ().is_null ()) {
117- state.get_evaluator ()->_errorType = game_state::game_evaluator::evaluator_error_type::ok; // Force ignore
118- row.emplace_back (std::move (content));
119- } else
120- row.emplace_back (arrayContent.front ());
121- } else {
122- row.emplace_back (std::move (content));
123- }
124- } break ;
126+ case mariadb::value::string: addParsedString (res->get_string (i)); break ;
127+ case mariadb::value::blob: addParsedString (res->get_blobString (i)); break ;
125128 case mariadb::value::boolean: row.emplace_back (res->get_boolean (i)); break ;
126129 case mariadb::value::decimal: row.emplace_back (res->get_decimal (i).float32 ()); break ;
127130 case mariadb::value::unsigned8: row.emplace_back (static_cast <float >(res->get_unsigned8 (i))); break ;
0 commit comments