The library and header file will be installed by default into /usr/local/
Hughes/lib and /usr/local/Hughes/include respectively.
Like the mSQL engine, the API supports debugging via the MSQL_DEBUG
environment variable. Three debugging modules are currently supported by the
API: query, api, and malloc. Enabling "query" debugging will cause the API to
print the contents of queries as they are sent to the server. The "api" debug
modules causes internal information, such as connection details, to be printed.
Details about the memory used by the API library can be obtained via the
"malloc" debug module. Information such as the location and size of malloced
blocks and the addresses passed to free() will be generated. Multiple debug
modules can be enabled by setting MSQL_DEBUG to a colon separated list of
module names. For example setenv MSQL_DEBUG api:query
Query Related Functions
msqlConnect()
G
int msqlConnect ( host )
H
char * host ;
msqlConnect() forms an interconnection with the mSQL engine. It takes as its
only argument the name or IP address of the host running the mSQL server. If
NULL is specified as the host argument, a connection is made to a server
running on the localhost using the UNIX domain socket /dev/msqld. If an error
occurs, a value of 1 is returned and the external variable msqlErrMsg will
contain an appropriate text message. This variable is defined in "msql.h".
If the connection is made to the server, an integer identifier is returned to the
calling function. This values is used as a handle for all other calls to the mSQL
API. The value returned is in fact the socket descriptor for the connection. By
calling msqlConnect() more than once and assigning the returned values to
separate variables, connections to multiple database servers can be maintained
simultaneously.
In previous versions of mSQL, the MSQL_HOST environment variable could
be used to specify a target machine if the host parameter was NULL. This is no
longer the case.
msqlSelectDB()
int msqlSelectDB ( sock , dbName )
H
int sock ;
char * dbName ;
Prior to submitting any queries, a database must be selected. msqlSelectDB()
instructs the engine which database is to be accessed. msqlSelectDB() is called
with the socket descriptor returned by msqlConnect() and the name of the
desired database. A return value of 1 indicates an error with msqlErrMsg set to
<
New Page 1
Godaddy Web Hosting