Category: Other

Aptilis and MySQL


Aptilis is a programing language targeted at web professionals. Because it is very simple - yet powerful - it is good for beginners too. It resembles Good'ol Basic. http://www.aptilis.com/index.html


[edit] Connection example


sub mysqlConnect(mysql_host, mysql_user, mysql_pass, mysql_db)

	_MYSQL_LAST_PACKET = -1

	if instr(mysql_host$, ":") = 0
		// if no port is stated, use default port
		mysql_host = mysql_host + ":3306" $
	end if

	hdl = open("socket://" + mysql_host $)

	msg = getPacket(hdl) $

	if checkPacketError(msg$)
		return nul[]
	end if

	// Protocol version
	protoc = getCharAt(msg$, 1)

	// Client capabilities
	if protoc = 10
		clientcap = 1
	else
		clientcap = 0
	end if

	// Server version
	strend = instr(2, msg$, chr(0)$) - 2
	serverver = mid(msg$, 2, strend) $

	// Thread id
	strend = strend + 3
	// this is a 16 bit integer:
	threadid = decodeInt(mid(msg$, strend, 2)$)

	// Salt for password scrambling
	salt = mid(msg$, strend + 4, 8) $

	tmp[0] = mysql_user $
	tmp[1] = MySQLScramble(mysql_pass$, salt$, clientcap) $
	tmp[2] = mysql_db $
	loginstr = string(2,chr(0)$) + chr(1) + chr(141) + string(4,chr(0)$) + join(tmp[], chr(0)$) $
	loginstr = chr(len(loginstr$)-3) + loginstr $

	write(hdl, loginstr$)

	msg = getPacket(hdl) $

	if checkPacketError(msg$)
		return nul[]
	end if

	ret[0] = hdl
	ret[1] = threadid
	ret[2] = serverver $
	ret[3] = protoc

	return ret[]

end mysqlConnect


[edit] Resources

You can download the API from here: http://aptilis.sourceforge.net/downloads/scripts/mysql.zip

There is documentation into archive files

Retrieved from "http://forge.mysql.com/wiki/Aptilis_and_MySQL"

This page has been accessed 1,473 times. This page was last modified 14:41, 9 August 2006.

Find

Browse
MySQLForge
Main Page
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Special pages
New pages
File list
Statistics
Bug reports
More...