From 09da6460868a2f65fef39482476ad8e95efae782 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 18 Jul 2004 10:22:55 +0000 Subject: [PATCH] Added DBI tags. --- plugins/include/dbi.inc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/plugins/include/dbi.inc b/plugins/include/dbi.inc index c782ef11..5aa54d94 100755 --- a/plugins/include/dbi.inc +++ b/plugins/include/dbi.inc @@ -22,7 +22,7 @@ * The return value will otherwise be a resource handle, not an * 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. * 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! * 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. * 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. * Although internally fields always start from 0, @@ -44,36 +44,41 @@ native dbi_nextrow(_result=1); * One extra param: returns Float: byref * 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. * One extra param: returns Float: byref * 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 */ -native dbi_num_rows(_result); +native dbi_num_rows(Result:_result); /* 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 * mark the handle as free, so this particular handle may * 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, * this is a direct error return from the database handle/API. * For MSSQL, it returns the last error message found from a * thrown exception. */ -native dbi_error(_sql, _error[], _len); +native dbi_error(Sql:_sql, _error[], _len); /* Returns the type of database being used. So far: * "mysql", "pgsql", "mssql" */ native dbi_type(_type[], _len); + +/* Wrapper for checking results + * to avoid tag mismatches + */ +native rescode(Result:res); \ No newline at end of file