a text string representing the error. msqlSelectDB() may be called multiple
times during a program s execution. Each time it is called, the server will use
the specified data base for future accesses. By calling msqlSelectDB() multiple
times, a program can switch between different databases during its execution.
msqlQuery()
int msqlQuery ( sock , query )
H
int sock ;
char * query ;
Queries are sent to the engine over the connection associated with sock as plain
text strings using msqlQuery(). As with previous releases of mSQL, a returned
value of 1 indicates an error and msqlErrMsg will be updated to contain a valid
error message. If the query generates output from the engine, such as a
SELECT statement, the data is buffered in the API waiting for the application to
retrieve it. If the application submits another query before it retrieves the data
using msqlStoreResult(), the buffer will be overwritten by any data generated
by the new query.
In previous versions of mSQL, the return value of msqlQuery() was either 1
(indicating an error) or 0 (indicating success). mSQL 2 adds to these semantics
by providing more information back to the client application via the return
code. If the return code is greater than 0, not only does it imply success, it also
indicates the number of rows "touched" by the query (i.e. the number of rows
returned by a SELECT, the number of rows modified by an update, or the
number of rows removed by a delete).
msqlStoreResult()
m_result * msqlStoreResult ( )
H
Data returned by a SELECT query must be stored before another query is
submitted or it will be removed from the internal API buffers. Data is stored
using the msqlStoreResult() function which returns a result handle to the calling
routines. The result handle is a pointer to a m_result structure and is passed to
other API routines when access to the data is required. Once the result handle is
allocated, other queries may be submitted. A program may have many result
handles active simultaneously.
msqlFreeResult()
void msqlFreeResult ( result )
H
m_result * result ;
When a program no longer requires the data associated with a particular query
result, the data must be freed using msqlFreeResult(). The result handle
associated with the data, as returned by msqlStoreResult() is passed to
<
New Page 1
Godaddy Web Hosting