Now available !
Asql is a library for direct connections with Mysql, suitable for Adobe Flash, AIR and Flex. Project was developed as an example for a few developers. Right now theres an alpha version available for download.
More info on the blog, forum and below
Resources
FAQ
What is ASQL ?
Its an action script 3 library for direct connections with data base servers, currently only MYSQL, usable with any flashplayer version 9 and later enviroment, such as flash CS3/CS4, flex and apollo.
What is the difference between normal/standard connecting to database and this library ? Are there any advantages ?
Normally flashplayer connects to http server like apache, then its request goes to server side language like php, php connects to database and returns the result to the player. Problem is, that typical communication offers only string type support (http) Amfphp (and other remoting technologies) enables to transparently retrieve data from database of any type, but stills uses php, server side and client side parsing. ASQL connects DIRECTLY to the MYSQL server, without using any http server, using binary sockets and ByteArray class that were addded to action script in flash player 9. Main advantage is, that server doesnt have to parse your request, you operate directly on database system, with sql.
Next advatange is, that you have got
a permanent connection to the dbase, so in a case where there are many operation on dbase, its much more faster.
Does it make any security issues ?
If you understand, how does this work, and what is swf`s main security problem, you probably know what security issues this kind of communication creates.
When you place your login data into swf, anyone will be able to read it (swf`s are easy to decompile), so you have to restrict users privillages on the Mysql side. If your apps need to be public, then you need to get how does it work, before using this library.
Otherwise ( i.e. administration ) its the best way ever.
There also an option to still use remoting tech, as an security layer, while inserting the data, and use ASql for its speed boost, when selecting data from dbase.
Right now you can think, that this could have no chance to be a backend for a bigger structure (like user system) since you can`t limit user to only data that belongs to him, since you would have to create second system, as you always do, to fulfill the security need. For now, best thing you can get from this is speed, and easy way to get data from the dbase, but in some bigger systems, security might be a problem ... but theres a catch. You can keep the security, but in mysql 5.0 ( and other sql systems, like MS SQL) ! There are stored procedures available , wich is exactly what you need. User wont be able to operate directly on raw data, but only through procedures (functions), and you can limit users possibilities in there. MSSQL has its T-SQL, wich is much more powerfull then Mysql dialect, and lets you do this from the start.
What about performance ?
For now there were no true test of performance, for bugs etc., but ie. parsing ~7000 rows with 6 columns took less then 300 ms, and thats more then enough.
More, we did a bit different test, we did a query wich result was 1000 rows, 10 columns, with one long blob field, 50 kb in every row, wich gives you ~40mb for the result. Parsing took less then a sec (and less then 2secs after switching my notebook to battery mode ;) ) Cool enough ?
What MYSQL types does it support ?
Right now it handles all the types included in php 4.1 including blob type (wich equivalent
in as 3 is ByteArray class wich gives you many really cool options, like easy bitmap (jpg, gif, swf and all other staff as3 can load and display ) saving to dbase. Flashplayer can load any type of file with URLlLoader, and due to this, you can convert it to ByteArray and place it in a dbase with one query, and get it back the same easy way, as a ByteArray (even if flashplayer wont be able to understand what it is)
Displaying image format saved as a ByteArray flashplayers can do in a native way, using Loader class.
What versions of MYSQL does it support ? Will it be updated for others ?
Only 4.1 for now, and it may support 5.0 ( unofficially it does support 5.0 ) without any problems, after small corrections 4.0 as well.
What license is it under ?
Right now there was no true release, just an example of use, but it will be os project most probably without any restrictions for commercial use, only with some donation system. Its evolution depends strictly on my spare time.
What laguage is it rewritten from ?
Its not based on any other language, it was based on the protocol specification ( not only official specs, cause its not very usefull ), thanks to this, it is optimized for the action script. Only thing I needed from php client sources was old authorization algorithm.
Who`s developing the project ?
I am
How does its API look like ?
More on forum
About
Project was developed as an example, for small meeting of a few polish developersl, just to show its possible. As you see it could be quite usefull, so it would be a shame to hide it in the hdd. Right now I`am not thinking about complex support of it, due to my lack of time, but I will try to do a few corrections. Things may change, of course.
Examples - Flash player 9 required
ASQL Admin - I`ve never developed in flex before, so it might go down anytime. If you have Mysql 4.1 you can try to connect. You need to have a few thing to make it work - crossdomain.xml file placed on your http server on the same domain, that let connections from any domain, and a public user that is able to connect from any domain (in his host column he need to have % instead of name) You wont make it connect to your local server ! You need do download whole package and test locally.
Theres no any "loading ..." or progress bar in there, so if you want to get some bigger result just wait. Blob works, but very often just crashes due to the eof byte error. And one more annoying thing, it wont reconnect, so after several seconds of doing nothing it will go down, and youll have to refresh and type user-pass again. Hey, it was a long night yesterday :)
Here you can download whole package, if you would like to test it locally.
Ill add some default data base on mooska.pl for this one, but this will take some time.
Ive got a few other examples, but it need some time to make it useable.
Downloads
Source code, check also API example


