?? htsql.h
字號:
/* W3C Sample Code Library libwww SQL API! Simple SQL API!*//*** (c) COPYRIGHT MIT 1995.** Please first read the full copyright statement in the file COPYRIGH.*//*This module interacts with the MYSQL C client library to perform SQL operations.It is not intended as a complete SQL API but handles most of the typicalerror situations talking to an SQL server so that the caller doesn't haveto think about it.This requires that you have linked against a MySQLlibrary. See the installation instructionsfor details.This module is implemented by HTSQL.c, and it is apart of the W3C Sample Code Library.*/#ifndef HTSQL_H#define HTSQL_H#include <mysql/mysql.h>/*. The HTSQL Object.*/typedef struct _HTSQL HTSQL;extern HTSQL * HTSQL_new (const char * host, const char * user, const char * pw, int flags);extern BOOL HTSQL_delete (HTSQL * me);/*. Handling the link to the Server.( Open a connection to the SQL server)*/extern BOOL HTSQL_connect (HTSQL * me);/*( Close the link to the database)*/extern BOOL HTSQL_close (HTSQL * me);/*( You can get information about whom we are talking to by calling this function:)*/extern BOOL HTSQL_version (HTSQL * me, char ** server, unsigned int * protocol_version, char ** server_version, char ** client_version);/*( Selecting the current database)*/extern BOOL HTSQL_selectDB (HTSQL * me, const char * db);/*( Getting the raw MYSQL object)After you have connected you can get the raw MYSQL object bycalling this function*/extern MYSQL * HTSQL_getMysql (HTSQL * me);/*. SQL printf.When creating queries to send to the SQL server you need to generate a lotof SQL specific strings. This function knows most of the commonly used SQLways of handling date and time string, escaping and quoting strings and howto write integers as strings. The function works pretty much as fprintf withthe following possible format arguments: %s Writes a string as is. No quotation or escaping is performed. NULL is written as "null". %S Writes a string in quotes and escapes any special SQL characters. NULL is written as "null". %T Creates an SQL datetime stamp from a time_t variable looking like this YYYY-MM-DD HH:MM:SS. -1 is written as "null" %u Unsigned integer %l Unsigned long integer*/extern char * HTSQL_printf (char * buf, int length, char * fmt, ...);/*. Issuing a Query.You can issue a query using this function. If the connection to the serverwas dropped then it automatically tries to reconnect*/extern BOOL HTSQL_query (HTSQL * me, const char * query);/*Get information about the last inserted row's unique ID or how many rowswere affected by the last query:*/extern int HTSQL_getLastInsertId (HTSQL * me);extern int HTSQL_GetAffectedRows (HTSQL * me);/*. Handle Query Results.Call this funciton to store the SQL query result*/extern MYSQL_RES * HTSQL_storeResult (HTSQL * me);/*When you are done with a query result then call this to clean up*/extern BOOL HTSQL_freeResult (MYSQL_RES * me);/**/#endif/* @(#) $Id: HTSQL.html,v 2.1 1998/05/19 16:49:38 frystyk Exp $*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -