Skip to content

Commit

Permalink
Merge pull request #33 from aerospike/tools-2962
Browse files Browse the repository at this point in the history
fix: TOOLS-2962 Handle boolean values on JSON bin value
  • Loading branch information
a-spiker authored Sep 17, 2024
2 parents a538109 + 397788d commit 92314db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/asql_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ print_dml_help()
fprintf(stdout, " Examples:\n");
fprintf(stdout, " \n");
fprintf(stdout, " INSERT INTO test.demo (PK, foo, bar, baz) VALUES ('key1', 123, 'abc', true)\n");
fprintf(stdout, " INSERT INTO test.demo (PK, foo, bar, baz) VALUES ('key1', CAST('123' AS INT), JSON('{\"a\": 1.2, \"b\": [1, 2, 3]}'), BOOL(1))\n");
fprintf(stdout, " INSERT INTO test.demo (PK, foo, bar, baz) VALUES ('key1', CAST('123' AS INT), JSON('{\"a\": 1.2, \"b\": [1, 2, 3], \"c\": true}'), BOOL(1))\n");
fprintf(stdout, " INSERT INTO test.demo (PK, foo, bar) VALUES ('key1', LIST('[1, 2, 3]'), MAP('{\"a\": 1, \"b\": 2}'), CAST(0 as BOOL))\n");
fprintf(stdout, " INSERT INTO test.demo (PK, gj) VALUES ('key1', GEOJSON('{\"type\": \"Point\", \"coordinates\": [123.4, -56.7]}'))\n");
fprintf(stdout, " DELETE FROM test.demo WHERE PK = 'key1'\n");
Expand Down
2 changes: 2 additions & 0 deletions src/main/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ json_to_val(json_t* j)
return (as_val*)json_number_to_integer(j);
if (json_is_real(j))
return (as_val*)as_double_new((double)json_real_value(j));
if (json_is_boolean(j))
return (as_val*)as_boolean_new(json_boolean_value(j));
return (as_val*) NULL; //&as_nil;
}

Expand Down

0 comments on commit 92314db

Please sign in to comment.