Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql example #11

Open
Gyfal opened this issue Nov 27, 2022 · 1 comment
Open

Mysql example #11

Gyfal opened this issue Nov 27, 2022 · 1 comment

Comments

@Gyfal
Copy link

Gyfal commented Nov 27, 2022

I would really like to store json in mysql, but here's the problem to get a value from Mysql, we need to know the length of the string ( cache_get_value_name), it is possible to somehow bypass this system or make some kind of crutch. p.s: I do not know the length that will come to me, because this is a dynamic list

@TommyB123
Copy link
Collaborator

There's currently no way around that. The parse function needs a buffer size, otherwise it won't work. I would recommend against storing huge JSON nodes in MySQL anyway since it's not very practical with pawn. If you're only storing a small bit of extra JSON data, you should be able to figure out how big your string needs to be by creating some sample data and counting the characters.

Alternatively, you can use JSON_SaveFile and JSON_ParseFile to get around needing to know a buffer size at compile time. You'll have to redo your code to use those files rather than your existing database, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants