ChosenDrinkName = ""
ScVList.Initialize(0)
ScVList.Color = Colors.white
Table = ScVList.Panel
Table.Color = TableColor
Activity.AddView(ScVList, 5%x, (ListItemsTopHeaderLabel.Height + ListItemsTopHeaderLabelLower.Height + (Searchbox.Height)*2), 90%x, 100%y)
ColumnWidth(0) = 0.66 * ScVList.Width
ColumnWidth(1) = 0.32 * ScVList.Width
'ScVList.Background = Colors.White
SelectedRow = -1
Dim dir As String
Dim Cursor As Cursor
DrinksInDataBaseCount = SQL1.ExecQuerySingleResult("SELECT count(DISTINCT DrinkName) FROM drinkslist")
Cursor = SQL1.ExecQuery("SELECT DISTINCT * FROM drinkslist ORDER BY DrinkName")
SetHeader(Array As String("DRINK NAME", "FAVOURITE")) 'lists any drinks that are in the database. names are col0, isfav is col1
'add rows
For i = 0 To DrinksInDataBaseCount -1
Cursor.Position = i
'blob -- here comes your code! :)
Dim InputStream1 As InputStream
Dim OutputStream1 As OutputStream
Dim Buffer() As Byte 'declares an empty array
Buffer = Cursor.GetBlob("IsFav") 'this is because the original datafile doesnt contain information for whether they have fav'd things or not until the user actually does it. In other words this col is empty and this would fill it up in that case.
If Buffer = Null Then 'not sure about Null
InputStream1 = File.OpenInput(File.DirAssets, "btn_rating_star_off_normal.png")
OutputStream1.InitializeToBytesArray(1000)
File.Copy2(InputStream1, OutputStream1)
Dim Buffer() As Byte 'declares an empty array
Buffer = OutputStream1.ToBytesArray
'write the image to the database
SQL1.ExecNonQuery2("UPDATE drinkslist SET IsFav (?) WHERE DrinkName = "& QUOTE & Cursor.getstring2(0) & QUOTE, Array As Object(Buffer))
End If
'getblob
Dim Cursor1 As Cursor
Cursor1 = SQL1.ExecQuery2("SELECT isfav FROM drinkslist WHERE name = ?", Array As String(Cursor.getstring2(0))) 'this should hopefully work though i don't know as i can't get that far.
Dim Buffer() As Byte 'declare an empty byte array
Buffer = Cursor1.GetBlob("IsFav")
Dim InputStream1 As InputStream
InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
Dim Bitmap1 As Bitmap
Bitmap1.Initialize2(InputStream1)
InputStream1.Close
AddRow(Array As String(Cursor.getstring2(0),Cursor1.getblob("IsFav"))) 'this causes a java error saying something about the 0 after getstring2, however it used to work fine before and I don't think I changed any definitions related to that.
Next
End Sub