As I mentioned already I have come up with a new version of my Python Expression Evaluator.
Besides Python expression and Regular expressions ( enclosed in slashes ) it now supports SQL statements ( which have to end with a semicolon ).
Thus you for instance can do something like this:
create table capitols ( country text, city text );
insert into capitols values ( "Germany", "Berlin" );
insert into capitols values ( "France", "Paris" );
insert into capitols values ( "UK", "London" );
select * from capitols;
This will actually create a table in my database file and thus eat up my file space. So keep in mind this is just for trying out SQL statements. I am not a cloud storage provider and won't provide space for large sets of data, so be aware that your data might get wiped out sooner or later if I have the need to clean up my file system .
Anyhow, the code to handle SQL statements is basically the code for a simple SQLite shell taken from here, enhanced a bit and thrown into my existing code of my Python Expression Evaluator.
It also handles SQL errors of course:
Python Expression Evaluator uses its own built-in table cmd_history to maintain a history of commands entered. By clicking the History button this history can be retrieved and I actually added some more jQuery code to enable the feature that when you click a line from that command history it is actually loaded into the upper most entry field so you can "re-use" a command.
So, happy, SQLing !
0 blog comments below