| |
![]() |
![]() |
| tdbSQL - The first SQL Server based on tdbengine - easysql.mod |
|
easysql.mod - The tdbengine library This module provides all functions you need to connect to and query a running tdbSQL server from your tdbengine-built cgi application. Functions tdbsql_connect(connectstring : String) : Integer Uses the information given in connectstring to connect to a tdbSQL server. connectstring has to be of the following scheme: "user[:password]@host[:port][/database]" If a connection could be established a valid handle will be returned which will be needed for all further actions on the tdbSQL server tdbsql_disconnect(handle : integer) : integer Tells the tdbSQL server to disconnect now from it and then closes the connection immediately. It's a good programming style to disconnect - even if you that tdbengine closes the connection as soon as it closes your module. tdbsql_query(handle : integer; query : string; var aResult : String[,]; var rows,cols : integer) : integer Sends any SQL statement to a tdbSQL server. The statement is represented by the string query which might contain a short query or a reference to a ramtext (eg: query="ramtext:myquery"). It's important that a ramtext-reference MUST have "ramtext:" as the first 8 characters. aResult is a referenced two-dimensional array which will hold the query result if successfull. The references to rows and cols will keep the bounderies of the array to be returned. If the query led to an error the result of the function will be 0, else it's 1. In case of an error reported you can get closer information on it by uses the global variables tdbsql_error for a error text and tdbsql_errcode for the corresponding error code. tdbsql_datetime(handle : integer;var date : integer; var time : real ) : integer This function is almost absolutely useless - but good for testing. It queries the servers current date and time. Both values will be place in the references variables date and time. tdbsql_serverinfo(handle : integer; dest : String) : integer Receives a list of key/value pairs from the tdbSQL server. This list contains some statistical data about the tdbSQL server and will be added to the text file behind "dest". if dest references a ini file which already has a section header (eg: [tdbsql_info]) then you can easily access the values via GetIdent() by their names tdbsql_flushrights(handle : integer ) : Integer Makes changed tdbsql right management take effect. Only will succeed in case of may_RELOAD in system user table is set to YES/1 tdbsql_createdb(handle : Integer; database : String) : Integer Creates a new database without using a SQL statement Only will succeed in case of may_CREATE in system user table is set to YES/1 Note: This can be done via a SQL statement, too ("CREATE DATABASE name;") tdbsql_dropdb(handle : Integer; database : String) : Integer Drops a database without using a SQL statement Only will succeed in case of may_DROP in system user table is set to YES/1 Note: This can be done via a SQL statement, too ("DROP DATABASE name;") |