msqlSelectDB(3)

NAME
msqlSelectDB - Select a database

SYNOPSYS
#include <msql.h>

msqlSelectDB(int sock, char *dbName);

DESCRIPTION
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(3) and the name of the desired database. msqlSelectDB() may be called multiple times during a programs execution. Each time it is called, the server will use the specified database for future accesses. By calling msqlSelectDB() multiple times, a program can switch between different databases during its execution.

RETURN VALUE
On success 0 is returned. If an error occurs, a value of -1 is returned and the variable msqlErrmsg contains an appropriate text message. This variable is defined in <msql.h>.

SEE ALSO
msqlConnect(3), msqld(8), msql(5).