Android Programming Press on the image to return to the main documentation page.

MSMySQL

Written by DonManfred

List of types:

MySQL

MySQL


Events:

ListTables(tables As List, ms as Long)
Status(Connected As Boolean, ReConnecting As Boolean, RetriesLeft As int)
QueryResult(data as List, meta As Map)
QueryResult2(data as List, meta As Map)
BatchResult(batch As Map)
onPreparedStatementResult(meta As Map)
onSqlError(meta As Map)
ExecResult(meta As Map)

Members:


  check_connection

  CloseDatabase

  DisableReconnect

  EnableReconnect

  ExecuteASync (query As String, Task As String)

  ExecuteBatchASync (batch As List, Task As String)

  ExecutePeparedStatement (TaskID As String)

  Initialize (event As String, host As String, user As String, password As String, Database As String, useStrictMode As Boolean, useDebugOutput As Boolean)

  isReconnectEnabled As Boolean

  ListTablesAsync

  PeparedStatement (sql As String)

  QueryASync (query As String, Task As String)

  QueryASync2 (query As String, Task As String)

  ReconnectNumRetry As Int

  ReconnectTime As Int

  SelectDB (database As String) As Boolean

  setPeparedBlob (parameterIndex As Int, imagepath As String)

  setPeparedBlob2 (parameterIndex As Int, fis As java.io.FileInputStream)

  setPeparedBytes (parameterIndex As Int, x() As Byte)

  setPeparedInt (parameterIndex As Int, value As Int)

  setPeparedLong (parameterIndex As Int, value As Long)

  setPeparedString (parameterIndex As Int, value As String)

Members description:

check_connection
CloseDatabase
Closes the database
Example:
db.closedatabase
DisableReconnect
Disable automatic auto_reconnect if the MySQL Database Connection is lost
By default this is enabled
EnableReconnect
Enable automatic auto_reconnect if the MySQL Database Connection is lost
By default this is enabled.
ExecuteASync (query As String, Task As String)
executes ONE SQL-Commands (insert, update, delete)
Example:
db.executeasync("INSERT INTO b4alog SET log_value='Test"&i&"', log_time="&DateTime.Now&";")
ExecuteBatchASync (batch As List, Task As String)
executes a batch of SQL-Commands (insert, update, delete)
Example:
Dim batch As List  
For i=1 To 100
batch.Add("INSERT INTO b4alog SET log_value='Test"&i&"', log_time="&DateTime.Now&";")
Next  
db.executebatchasync(batch)
ExecutePeparedStatement (TaskID As String)
Initialize (event As String, host As String, user As String, password As String, Database As String, useStrictMode As Boolean, useDebugOutput As Boolean)
Initialize the Library
the url to your database. You dont need to prefix it with
jdbc:mysql:// as this will be done automatically


Example:
db.Initialize("eventname","mydbdomain.com","dbusername","dbpassword","dbname")
isReconnectEnabled As Boolean
Test whether or not automatic reconnect is currently enabled.
By default automatic auto_reconnect is enabled
Return type: @return:true if automatic auto_reconnect is enabled, false if it is disabled
ListTablesAsync
Get a list of all tables inside this catalog (database)
The event listtables will be raised
Example:
db.ListTablesAsync

Sub sql_listtables(tables As List)
Log("sql_listtables()")
For i=0 To tables.Size-1
Log("Table "&tables.Get(i))
Next
End Sub
PeparedStatement (sql As String)
QueryASync (query As String, Task As String)
Query the Database. When the Method finishes the event QueryResult
will be raised
QueryResult gets two values. A "List of Maps" for the results. Each
Item in the List contains a Map holding the Values from on Resultrow
The Second value is a Map containing some informations:
ColumnCount, RecordCount and time elapsed in ms for the query

Example:
db.queryasync("select * from members LIMIT 0,1 ;","TaskX")
QueryASync2 (query As String, Task As String)
Query the Database. When the Method finishes the event QueryResult2
will be raised
QueryResult gets two values. A "List of Strings" for the results. Each
Item in the List contains a String holding the Values from on Resultrow
in the format "["+field1+","+field2+"]"

The Second value is a Map containing some informations:
ColumnCount, RecordCount and time elapsed in ms for the query
Example:
db.queryasync2("select * from members LIMIT 0,1 ;")
ReconnectNumRetry As Int
Returns the maximum number of automatic reconnection attempts before giving
up and throwing an exception.

If this value was not changed with {@link #setReconnectNumRetry(int)} the default
number of attempts is 15
ReconnectTime As Int
Returns the waiting time before attempting to auto_reconnect to the MySQL
Database server.

If this value was not changed with {@link #setReconnectTime(int)} the default
waiting time is 5 seconds
SelectDB (database As String) As Boolean
Manually select the database to Query.
setPeparedBlob (parameterIndex As Int, imagepath As String)
setPeparedBlob2 (parameterIndex As Int, fis As java.io.FileInputStream)
setPeparedBytes (parameterIndex As Int, x() As Byte)
setPeparedInt (parameterIndex As Int, value As Int)
setPeparedLong (parameterIndex As Int, value As Long)
setPeparedString (parameterIndex As Int, value As String)

Top