Skip to main content

Cloud Rds Lib API

danger

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...

Data Structures

struct  mysql 

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 mysqlMYSQL
 

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)
 

Detailed Description

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 .
Author:
Rev:
Date:
2014-01-08 10:00:00 +0530 (Wed, 08 Jan 2014)

Function Documentation

DWORD MySqlAffectedRows(MYSQL mysqlAccount) 
Returns the number of rows changed, deleted, or inserted
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
Return values
Numberof 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
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]alterQueryMySQL 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
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
void MySqlClearError(MYSQL mysqlAccount) 
Clears the MySQL error number and error string
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
Return values
  
BOOL MySqlClose(MYSQLmysqlAccount) 
Close the handle for the MySQL connection
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
Return values
TRUESuccess
FALSESee WSAGetLastError()
BOOL MySqlConnect(MYSQL mysqlAccount,
  WORD mysqlPortNumber 
 )  
Opens a connection to the Amazon RDS MySQL instance
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]mysqlPortNumberPort number on which to communicate with the Amazon RDS MySQL instance If specified as 0, default MySQL port number of 3306 will be used
Return values
TRUESuccess
FALSESee GetLastError() and WSAGetLastError()
BOOL MySqlConnectWithSsl(MYSQL mysqlAccount,
  WORD mysqlPortNumber 
 )  
Open a conenction to the Amazon RDS MySQL instance using SSL
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]mysqlPortNumberPort number on which to communicate with the Amazon RDS MySQL instance If specified as 0, default MySQL port number of 3306 will be used
Return values
TRUESuccess
FALSESee GetLastError() and WSAGetLastError()
BOOL MySqlCreateDb(MYSQL mysqlAccount,
  const CHAR * createDbStatement 
 )  
Create a new schema/database
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]createDbStatementMySQL 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
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlCreateViewQuery(MYSQL mysqlAccount,
  const CHAR * viewQuery 
 )  
Create views for the database table
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]viewQueryMySQL View query statement Example: CREATE VIEW view_name AS SELECT column_name(s) FROM table_name WHERE condition
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError() To be implemented
BOOL MySqlDeleteQuery(MYSQL mysqlAccount,
  const CHAR * deleteQuery 
 )  
Delete data in the table
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]deleteQueryMySQL 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
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlDropDb(MYSQL mysqlAccount,
  const CHAR * schemaName 
 )  
Drop a schema/database
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]schemaNameName of the schema/database to drop Example: "mysqldb.TestDbTable" where "mysqldb" is the schema/database name and "TestDbTable" is the table name
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlGetNumberOfRows(MYSQL mysqlAccount,
  const CHAR * tableName,
  DWORD * numberOfRows 
 )  
Get the number of records in the table
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]tableNameTable 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]numberOfRowsNumber of records in the table
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlInitDb(MYSQL mysqlAccount,
  const CHAR * schemaName 
 )  
Change the default schema of the connection
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]schemaNameName of the schema to change to
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlInsertQuery(MYSQL mysqlAccount,
  const CHAR * insertQuery 
 )  
Insert data in the table
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]insertQueryMySQL 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
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlListFields(MYSQL mysqlAccount,
  const CHAR * tableName,
  const CHAR * resultFilePath,
  DWORD * columnsInTable 
 )  
Get the column definitions of a table
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]tableNameTable 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]resultFilePathPointer to the local file path string in which result will be stored
[out]columnsInTableNumber of columns in the table
Return values
TRUESuccess
FALSESee 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
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]dbInstanceNameName of the MySQL database instance
[in]filePathPointer to the local file path string in which result will be stored
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlOpen(MYSQLmysqlAccount,
  const CHAR * sqlInstanceEndpoint,
  const CHAR * sqlUserName,
  const CHAR * sqlUserPassword 
 )  
Opens a handle for the MySQL connection
Parameters
[out]mysqlAccountAmazon RDS MySQL instance account handle
[in]sqlInstanceEndpointEndpoint address of the Amazon RDS MySQL instance
[in]sqlUserNameUser name of the Amazon RDS MySQL instance
[in]sqlUserPasswordPassword for the Amazon RDS MySQL instance
Return values
TRUESuccess
FALSESee GetLastError()
BOOL MySqlPing(MYSQL mysqlAccount) 
Check if the server connection is alive
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlPrepareSendLongData(MYSQL mysqlAccount,
  DWORD statementId,
  DWORD parameterId,
  const CHAR * dataForPrepareQuery 
 )  
Send data for a prepared statement
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]statementIdStatement Id returned from a previous call to MySqlPrepareQuery()
[in]parameterIdParameter Id for the data
[in]dataForPrepareQueryData for the prepare query
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError() Must be called before MySqlPrepareStatementExecute() To be implemented
BOOL MySqlPrepareStatementClose(MYSQL mysqlAccount,
  DWORD statementId 
 )  
Deallocates a prepare statement query
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]statementIdStatement Id returned by call to MySqlPrepareQuery()
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError() To be implemented
BOOL MySqlPrepareStatementQuery(MYSQL mysqlAccount,
  const CHAR * prepareQuery,
  DWORD * statementId,
  DWORD * numberOfParamters 
 )  
Create a prepared statement
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]preparQueryMySQL prepare query statement
[out]statementIdStatement ID use to identify the prepare statement
[out]numberOfParametersNumber of Parameters
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError() To be implemented
BOOL MySqlPrepareStatementReset(MYSQL mysqlAccount,
  DWORD statementId 
 )  
Reset the data of a prepared statement which was accumulated with MySqlPrepareSendLongData()
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]statementIdStatement Id returned by call to MySqlPrepareQuery()
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError() To be implemented
BOOL MySqlQuit(MYSQL mysqlAccount) 
Close the connection to the Amazon RDS MySQL instance
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlRowQuery(MYSQL mysqlAccount,
  const CHAR * mysqlQuery,
  const CHAR * resultFilePath,
  DWORD * columnsInTable 
 )  
Query the rows of Amazon RDS MySQL instance
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]mysqlQueryMySQL SELECT Query statement For example: "SELECT * FROM mysqldb.TestDbTable" where mysqldb is the schema/database name and TestDbTable is the MySQL table name
[in]resultFilePathPointer to the local file path string in which result of MySQL query will be stored
[out]columnsInTableNumber of columns in the table
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()
BOOL MySqlSetMultiStatementOption(MYSQL mysqlAccount,
  BOOL multiStatementOn 
 )  
Set Multi statement operation
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]multiStatementOnTRUE: Multi statements ON, FALSE: Multi statements OFF
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError() To be implemented
BOOL MySqlStatementExecute(MYSQL mysqlAccount,
  DWORD statementId,
  DWORD numberOfParameters,
  DWORD optionFlags 
 )  
Execute a statement query
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]statementIdStatement Id returned by call to MySqlPrepareQuery()
[in]numberOfParametersNumber of parameters returned by call to MySqlPrepareQuery()
[in]optionFlagsOption flags for prepare statment execution
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError() To be implemented
BOOL MySqlStatementFetch(MYSQL mysqlAccount,
  DWORD statementId 
 )  
Fetch a row from a existing resultset after a COM_STMT_EXECUTE.
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]statementIdStatement Id of a stored procedure
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError() To be implemented
BOOL MySqlUpdateQuery(MYSQL mysqlAccount,
  const CHAR * updateQuery 
 )  
Update data in the table
Parameters
[in]mysqlAccountHandle returned by call to MySqlOpen()
[in]updateQueryMySQL 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
Return values
TRUESuccess
FALSESee WSAGetLastError() and GetLastError()


Send Feedback!