This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Gumball's profile picture

CC-SQL | A bridge between Lua and MySQL

Started by Gumball, 21 June 2016 - 03:35 AM
Gumball #1
Posted 21 June 2016 - 05:35 AM
I think I've created something cool for everyone :)/>
I don't know why someone would have a purpose for it, but it is quite cool.
Basically you can connect to a MySQL database and give it a query, and it returns values :D/>
Basically I set up a bridge on one of my servers so that you can send a post request to it containing the credentials and query, and it returns rows if you had a SELECT query sent against the database, or something similar.

Pastebin for utility:
9CAHmXXr

Also, the server returns the rows in the JSON format, so you have to use a decoder.
Luckily I found one made by ElvishJerricco, and since I don't want to directly distribute the utility in my own post, i'll just give a link to the post.
The amazing tool
was created by the awesome ElvishJerricco.

To-do list:
SpoilerI don't have any ideas yet.

Change logs:
SpoilerV1.1: 9CAHmXXr
*Changed query to queryDatabase
-Added queryServer, which is for doing things on a MySQL server, but not in a database itself.

V1.0: uZ6bCcjN
First release. Woot
Edited on 21 June 2016 - 05:49 AM
Lego Stax #2
Posted 21 June 2016 - 05:42 AM
Sounds awesome and useful for people!

Your "The amazing tool" link actually links to "The%20Amazing%20tool"…I think you meant this: http://www.computercraft.info/forums2/index.php?/topic/5854-json-api-v201-for-computercraft
Gumball #3
Posted 21 June 2016 - 05:55 AM
Sounds awesome and useful for people!

Your "The amazing tool" link actually links to "The%20Amazing%20tool"…I think you meant this: http://www.computerc...r-computercraft

Yeah xD
I'll fix that.
Gumball #4
Posted 21 June 2016 - 06:22 AM
HMMMMMM

I might make something similar to PhpMyAdmin
LuaMyAdmin? ;)/>
ScarehGhoost #5
Posted 14 July 2016 - 03:12 AM
http://pastebin.com/dkhJZHUp

wrote a better frontend
ebernerd #6
Posted 14 July 2016 - 06:12 AM
This is cool, but, unless I understand this wrong, can't someone edit the file and see the db username and password?
ScarehGhoost #7
Posted 14 July 2016 - 10:35 AM
This is cool, but, unless I understand this wrong, can't someone edit the file and see the db username and password?
you mean like literally every other lua mysql wrapper?

that's why you do mysql queries in a place nobody can access and if someone who u dont want accessing the sql to query, u network it.
The Crazy Phoenix #8
Posted 14 July 2016 - 11:38 AM
This is cool, but, unless I understand this wrong, can't someone edit the file and see the db username and password?
you mean like literally every other lua mysql wrapper?

that's why you do mysql queries in a place nobody can access and if someone who u dont want accessing the sql to query, u network it.

Even more fun… Overwrite fs.isReadOnly and fs.open to prevent people from reading / writing.
Gorzoid #9
Posted 15 July 2016 - 05:23 PM
This is cool, but, unless I understand this wrong, can't someone edit the file and see the db username and password?
you mean like literally every other lua mysql wrapper?

that's why you do mysql queries in a place nobody can access and if someone who u dont want accessing the sql to query, u network it.
Just remember you are doing this all through bluebirds websites so you are trusting him with your database info. So you know, don't use any important databases.
Lemmmy #10
Posted 15 July 2016 - 06:07 PM
Just remember you are doing this all through bluebirds websites so you are trusting him with your database info. So you know, don't use any important databases.

i can see this being a major no-thank-you - thanks for bringing this to attention
Edited on 15 July 2016 - 04:07 PM