Added DBI tags.

This commit is contained in:
David Anderson 2004-07-18 10:22:55 +00:00
parent fd9666d068
commit 09da646086

View File

@ -22,7 +22,7 @@
* The return value will otherwise be a resource handle, not an * The return value will otherwise be a resource handle, not an
* OK code or cell pointer. * OK code or cell pointer.
*/ */
native dbi_connect(_host[], _user[], _pass[], _dbname[], _error[]="", _maxlength=0); native Sql:dbi_connect(_host[], _user[], _pass[], _dbname[], _error[]="", _maxlength=0);
/* This will do a simple query execution on the SQL server. /* This will do a simple query execution on the SQL server.
* If it fails, it will return a number BELOW ZERO (0) * If it fails, it will return a number BELOW ZERO (0)
@ -30,12 +30,12 @@ native dbi_connect(_host[], _user[], _pass[], _dbname[], _error[]="", _maxlength
* If greater than zero, make sure to call dbi_free_result() on it! * If greater than zero, make sure to call dbi_free_result() on it!
* The return is a handle to the result set * The return is a handle to the result set
*/ */
native dbi_query(_sql, _query[], {Float,_}:...); native Result:dbi_query(Sql:_sql, _query[], {Float,_}:...);
/* Returns 0 on failure or End of Results. /* Returns 0 on failure or End of Results.
* Advances result pointer by one row. * Advances result pointer by one row.
*/ */
native dbi_nextrow(_result=1); native dbi_nextrow(Result:_result=1);
/* Gets a field by number. Returns 0 on failure. /* Gets a field by number. Returns 0 on failure.
* Although internally fields always start from 0, * Although internally fields always start from 0,
@ -44,36 +44,41 @@ native dbi_nextrow(_result=1);
* One extra param: returns Float: byref * One extra param: returns Float: byref
* Two extra param: Stores string with length * Two extra param: Stores string with length
*/ */
native dbi_field(_result, _fieldnum, {Float,_}:... ); native dbi_field(Result:_result, _fieldnum, {Float,_}:... );
/* Gets a field by name. Returns 0 on failure. /* Gets a field by name. Returns 0 on failure.
* One extra param: returns Float: byref * One extra param: returns Float: byref
* Two extra param: Stores string with length * Two extra param: Stores string with length
*/ */
native dbi_result(_result, _field[], {Float,_}:... ); native dbi_result(Result:_result, _field[], {Float,_}:... );
/* Returns the number of rows returned from a query /* Returns the number of rows returned from a query
*/ */
native dbi_num_rows(_result); native dbi_num_rows(Result:_result);
/* Frees memory used by a result handle. Do this or get memory leaks. /* Frees memory used by a result handle. Do this or get memory leaks.
*/ */
native dbi_free_result(_result); native dbi_free_result(Result:_result);
/* Closes a database handle. Internally, it will also /* Closes a database handle. Internally, it will also
* mark the handle as free, so this particular handle may * mark the handle as free, so this particular handle may
* be re-used in the future to save time. * be re-used in the future to save time.
*/ */
native dbi_close(_sql); native dbi_close(Sql:_sql);
/* Returns an error message set. For PGSQL and MySQL, /* Returns an error message set. For PGSQL and MySQL,
* this is a direct error return from the database handle/API. * this is a direct error return from the database handle/API.
* For MSSQL, it returns the last error message found from a * For MSSQL, it returns the last error message found from a
* thrown exception. * thrown exception.
*/ */
native dbi_error(_sql, _error[], _len); native dbi_error(Sql:_sql, _error[], _len);
/* Returns the type of database being used. So far: /* Returns the type of database being used. So far:
* "mysql", "pgsql", "mssql" * "mysql", "pgsql", "mssql"
*/ */
native dbi_type(_type[], _len); native dbi_type(_type[], _len);
/* Wrapper for checking results
* to avoid tag mismatches
*/
native rescode(Result:res);