BASIC Developer & Support Resources > Scripting Languages

ScriptBasic 64 Bit Linux

(1/7) > >>

John:
I recently completed a project that needed to run on a 64 bit version of Ubuntu. Armando came to the rescue and was able to get scriba, the webserver, mysql and curl running under 64 bit. I tested it with the application I wrote that updates a MySQL database by accessing a webservice for new or changed activity within a specific time frame. Getting SB to run under 64 bit is nothing more than a few changes to the make file compiler options.

John:
I created a Ubuntu 10.10 64 bit instance on Amazon EC2 and ran the Bible word count script on both my local laptop (2.8 ghz) and the Amazon instance (processor info unknown).

Amazon EC2 - Ubuntu 64

real   0m39.131s
user   0m29.620s
sys   0m9.250s

HP laptop - Ubuntu 32

real   1m2.556s
user   0m27.514s
sys   0m23.629s

John:
Attached is the beginning of a complete Ubuntu 10.10 64 bit version of ScriptBasic. I will post the source when I can use setup again to build everything. The mysql, curl and libxml2 extension module shared objects have to be built by hand at the moment. The following files are included.

/etc/scriba/basic.conf.txt  ' configuration file to edit

/usr/share/scriba/include/cgi.bas  ' CGI helper functions interface module
/usr/share/scriba/include/curl.bas  ' cURL interface module
/usr/share/scriba/include/curses.bas  ' console mode mnemonics & color interface module
/usr/share/scriba/include/hash.bas  ' hashing (key pair) library interface module
/usr/share/scriba/include/mt.bas  ' multi-threaded variable sharing / session management interface module
/usr/share/scriba/include/mysql.bas  ' MySQL C API interface module
/usr/share/scriba/include/odbc.bas  ' iODBC interface module
/usr/share/scriba/include/re.bas  ' regular expression library interface module
/usr/share/scriba/include/t.bas  ' extended array to string / xml function library interface module
/usr/share/scriba/include/ux.bas  ' fork scriba at runtime interface module
/usr/share/scriba/include/xml.bas  ' GNOME libxml2 interface module
/usr/share/scriba/include/zlib.bas  ' zlib compression library interface module

/usr/local/lib/scriba/cgi.so  '  CGI extension shared object
/usr/local/lib/scriba/curl.so  ' cURL extension shared object
/usr/local/lib/scriba/curses.so  ' curses extension shared object
/usr/local/lib/scriba/hash.so  ' hash extension shared object
/usr/local/lib/scriba/mt.so  ' mt extension shared object
/usr/local/lib/scriba/mysql.so  ' MySQL extension shared object
/usr/local/lib/scriba/odbc.so  ' iODBC extension shared object
/usr/local/lib/scriba/re.so  ' regular expression extension shared object
/usr/local/lib/scriba/t.so  ' string/array tools extension shared object
/usr/local/lib/scriba/ux.so  ' FORK process extension shared object
/usr/local/lib/scriba/xml.so  ' GNOME libxml2 extension shared object
/usr/local/lib/scriba/zlib.so  ' zlib compression library extension shared object

/usr/bin/sbhttpd  ' Multi-threaded web server with in-memory session support
/usr/bin/scriba  ' command line & CGI script interpreter

The basic.conf.txt file is a minimal configuration to make including/importing extension modules easier. Use the scriba -k basic.conf.txt to generate the binary format ScriptBasic reads.

The above should allow you to write network, database, cron and text processing utilities. The web server is included if you want to do your server side scripting in Basic. (or use scriba as your CGI scripting language if session support and multi-threading isn't required)

ScriptBasic Documentation (user & developer guide and extension module documentation)

I would like to thank Armando Rivera for his help and mentoring to get this platform release built.

John:
This is an example of using the mysql extension module.

sbdb:test



--- Code: ---' MySQL Test Program

INCLUDE mysql.bas

dbh = mysql::RealConnect("localhost","USER","PSWD","sbdb")

mysql::query(dbh,"SELECT * FROM test")

WHILE mysql::FetchHash(dbh,column)

PRINTNL
PRINT column{"ID"},"\n"
PRINT column{"NAME"},"\n"
PRINTNL

WEND

PRINTNL
PRINT "The database handle is: ",dbh,"\n"
PRINT "Affected rows by SELECT: ",mysql::AffectedRows(dbh),"\n"
PRINT "Character set name is: ",mysql::CharacterSetName(dbh),"\n"
PRINT "Last error is: ",mysql::ErrorMessage(dbh),"\n"
PRINT "Client info is: ",mysql::GetClientInfo(),"\n"
PRINT "Host info is: ",mysql::GetHostInfo(dbh),"\n"
PRINT "Proto info is: ",mysql::GetProtoInfo(dbh),"\n"
PRINT "Server info is: ",mysql::GetServerInfo(dbh),"\n"
PRINT "PING result: ",mysql::Ping(dbh),"\n"
PRINT "Thread ID: ",mysql::ThreadId(dbh),"\n"
PRINT "Status is: ",mysql::Stat(dbh),"\n"

mysql::Close(dbh)

END

--- End code ---

$ scriba testmysql.sb
1
John Spikowski

The database handle is: 1
Affected rows by SELECT: 1
Character set name is: latin1
Last error is:
Client info is: 5.1.49
Host info is: Localhost via UNIX socket
Proto info is: 10
Server info is: 5.1.49-1ubuntu8.1
PING result: -1
Thread ID: 0
Status is: Uptime: 194893  Threads: 1  Questions: 2043  Slow queries: 0  Opens: 200  Flush tables: 1  Open tables: 64  Queries per second avg: 0.10

John:
This cURL extension module example downloads the ScriptBasic logo from it's project site.


--- Code: ---IMPORT curl.bas

ch = curl::init()
curl::option(ch,"URL","http://scriptbasic.org/logo.png")
curl::option(ch,"FILE","sb_logo.png")
curl::perform(ch)
curl::finish(ch)

--- End code ---


Navigation

[0] Message Index

[#] Next page

Go to full version