Wednesday, June 27, 2007

Adding SQLite to Run BASIC

Here is some example code that runs under Run BASIC using SQLite v3.4. I haven't pushed this stuff onto the publicly hosted site. SQLite will come with the Run BASIC personal server and should be suitable for many projects. Support for other databases like Oracle, PostgreSQL, SQL Server, etc. will be added with the professional server license.

sqliteconnect #users, "test.db"
call execAndPrint "select * from users"
call execAndPrint "select count(*) from users"
#users disconnect()

sub execAndPrint query$
#users execute(query$)

while #users hasanswer()
result$ = #users nextrow$(",")
print result$
end sub

SQLite is a popular database engine provided as a library and is supported for Windows, Mac and Linux. The source code is available and is in the public domain so it is completely free. We will support the parts of Run BASIC that integrate with SQLite, but as for the specific level of conformance to the SQL standard and other technical details, see

The SQLITECONNECT #obj, "databasefile.db" statement connects to a database and sets the #obj variable to be a connection object. The connection object understands EXECUTE(), HASANSWER(), NEXTROW$() and DISCONNECT(). I'm sure there will be more commands.

Notice the NEXTROW$() method. It returns each query result row as a string, with each item delimited by the specified string ("," in the example but it could be CHR$(9) or something else). It is trivial then to use the WORD$() function to extract the information. We will certainly also add the ability to get items by name.

Wednesday, June 20, 2007

Run BASIC and the iPhone

With Apple's iPhone getting ready to ship at the end of this month I'm very excited that we will have something soon that iPhone owners can use to customize their devices by running their own programs in the iPhone's built-in Safari web browser. Run BASIC ( will be one easy way to extend the new device in the same way that many people used to use BASIC to create their own applications and games. This is really just the beginning since you can be sure that there will be so many similar kinds of telephones produced by the major cell phone makers.

I have a Treo 650 myself, and I can use it to access the Run BASIC site, but it is awkward because the web browser it includes is slow and the Treo has a tiny little screen. I am eager to see how this all works on the iPhone, and if it is compelling I may even buy one just so I can demonstrate Run BASIC wherever I am. ;-)

Thursday, June 14, 2007

Support for CSS class tags

In an earlier post I described how Run BASIC can use the DIV and CSS statements to style a web page. That works well for styling the different parts of a web page, but not for styling individual things on a page.

One new addition to Run BASIC is the ability to add a CSS class tag to an object on a web page, so that it can be manipulated.

For example the following would create a link and set a class to "button".

link #doMyBidding, "GO", [go]
#doMyBidding cssclass("button")

And the following statement would add the CSS needed to style the link (or any object that has the class tag "button"):

cssclass ".button", "{ put some css styling in here }"

Here is a link to a video demonstrating how this all works.

Sunday, June 03, 2007

Component Based Web Development

As a followup to the modules post I made a few days ago which is applicable to both Liberty BASIC and Run BASIC, Scott and I have created something very web specific for Run BASIC.

In addition to inserting graphics into a web page, Run BASIC's RENDER statement can now be used to insert a module into a web page. We have this in a rough state now. It does work, but we need to iron out a couple of things.

What is this useful for? You can now create different parts of your web application as separate programs. You load them in and render them into the page. You can also control them using their own functions.

For example you might have a blog application with different parts of the page rendered by their own modules:
  • BannerLogin
  • Navigation bar
  • Entries
  • Archive outline
  • etc.
Each component has it's own little virtual page which you can print to, embed graphics into, cls, add links and other stuff to, etc. The contents of the component are managed automatically. Only a RENDER statement is needed.

By using the DIV and CSS statements, the modules can be formatted on the web page in an attractive and useful way.

Saturday, June 02, 2007

Rumblings under the surface

I apologize for the slow progress of things lately. It only appears on the surface that progress is lacking. We've been busy doing very cool things that we plan to reveal soon. Thanks for your patience.