Attention: this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.
Contains function declarations to be used to access MySQL Server. Target Modules are Colibri Modules [PXAxxx, Tegra T20, Tegra T30], WinCE 6.0 / 7.0 . More...
Macros |
|
#define | MYSQL_ERROR_STRING_LENGTH 256 |
#define | MYSQL_INSTANCE_ENDPOINT_LENGTH 64 |
#define | MYSQL_USER_NAME_LENGTH 64 |
#define | MYSQL_USER_PASSWORD_LENGTH 64 |
#define | MYSQL_QUERY_STRING_LENGTH 256 |
#define | FILENAME_BUFFER_SIZE 128 |
#define | DATA_SEND_BUFFER_SIZE 1024 |
#define | DATA_RECEIVE_BUFFER_SIZE 1024 |
Typedefs |
|
typedef struct mysql * | MYSQL |
Functions |
|
BOOL | MySqlOpen (MYSQL *mysqlAccount, const CHAR *sqlInstanceEndpoint, const CHAR *sqlUserName, const CHAR *sqlUserPassword) |
BOOL | MySqlConnect (MYSQL mysqlAccount, WORD mysqlPortNumber) |
BOOL | MySqlConnectWithSsl (MYSQL mysqlAccount, WORD mysqlPortNumber) |
BOOL | MySqlRowQuery (MYSQL mysqlAccount, const CHAR *mysqlQuery, const CHAR *resultFilePath, DWORD *columnsInTable) |
BOOL | MySqlClose (MYSQL *mysqlAccount) |
BOOL | MySqlQuit (MYSQL mysqlAccount) |
BOOL | MySqlInitDb (MYSQL mysqlAccount, const CHAR *schemaName) |
BOOL | MySqlListFields (MYSQL mysqlAccount, const CHAR *tableName, const CHAR *resultFilePath, DWORD *columnsInTable) |
BOOL | MySqlCreateDb (MYSQL mysqlAccount, const CHAR *createDbStatement) |
BOOL | MySqlDropDb (MYSQL mysqlAccount, const CHAR *schemaName) |
BOOL | MySqlPing (MYSQL mysqlAccount) |
BOOL | MySqlUpdateQuery (MYSQL mysqlAccount, const CHAR *updateQuery) |
BOOL | MySqlInsertQuery (MYSQL mysqlAccount, const CHAR *insertQuery) |
BOOL | MySqlDeleteQuery (MYSQL mysqlAccount, const CHAR *deleteQuery) |
DWORD | MySqlAffectedRows (MYSQL mysqlAccount) |
BOOL | MySqlAlterQuery (MYSQL mysqlAccount, const CHAR *alterQuery) |
BOOL | MySqlGetNumberOfRows (MYSQL mysqlAccount, const CHAR *tableName, DWORD *numberOfRows) |
BOOL | MySqlListTables (MYSQL mysqlAccount, const CHAR *dbInstanceName, const CHAR *filePath) |
void | MySqlClearError (MYSQL mysqlAccount) |
BOOL | MySqlCreateViewQuery (MYSQL mysqlAccount, const CHAR *viewQuery) |
BOOL | MySqlPrepareStatementQuery (MYSQL mysqlAccount, const CHAR *prepareQuery, DWORD *statementId, DWORD *numberOfParamters) |
BOOL | MySqlPrepareSendLongData (MYSQL mysqlAccount, DWORD statementId, DWORD parameterId, const CHAR *dataForPrepareQuery) |
BOOL | MySqlStatementExecute (MYSQL mysqlAccount, DWORD statementId, DWORD numberOfParameters, DWORD optionFlags) |
BOOL | MySqlPrepareStatementClose (MYSQL mysqlAccount, DWORD statementId) |
BOOL | MySqlPrepareStatementReset (MYSQL mysqlAccount, DWORD statementId) |
BOOL | MySqlSetMultiStatementOption (MYSQL mysqlAccount, BOOL multiStatementOn) |
BOOL | MySqlStatementFetch (MYSQL mysqlAccount, DWORD statementId) |
Contains function declarations to be used to access MySQL Server. Target Modules are Colibri Modules [PXAxxx, Tegra T20, Tergra T30], WinCE 6.0 / 7.0 .
DWORD MySqlAffectedRows | ( | MYSQL | mysqlAccount | ) |
Returns the number of rows changed, deleted, or inserted
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
Number | of rows affected Contains valid value only after successful calls to MySqlUpdate(), MySqlInsert() or MySqlDelete() |
BOOL MySqlAlterQuery | ( | MYSQL | mysqlAccount, |
const CHAR * | alterQuery | ||
) |
Add, Delete or Modify columns in the table
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | alterQuery | MySQL ALTER query statement For example: "ALTER TABLE mysqldb.TestDbTable ADD Column3 int" where mysqldb is the schema/database name and TestDbTable is the table name |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
void MySqlClearError | ( | MYSQL | mysqlAccount | ) |
Clears the MySQL error number and error string
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
BOOL MySqlClose | ( | MYSQL * | mysqlAccount | ) |
Close the handle for the MySQL connection
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
TRUE | Success |
FALSE | See WSAGetLastError() |
BOOL MySqlConnect | ( | MYSQL | mysqlAccount, |
WORD | mysqlPortNumber | ||
) |
Opens a connection to the Amazon RDS MySQL instance
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | mysqlPortNumber | Port number on which to communicate with the Amazon RDS MySQL instance If specified as 0, default MySQL port number of 3306 will be used |
TRUE | Success |
FALSE | See GetLastError() and WSAGetLastError() |
BOOL MySqlConnectWithSsl | ( | MYSQL | mysqlAccount, |
WORD | mysqlPortNumber | ||
) |
Open a conenction to the Amazon RDS MySQL instance using SSL
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | mysqlPortNumber | Port number on which to communicate with the Amazon RDS MySQL instance If specified as 0, default MySQL port number of 3306 will be used |
TRUE | Success |
FALSE | See GetLastError() and WSAGetLastError() |
BOOL MySqlCreateDb | ( | MYSQL | mysqlAccount, |
const CHAR * | createDbStatement | ||
) |
Create a new schema/database
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | createDbStatement | MySQL CREATE_DATABASE statement Example: "CREATE TABLE mysqldb.TestDbTable(Column1 int primary key auto_increment, Column2 int)" where "mysqldb" is the schema/database name and "TestDbTable" is the table name |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlCreateViewQuery | ( | MYSQL | mysqlAccount, |
const CHAR * | viewQuery | ||
) |
Create views for the database table
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | viewQuery | MySQL View query statement Example: CREATE VIEW view_name AS SELECT column_name(s) FROM table_name WHERE condition |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() To be implemented |
BOOL MySqlDeleteQuery | ( | MYSQL | mysqlAccount, |
const CHAR * | deleteQuery | ||
) |
Delete data in the table
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | deleteQuery | MySQL DELETE query statement For example: "DELETE FROM mysqldb.TestDbTable WHERE Column1 = 900" where mysqldb is the schema/database name and TestDbTable is the table name |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlDropDb | ( | MYSQL | mysqlAccount, |
const CHAR * | schemaName | ||
) |
Drop a schema/database
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | schemaName | Name of the schema/database to drop Example: "mysqldb.TestDbTable" where "mysqldb" is the schema/database name and "TestDbTable" is the table name |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlGetNumberOfRows | ( | MYSQL | mysqlAccount, |
const CHAR * | tableName, | ||
DWORD * | numberOfRows | ||
) |
Get the number of records in the table
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | tableName | Table name for which number of records has to be retrieved Example: "mysqldb.TestDbTable" where "mysqldb" is the schema/database name and "TestDbTable" is the table name |
[out] | numberOfRows | Number of records in the table |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlInitDb | ( | MYSQL | mysqlAccount, |
const CHAR * | schemaName | ||
) |
Change the default schema of the connection
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | schemaName | Name of the schema to change to |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlInsertQuery | ( | MYSQL | mysqlAccount, |
const CHAR * | insertQuery | ||
) |
Insert data in the table
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | insertQuery | MySQL INSERT query statement For example: "INSERT INTO mysqldb.TestDbTable (Column1, Column2) VALUES(900, 1000)" where mysqldb is the schema/database name and TestDbTable is the table name |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlListFields | ( | MYSQL | mysqlAccount, |
const CHAR * | tableName, | ||
const CHAR * | resultFilePath, | ||
DWORD * | columnsInTable | ||
) |
Get the column definitions of a table
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | tableName | Table name for which column definition has to be retrieved Example: "mysqldb.TestDbTable" where "mysqldb" is the schema/database name and "TestDbTable" is the table name |
[in] | resultFilePath | Pointer to the local file path string in which result will be stored |
[out] | columnsInTable | Number of columns in the table |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() Data will be in the following format: Field Type Null Key Default Extra |
BOOL MySqlListTables | ( | MYSQL | mysqlAccount, |
const CHAR * | dbInstanceName, | ||
const CHAR * | filePath | ||
) |
List tables in the database
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | dbInstanceName | Name of the MySQL database instance |
[in] | filePath | Pointer to the local file path string in which result will be stored |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlOpen | ( | MYSQL * | mysqlAccount, |
const CHAR * | sqlInstanceEndpoint, | ||
const CHAR * | sqlUserName, | ||
const CHAR * | sqlUserPassword | ||
) |
Opens a handle for the MySQL connection
[out] | mysqlAccount | Amazon RDS MySQL instance account handle |
[in] | sqlInstanceEndpoint | Endpoint address of the Amazon RDS MySQL instance |
[in] | sqlUserName | User name of the Amazon RDS MySQL instance |
[in] | sqlUserPassword | Password for the Amazon RDS MySQL instance |
TRUE | Success |
FALSE | See GetLastError() |
BOOL MySqlPing | ( | MYSQL | mysqlAccount | ) |
Check if the server connection is alive
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlPrepareSendLongData | ( | MYSQL | mysqlAccount, |
DWORD | statementId, | ||
DWORD | parameterId, | ||
const CHAR * | dataForPrepareQuery | ||
) |
Send data for a prepared statement
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | statementId | Statement Id returned from a previous call to MySqlPrepareQuery() |
[in] | parameterId | Parameter Id for the data |
[in] | dataForPrepareQuery | Data for the prepare query |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() Must be called before MySqlPrepareStatementExecute() To be implemented |
BOOL MySqlPrepareStatementClose | ( | MYSQL | mysqlAccount, |
DWORD | statementId | ||
) |
Deallocates a prepare statement query
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | statementId | Statement Id returned by call to MySqlPrepareQuery() |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() To be implemented |
BOOL MySqlPrepareStatementQuery | ( | MYSQL | mysqlAccount, |
const CHAR * | prepareQuery, | ||
DWORD * | statementId, | ||
DWORD * | numberOfParamters | ||
) |
Create a prepared statement
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | preparQuery | MySQL prepare query statement |
[out] | statementId | Statement ID use to identify the prepare statement |
[out] | numberOfParameters | Number of Parameters |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() To be implemented |
BOOL MySqlPrepareStatementReset | ( | MYSQL | mysqlAccount, |
DWORD | statementId | ||
) |
Reset the data of a prepared statement which was accumulated with MySqlPrepareSendLongData()
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | statementId | Statement Id returned by call to MySqlPrepareQuery() |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() To be implemented |
BOOL MySqlQuit | ( | MYSQL | mysqlAccount | ) |
Close the connection to the Amazon RDS MySQL instance
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlRowQuery | ( | MYSQL | mysqlAccount, |
const CHAR * | mysqlQuery, | ||
const CHAR * | resultFilePath, | ||
DWORD * | columnsInTable | ||
) |
Query the rows of Amazon RDS MySQL instance
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | mysqlQuery | MySQL SELECT Query statement For example: "SELECT * FROM mysqldb.TestDbTable" where mysqldb is the schema/database name and TestDbTable is the MySQL table name |
[in] | resultFilePath | Pointer to the local file path string in which result of MySQL query will be stored |
[out] | columnsInTable | Number of columns in the table |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |
BOOL MySqlSetMultiStatementOption | ( | MYSQL | mysqlAccount, |
BOOL | multiStatementOn | ||
) |
Set Multi statement operation
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | multiStatementOn | TRUE: Multi statements ON, FALSE: Multi statements OFF |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() To be implemented |
BOOL MySqlStatementExecute | ( | MYSQL | mysqlAccount, |
DWORD | statementId, | ||
DWORD | numberOfParameters, | ||
DWORD | optionFlags | ||
) |
Execute a statement query
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | statementId | Statement Id returned by call to MySqlPrepareQuery() |
[in] | numberOfParameters | Number of parameters returned by call to MySqlPrepareQuery() |
[in] | optionFlags | Option flags for prepare statment execution |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() To be implemented |
BOOL MySqlStatementFetch | ( | MYSQL | mysqlAccount, |
DWORD | statementId | ||
) |
Fetch a row from a existing resultset after a COM_STMT_EXECUTE.
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | statementId | Statement Id of a stored procedure |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() To be implemented |
BOOL MySqlUpdateQuery | ( | MYSQL | mysqlAccount, |
const CHAR * | updateQuery | ||
) |
Update data in the table
[in] | mysqlAccount | Handle returned by call to MySqlOpen() |
[in] | updateQuery | MySQL UPDATE query statement For example: "UPDATE mysqldb.TestDbTable SET Column2 = 1001 WHERE Column1 = 900" where mysqldb is the schema/database name and TestDbTable is the table name |
TRUE | Success |
FALSE | See WSAGetLastError() and GetLastError() |