Files
AdditionalLibs/B4A/SQLCipher.xml

259 lines
11 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<root>
<doclet-version-NOT-library-version>1.05</doclet-version-NOT-library-version>
<class>
<name>anyhwheresoftware.b4a.objects.sqlcipher.SQLCipher</name>
<shortname>SQLCipher</shortname>
<comment>SQLCipher type is an extension to SQL which supports encryption.
See the &lt;link&gt;tutorial|http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/14965-android-database-encryption-sqlcipher-library.html&lt;/link&gt; for more information.</comment>
<owner CheckForReinitialize="true">process</owner>
<method>
<name>EndTransaction</name>
<comment>Ends the transaction.</comment>
<returntype>void</returntype>
</method>
<method>
<name>ExecQuery2</name>
<comment>Executes the query and returns a cursor which is used to go over the results.
The query can include question marks which will be replaced with the values in the array.
Example:&lt;code&gt;
Dim Cursor As Cursor
Cursor = sql1.ExecQuery2("SELECT col1 FROM table1 WHERE col3 = ?", Array As String(22))&lt;/code&gt;
SQLite will try to convert the string values based on the columns types.</comment>
<returntype>Cursor</returntype>
<parameter>
<name>Query</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>StringArgs</name>
<type>java.lang.String[]</type>
</parameter>
</method>
<method>
<name>ExecQuery</name>
<comment>Executes the query and returns a cursor which is used to go over the results.
Example:&lt;code&gt;
Dim Cursor As Cursor
Cursor = SQL1.ExecQuery("SELECT col1, col2 FROM table1")
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
Log(Cursor.GetString("col1"))
Log(Cursor.GetInt("col2"))
Next&lt;/code&gt;</comment>
<returntype>Cursor</returntype>
<parameter>
<name>Query</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>ExecQuerySingleResult2</name>
<comment>Executes the query and returns the value in the first column and the first row (in the result set).
Returns Null if no results were found.
Example:&lt;code&gt;
Dim NumberOfMatches As Int
NumberOfMatches = SQL1.ExecQuerySingleResult2("SELECT count(*) FROM table1 WHERE col2 &gt; ?", Array As String(300))&lt;/code&gt;</comment>
<returntype>java.lang.String</returntype>
<parameter>
<name>Query</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>StringArgs</name>
<type>java.lang.String[]</type>
</parameter>
</method>
<method>
<name>IsInitialized</name>
<comment>Tests whether the database is initialized and opened.</comment>
<returntype>boolean</returntype>
</method>
<method>
<name>Initialize</name>
<comment>Opens the database file. A new database will be created if it does not exist and CreateIfNecessary is true.</comment>
<returntype>void</returntype>
<parameter>
<name>Dir</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>FileName</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>CreateIfNecessary</name>
<type>boolean</type>
</parameter>
<parameter>
<name>Password</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Unused</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>ExecNonQueryBatch</name>
<comment>Asynchronously executes a batch of non-query statements (such as INSERT).
The NonQueryComplete event is raised after the statements are completed.
You should call AddNonQueryToBatch one or more times before calling this method to add statements to the batch.
Note that this method internally begins and ends a transaction.
Returns an object that can be used as the sender filter for Wait For calls.
Example:&lt;code&gt;
For i = 1 To 1000
sql.AddNonQueryToBatch("INSERT INTO table1 VALUES (?)", Array(Rnd(0, 100000)))
Next
Dim SenderFilter As Object = sql.ExecNonQueryBatch("SQL")
Wait For (SenderFilter) SQL_NonQueryComplete (Success As Boolean)
Log("NonQuery: " &amp; Success)&lt;/code&gt;</comment>
<returntype>java.lang.Object</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>EventName</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>BeginTransaction</name>
<comment>Begins a transaction. A transaction is a set of multiple "writing" statements that are atomically committed,
hence all changes will be made or no changes will be made.
As a side effect those statements will be executed significantly faster (in the default case a transaction is implicitly created for
each statement).
It is very important to handle transaction carefully and close them.
The transaction is considered successful only if TransactionSuccessful is called. Otherwise no changes will be made.
Typical usage:&lt;code&gt;
SQL1.BeginTransaction
Try
'block of statements like:
For i = 1 to 1000
SQL1.ExecNonQuery("INSERT INTO table1 VALUES(...)
Next
SQL1.TransactionSuccessful
Catch
Log(LastException.Message) 'no changes will be made
End Try
SQL1.EndTransaction&lt;/code&gt;</comment>
<returntype>void</returntype>
</method>
<method>
<name>AddNonQueryToBatch</name>
<comment>Adds a non-query statement to the batch of statements.
The statements are (asynchronously) executed when you call ExecNonQueryBatch.
Args parameter can be Null if it is not needed.
Example:&lt;code&gt;
For i = 1 To 1000
sql.AddNonQueryToBatch("INSERT INTO table1 VALUES (?)", Array(Rnd(0, 100000)))
Next
Dim SenderFilter As Object = sql.ExecNonQueryBatch("SQL")
Wait For (SenderFilter) SQL_NonQueryComplete (Success As Boolean)
Log("NonQuery: " &amp; Success)&lt;/code&gt;</comment>
<returntype>void</returntype>
<parameter>
<name>Statement</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Args</name>
<type>anywheresoftware.b4a.objects.collections.List</type>
</parameter>
</method>
<method>
<name>ExecQuerySingleResult</name>
<comment>Executes the query and returns the value in the first column and the first row (in the result set).
Returns Null if no results were found.
Example:&lt;code&gt;
Dim NumberOfMatches As Int
NumberOfMatches = SQL1.ExecQuerySingleResult("SELECT count(*) FROM table1 WHERE col2 &gt; 300")&lt;/code&gt;</comment>
<returntype>java.lang.String</returntype>
<parameter>
<name>Query</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>TransactionSuccessful</name>
<comment>Marks the transaction as a successful transaction. No further statements should be executed till calling EndTransaction.</comment>
<returntype>void</returntype>
</method>
<method>
<name>ExecNonQuery</name>
<comment>Executes a single non query SQL statement.
Example:&lt;code&gt;
SQL1.ExecNonQuery("CREATE TABLE table1 (col1 TEXT , col2 INTEGER, col3 INTEGER)")&lt;/code&gt;
If you plan to do many "writing" queries one after another, then you should consider using BeginTransaction / EndTransaction.
It will execute significantly faster.</comment>
<returntype>void</returntype>
<parameter>
<name>Statement</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>Close</name>
<comment>Closes the database.
Does not do anything if the database is not opened or was closed before.</comment>
<returntype>void</returntype>
</method>
<method>
<name>ExecQueryAsync</name>
<comment>Asynchronously executes the given query. The QueryComplete event will be raised when the results are ready.
Note that ResultSet extends Cursor. You can use Cursor if preferred.
Returns an object that can be used as the sender filter for Wait For calls.
Example:&lt;code&gt;
Dim SenderFilter As Object = sql.ExecQueryAsync("SQL", "SELECT * FROM table1", Null)
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As ResultSet)
If Success Then
Do While rs.NextRow
Log(rs.GetInt2(0))
Loop
rs.Close
Else
Log(LastException)
End If&lt;/code&gt;</comment>
<returntype>java.lang.Object</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>EventName</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Query</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Args</name>
<type>anywheresoftware.b4a.objects.collections.List</type>
</parameter>
</method>
<method>
<name>ExecNonQuery2</name>
<comment>Executes a single non query SQL statement.
The statement can include question marks which will be replaced by the items in the given list.
Note that Basic4android converts arrays to lists implicitly.
The values in the list should be strings, numbers or bytes arrays.
Example:&lt;code&gt;
SQL1.ExecNonQuery2("INSERT INTO table1 VALUES (?, ?, 0)", Array As Object("some text", 2))&lt;/code&gt;</comment>
<returntype>void</returntype>
<parameter>
<name>Statement</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>Args</name>
<type>anywheresoftware.b4a.objects.collections.List</type>
</parameter>
</method>
</class>
<version>1.5</version>
<comment></comment>
<dependsOn>sqlcipher_native</dependsOn>
</root>