iOS Question SQLlite on IoS

karld

Active Member
Licensed User
Longtime User
My android app uses this code to read from a sqlite database

B4X:
Sub SQLTableRead
Dim i As Int
Dim cursor1 As Cursor
Dim txt As String

txt = "Select * from " & DBTableName1

txt = txt & " WHERE "
txt = txt & ColumnName(7) & " = '" & Error_Code &"'" 
txt = txt & " AND " & ColumnName(PumpType) & " = '1'"
    
cursor1=sql1.ExecQuery(txt)

Dim Col(NumberOfColumns1) As String
If cursor1.RowCount >0 Then
   For i = 0 To cursor1.RowCount - 1
     Dim Col(NumberOfColumns1) As String
     cursor1.Position = i
     For j = 0 To NumberOfColumns1 - 1
       Col(j) = cursor1.GetString(ColumnName(j))
       Next
       Next

lblResult.Text = "Error Code " & Error_Code & CRLF
lblResult.Text = lblResult.Text & cursor1.GetString(ColumnName(8))
cursor1.Close

Else
   lblResult.text = "Error Code " & Error_Code & CRLF
   lblResult.Text = lblResult.Text & "NOT FOUND in database" & CRLF
   lblResult.Text = lblResult.Text & "for selected dispenser."
  
  
End If
  
End Sub

I am trying to port it to IoS and I am getting an error.

Error description: Unknown type: cursor
Are you missing a library reference?
Occurred on line: 194 (Main)
Dim cursor1 As Cursor

This is part of the Sql library. I have enabled the library iSQL with the same result.

I am guessing that the IoS library uses a different term for cursor. I have searched the library, tutorial, and code snippets forums and not really found anything. Anyone able to point me in the right direction here?
 

karld

Active Member
Licensed User
Longtime User
Thank you, sir! I looked it over and edited mine. No more errors on sql.

Now to figure out how to port over the main.bal file.

Used the bal2bil converter. Now to play and find how to get it "linked" in to the app...
 
Upvote 0
Top