Db-library Common function __ function

Source: Internet
Author: User
Tags function prototype

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.

Ten . 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.

One . 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.

of . dbopen

Function prototype:

Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.