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

SpatiaLite

Written by Martin Pearman

Spatialite is an SQLite extension for the Android platform.
Currently version 3.0.1 of Spatialite is wrapped by this library.

List of types:

Spatialite_Blob
Spatialite_Callback
Spatialite_Constants
Spatialite_Database
Spatialite_Function
Spatialite_FunctionContext
Spatialite_Stmt
Spatialite_StringEncoder
Spatialite_TableResult

Spatialite_Blob


Events:

None

Members:


  Close

  InputStream As InputStreamWrapper [read only]

  IsInitialized As Boolean

  OutputStream As OutputStreamWrapper [read only]

Members description:

Close
InputStream As InputStreamWrapper [read only]
Return InputStream for this blob.
IsInitialized As Boolean
OutputStream As OutputStreamWrapper [read only]
Return OutputStream for this blob.

Spatialite_Callback


Events:

Columns(ColumnData() As String)
NewRow(RowData() As String) As Boolean
Types(TypeData() As String)

Members:


  Initialize (EventName As String)

  IsInitialized As Boolean

Members description:

Initialize (EventName As String)
IsInitialized As Boolean

Spatialite_Constants


Events:

None

Members:


  SQLITE_OPEN_AUTOPROXY As Int

  SQLITE_OPEN_CREATE As Int

  SQLITE_OPEN_DELETEONCLOSE As Int

  SQLITE_OPEN_EXCLUSIVE As Int

  SQLITE_OPEN_FULLMUTEX As Int

  SQLITE_OPEN_MAIN_DB As Int

  SQLITE_OPEN_MAIN_JOURNAL As Int

  SQLITE_OPEN_MASTER_JOURNAL As Int

  SQLITE_OPEN_NOMUTEX As Int

  SQLITE_OPEN_PRIVATECACHE As Int

  SQLITE_OPEN_READONLY As Int

  SQLITE_OPEN_READWRITE As Int

  SQLITE_OPEN_SHAREDCACHE As Int

  SQLITE_OPEN_SUBJOURNAL As Int

  SQLITE_OPEN_TEMP_DB As Int

  SQLITE_OPEN_TEMP_JOURNAL As Int

  SQLITE_OPEN_TRANSIENT_DB As Int

  SQLITE_OPEN_URI As Int

  SQLITE_OPEN_WAL As Int

Members description:

SQLITE_OPEN_AUTOPROXY As Int
SQLITE_OPEN_CREATE As Int
SQLITE_OPEN_DELETEONCLOSE As Int
SQLITE_OPEN_EXCLUSIVE As Int
SQLITE_OPEN_FULLMUTEX As Int
SQLITE_OPEN_MAIN_DB As Int
SQLITE_OPEN_MAIN_JOURNAL As Int
SQLITE_OPEN_MASTER_JOURNAL As Int
SQLITE_OPEN_NOMUTEX As Int
SQLITE_OPEN_PRIVATECACHE As Int
SQLITE_OPEN_READONLY As Int
SQLITE_OPEN_READWRITE As Int
SQLITE_OPEN_SHAREDCACHE As Int
SQLITE_OPEN_SUBJOURNAL As Int
SQLITE_OPEN_TEMP_DB As Int
SQLITE_OPEN_TEMP_JOURNAL As Int
SQLITE_OPEN_TRANSIENT_DB As Int
SQLITE_OPEN_URI As Int
SQLITE_OPEN_WAL As Int

Spatialite_Database


Events:

None

Members:


  BusyTimeout (Milliseconds As Int)

  Close

  CreateAggregate (FunctionName As String, NumberArgs As Int, Function1 As jsqlite.Function)

  CreateFunction (FunctionName As String, NumberArgs As Int, Function1 As jsqlite.Function)

  ErrorMessage As String

  Exec (Query As String, Callback1 As uk.co.martinpearman.b4a.spatialite.CallbackImpl)

  GetTable (Query As String) As Spatialite_TableResult

  GetTable2 (Query As String, MaxRows As Int) As Spatialite_TableResult

  Initialize

  IsInitialized As Boolean

  LastError As Int

  LastInsertRowId As Long

  Open (DatabasePath As String, DatabaseFileName As String, OpenMode As Int)

  OpenBlob (DatabaseName As String, TableName As String, ColumnName As String, Row As Long, ReadWrite As Boolean) As Spatialite_Blob

  Prepare (Query As String) As Spatialite_Stmt

  SetEncoding (Encoding As String)

Members description:

BusyTimeout (Milliseconds As Int)
Set the timeout for waiting for an SQLite table to become unlocked.
Close
Close the SpatiaLite database file.
CreateAggregate (FunctionName As String, NumberArgs As Int, Function1 As jsqlite.Function)
Create aggregate user defined function.
CreateFunction (FunctionName As String, NumberArgs As Int, Function1 As jsqlite.Function)
Create regular user defined function.
ErrorMessage As String
Return last error message of SQLite3 engine.
Exec (Query As String, Callback1 As uk.co.martinpearman.b4a.spatialite.CallbackImpl)
The Callback events never seem to get raised, check if this is executing on a non UI thread.
Or catch the exception in this method to debug...
GetTable (Query As String) As Spatialite_TableResult
GetTable2 (Query As String, MaxRows As Int) As Spatialite_TableResult
Initialize
IsInitialized As Boolean
LastError As Int
Return the code of the last error that occurred in any of the Exec methods.
LastInsertRowId As Long
Return the row identifier of the last inserted row.
Open (DatabasePath As String, DatabaseFileName As String, OpenMode As Int)
Open a SpatiaLite database file.
OpenBlob (DatabaseName As String, TableName As String, ColumnName As String, Row As Long, ReadWrite As Boolean) As Spatialite_Blob
Open an SQLite3 blob.
The returned Blob will not be initialized if an error occurs.
Prepare (Query As String) As Spatialite_Stmt
Prepare and return SQLite3 statement for SQL.
SetEncoding (Encoding As String)
Set character encoding.

Spatialite_Function


Events:

Function(FunctionContext1 As FunctionContext, Arguments() As String)
LastStep(FunctionContext1 As FunctionContext)
Step(FunctionContext1 As FunctionContext, Arguments() As String)

Members:


  Initialize (EventName As String)

  IsInitialized As Boolean

Members description:

Initialize (EventName As String)
Initialize this user defined Function.
Raises the events:
Function(FunctionContext1 As FunctionContext, Arguments() As String).
LastStep(FunctionContext1 As FunctionContext).
Step(FunctionContext1 As FunctionContext, Arguments() As String).
IsInitialized As Boolean

Spatialite_FunctionContext


Events:

None

Members:


  Count As Int

  IsInitialized As Boolean

  SetError (Error As String)

  SetResultBytes (Result() As Byte)

  SetResultDouble (Result As Double)

  SetResultInt (Result As Int)

  SetResultString (Result As String)

  SetResultZeroBlob (Size As Int)

Members description:

Count As Int
Retrieve number of rows for aggregate function.
IsInitialized As Boolean
SetError (Error As String)
Set function result from error message.
SetResultBytes (Result() As Byte)
Set function result from byte array.
SetResultDouble (Result As Double)
Set function result from double.
SetResultInt (Result As Int)
Set function result from integer.
SetResultString (Result As String)
Set function result from string.
SetResultZeroBlob (Size As Int)
Set function result as empty blob given size.

Spatialite_Stmt


Events:

None

Members:


  BindBytes (Position As Int, Bytes() As Byte)

  BindDouble (Position As Int, Double1 As Double)

  BindInt (Position As Int, Integer1 As Int)

  BindLong (Position As Int, Long1 As Long)

  BindNull (Position As Int)

  BindParameterCount As Int

  BindParameterIndex (Name As String) As Int

  BindParameterName (Position As Int) As String

  BindString (Position As Int, String1 As String)

  BindZeroBlob (Position As Int, Length As Int)

  ClearBindings

  Close

  Column (ColumnIndex As Int) As Object

  ColumnBytes (ColumnIndex As Int) As Byte()

  ColumnCount As Int

  ColumnDatabaseName (ColumnIndex As Int) As String

  ColumnDeclaredType (ColumnIndex As Int) As String

  ColumnDouble (ColumnIndex As Int) As Double

  ColumnInt (ColumnInt As Int) As Int

  ColumnLong (ColumnIndex As Int) As Long

  ColumnName (ColumnIndex As Int) As String

  ColumnOriginalName (ColumnIndex As Int) As String

  ColumnString (ColumnIndex As Int) As String

  ColumnTableName (ColumnIndex As Int) As String

  ColumnType (ColumnIndex As Int) As Int

  IsInitialized As Boolean

  Prepare As Boolean

  Reset

  Status (Op As Int, Flag As Boolean) As Int

  Step As Boolean

Members description:

BindBytes (Position As Int, Bytes() As Byte)
Bind positional byte array to compiled statement.
BindDouble (Position As Int, Double1 As Double)
Bind positional double value to compiled statement.
BindInt (Position As Int, Integer1 As Int)
Bind positional integer value to compiled statement.
BindLong (Position As Int, Long1 As Long)
Bind positional long value to compiled statement.
BindNull (Position As Int)
Bind positional SQL null to compiled statement.
BindParameterCount As Int
Return number of parameters in compiled statement.
Returns -1 on error.
BindParameterIndex (Name As String) As Int
Return index of named parameter in compiled statement.
Returns -1 on error.
BindParameterName (Position As Int) As String
Return name of parameter in compiled statement.
Returns Null on error.
BindString (Position As Int, String1 As String)
Bind positional String to compiled statement.
BindZeroBlob (Position As Int, Length As Int)
Bind positional zero'ed blob to compiled statement.
ClearBindings
Clear all bound parameters of the compiled statement.
Close
Close the compiled statement.
Column (ColumnIndex As Int) As Object
Retrieve column data as Object from exec'ed statement.
Returns Null on error.
ColumnBytes (ColumnIndex As Int) As Byte()
Retrieve blob column from exec'ed statement.
Returns an empty array on error.
ColumnCount As Int
Retrieve number of columns of exec'ed statement.
Return -1 on error.
ColumnDatabaseName (ColumnIndex As Int) As String
Return database name of column of statement.
Returns Null on error.
ColumnDeclaredType (ColumnIndex As Int) As String
Return declared column type of statement.
ColumnDouble (ColumnIndex As Int) As Double
Retrieve double column from exec'ed statement.
ColumnInt (ColumnInt As Int) As Int
Retrieve integer column from exec'ed statement.
ColumnLong (ColumnIndex As Int) As Long
Retrieve long column from exec'ed statement.
ColumnName (ColumnIndex As Int) As String
Return column name of column of statement.
Returns Null on error.
ColumnOriginalName (ColumnIndex As Int) As String
Return origin column name of column of statement.
Returns Null on error.
ColumnString (ColumnIndex As Int) As String
Retrieve string column from exec'ed statement.
Returns Null on error.
ColumnTableName (ColumnIndex As Int) As String
Return table name of column of statement.
Returns Null on error.
ColumnType (ColumnIndex As Int) As Int
Retrieve column type from exec'ed statement.
IsInitialized As Boolean
Prepare As Boolean
Prepare the next SQL statement for the Stmt instance.
Reset
Reset the compiled statement without clearing parameter bindings.
Status (Op As Int, Flag As Boolean) As Int
Return statement status information.
Step As Boolean
Perform one step of compiled statement.

Spatialite_StringEncoder


Events:

None

Members:


  Decode (String1 As String) As Byte()

  Encode (Bytes() As Byte) As String

  EncodeX (Bytes() As Byte) As String

Members description:

Decode (String1 As String) As Byte()
Decodes the given string that is assumed to be a valid encoding of a byte array.
Typically the given string is generated by the StringEncoder Encode method.
Encode (Bytes() As Byte) As String
Encodes the given byte array into a string that can be used by the SQLite database.
The database cannot handle null (0x00) and the character '\'' (0x27).
The encoding consists of escaping these characters with a reserved character (0x01).
EncodeX (Bytes() As Byte) As String
Encodes the given byte array into SQLite3 blob notation, ie X'..'

Spatialite_TableResult


Events:

None

Members:


  AtMaxRows As Boolean

  Clear

  Column() As String [read only]

  IsInitialized As Boolean

  MaxRows As Int [read only]

  NumberColumns As Int [read only]

  NumberRows As Int [read only]

  Rows(,) As String [read only]

  Types() As String [read only]

Members description:

AtMaxRows As Boolean
Flag to indicate MaxRows condition.
Clear
Column() As String [read only]
Column names of the result set.
IsInitialized As Boolean
MaxRows As Int [read only]
Maximum number of rows to hold in the table.
NumberColumns As Int [read only]
Number of columns in the result set.
NumberRows As Int [read only]
Rows(,) As String [read only]
Rows of the result set.
Returns an Array of String Arrays, where each String Array represents a row of the result.
Types() As String [read only]
Types of columns of the result set or Null.
Top