forked from src-d/go-mysql-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: do not marshal strings containing JSON as a string in convert
Fixes src-d#709 When a string containing JSON (e.g. `{"a": 1, "b": true}`) is passed to JSON.Convert, it only did `json.Marshal`, so it was marshalled as a string (e.g. `"{\"a\":1,\"b\":true}"`), which made it impossible to use a string with JSON_EXTRACT, which would only receive the string. Now, JSON.Convert does a first check for strings. If it can be unmarshalled into JSON, then that JSON is marshalled and returned. Otherwise, it's a string and marshalled as such. Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
- Loading branch information
1 parent
33c1da4
commit 4cb8e85
Showing
4 changed files
with
30 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters