Connect Codea to MySQL over Socket.TCP

Hello guys,

I just wanted to quickly share my excitement with you and maybe get some brainstorming going, because I think this has some potential… but I can’t think of cool projects. Maybe someone has an idea?

I was curious if I could get mysql server to talk with Codea without relying on RESTful API’s to interact with the db.

Then I found https://github.com/openresty/lua-resty-mysql - which is a mysql adapter for a nginx server. Besides SHA1 (got mine from http://regex.info/code/sha1.lua), Codea has all dependencies, so I just modified the code and after a few try&fails I got it working. Here’s my shoutout tweet:

https://twitter.com/supacowa/status/825055235760594944

The packages are send directly to the mysql server (without php or anything) over tcp socket.

I’m a web developer by trade, so my initial idea was to create some sort of static site generator with this. The data would live in the mysql db and files could be generated and uploaded to a ftp server directly. Something like a hacker-proofed ‘content management system’. Layout creation including. Something fancy … like pixel-art websites, with animated GIF’s and the like.

I curios which applications you might have in mind…

@se24vad Wow! Great job, that looks amazing. I tried working with socket so hard and I wasn’t able to get anything to work, this is clearly something big. As for ideas of apps, I can’t really think of anything, but I think that this could be used really well for a feature inside an app. Although I highly doubt that you will do it and don’t blame you for it, I want you to release the code. This is amazing. Great job!

sorry fo waking up an old thread, but I noticed that I actually never responded back. In case anyone is experimenting with this, you find my dusty code in a Gist: https://gist.github.com/jack0088/50a18c73520422221493ebb5903f3666

I’ve installed MySQL through Mamp on my Mac and could successfully connect with Codea to my localhost.

For what it’s worth, I have a whole series of apps that I use to track vehicles, job activities, and schedules. They were written in Codea and save to a web-based D.B. I use SQL Server, but it could just as easily be My SQL. But I don’t connect using a socket. I created RESTful services to have updates from and to the app.

Easily handled over https, secure, and … it works.

@Mark this is for when you can’t or don’t want to create REST services (because of time or resources). Maybe someone wants just talk to the MySQL server and do everything else in Lua.

You don’t have to use this however, if your setup works for you. I just shared what I played around with, in case someone needs it.