1. Dbcmd and Dbfcmd
Function prototype:
dbcmd (dbprocess *proc,char * sql);
dbcmd (Dbprocess *proc, char * Format,char *args);
Instance
dbcmd (Proc, "select * from Users where user= ' xingxing ')";
Char *user= "xingxing";
Dbfcmd (Proc, "select * from Users where user= '%s '", user);
Function: This function mainly constructs the SQL statement, one is with the parameter, one does not take the parameter.
2. dbsqlexec
Function prototype:
dbsqlexec (Dbprocess *proc);
Instance:
Dbsqlexec (proc);
Function: This function is responsible for executing the SQL statement you have constructed.
3. dbresults
Function prototype:
Dbrerults (Dbprocess *proc);
Instance:
Dbrerults (proc);
Function: Get the execution result of SQL statement. The return value if No_more_results=0, indicates that the SQL query is null (that is, there is no result that satisfies the condition), if (FAIL) =-1, the query is faulted, if (SUCCESS) = 1, the result is not empty.
4. Dbrows (All caps)
Function prototype:
Dbrows (Dbprocess *proc);
Instance:
Dbrows (proc);
Function: Take out a row of information.
5. Dbbind
Function prototype:
Dbbind (Dbprocess *proc,int colmn,
Instance:
Dbbind (dbproc, 1, Stringbind, (dbint) 0, (BYTE dbfar *) x25addr);
Function: Bind the results of the SQL query to a variable. The first parameter is the handle taken from the database, and the second is the field that corresponds to the query in your SELECT statement (note: Must be bound in the select order, such as select User,password from Hist1, if the value is 1, the bound user) , the third parameter is the type of the bound field, and the last parameter is the bound variable.
6. dbnextrow
Function prototype:
dbnextrow (Dbprocess *proc);
Function: This function will take out every row that satisfies the SQL statement, the return value is 0, and the return value is-1 error.
7. Dbcancel
Function prototype:
Dbcancel (Dbprocess *proc);
Function: Empty the last query from the data set, if it is a handle, each time you rerun the SELECT statement to call it empty the results, otherwise the database will be an error.
8. Dbclose
Function prototype:
Dbclose (Dbprocess *proc);
Function: Closes the handle. The handle must be closed when it is no longer in use.
9. Dbinit
Function prototype: Dbinit ()
Function: Initial recognition of the database connection. Error return value of-1.
10. Dblogin
Function prototype: Loginrec *dblogin ();
Dbsetluser (Login,soft); Set the database user
Dbsetlpwd (login,softpass);//set password
Function: Connect the database based on user name and password.
11. Dbcount
Function prototype:
Dbcount (Dbprocess *proc);
Function: This function will get the number of rows processed by the SQL result set, which can be used to determine if your SELECT statement is handled correctly.
12. Dbopen
Function prototype:
DBPROCESS * dbopen (loginrec *login,null);
Function: Returns a handle to an operation database.
Another two functions about database error information are introduced:
dberrhandle (int *err);
Dbmsghandle (int* err);