https://github.com/sinhapaurush/sql_to_json
A library for Yugal which input SQL query and returns data from MySQL DB/ MariaDB.
https://github.com/sinhapaurush/sql_to_json
Last synced: 11 months ago
JSON representation
A library for Yugal which input SQL query and returns data from MySQL DB/ MariaDB.
- Host: GitHub
- URL: https://github.com/sinhapaurush/sql_to_json
- Owner: sinhapaurush
- Created: 2022-06-22T08:13:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-22T08:43:34.000Z (over 3 years ago)
- Last Synced: 2025-02-12T07:25:46.492Z (about 1 year ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# SQL TO JSON
A library for Yugal which input SQL query and returns data from MySQL DB/ MariaDB.
## Installation
- Run `yugal --install https://github.com/sinhapaurush/sql_to_json.git`
- Paste following code in `string.php` file.
```php
//...
$debug_mode = true; //'true' if in development mode, 'false' for relase mode.
$kill_mysql_after_dumping = false; //false | true
//...
```
## How to use
### dumo_sql
```dump_sql(mysqli_connection, sql_query)```
Provide this function with mysqli_connection in first argument and sql query in second arguement.
This will return response in JSON format. You can decode and modify response with `json_decode` function. It will provide you with error prompt in JSON if `$debug_mode` is `true` in `string.php`.
### debug_error
```debug_error(error_message);```
This will return error message is `$debug_mode` is `true` in `string.php`, else will return "Error", in `string` data type.