This week like the previous one will be dedicated to a POC that has been pending since the last GSoC. Like Pygame, the skulpt interpreter doesn't support sqlite3 library which is the decided library to be used to teach the SQL(Bases de Datos) lectures. The lectures aim to teach the basics like reading a database file, writing sql queries and fetching results.
What did I do this week?
I spent this week resolving some conflicts and upgrading a proof-of-concept PR that I had made earlier. This PR aims at serving as an example on which the SQL lectures can be based on. To sum up my work this week, I switched the code interpreter from Skulpt to Brython, so that I can use JS elements more directly and freely. I was also shown a solution by my mentor on how to use the database elements directly without using flags or complex logic of any sort. I ended this week by modifying the ssqlite3 wrapper that I had already written from scratch. This wrapper is supposed to almost exactly mimic the original sqlite3 library with functions such as COMMIT, ROLLBACK and BEGIN TRANSACTION.
What is coming up next?
The wrapper is still very new has limited functionality. To teach the lectures more efficiently, more functions of the original sqlite3 library has to be added. The wrapper has sql.js at its core and thus the wrapper has to be designed keeping this fact in mind too. Up next I need to work more on the wrapper and give more sqlite3 like functionalities to it. Only than can we move forward with designing the final lectures.
Did I get stuck anywhere?'
Although most of the upgrade was not major, I had a difficult time finding out a way to implement the load database from a file functionality.
base_datos = connect('surfers.db')
This line loads the database surfers.db to the variable base_datos. Implementing this using sql.js was troublesome for me as there is no straightforward method to load a database in sql.js. The closest one can get is to first convert the database into an array buffer and then load the array buffer. Figuring out this bit took some tinkering and surfing stack overflow 😂, but I found a solution that served our needs.