Writing Camera Data To SQLite

RichardN

Well-Known Member
Licensed User
Longtime User
I'm having great difficulty in getting the syntax correct to write a camera picture Byte array to an SQLite blob field. I want to write a new row together with other vars at the same time. The Data() byte array is the one passed when the sub is called.

Some of the code samples in the forum are a little misleading when it comes to writing a mixed row of vars embedded in SQL and I am continually getting syntax failures on compile. I am misunderstanding something around the Array As Object syntax but I can't see what !

TABLE People
-RecNum INT PK
-First TEXT
-Last TEXT
-NickName TEXT
-Picture BLOB

B4X:
Sub Camera1_PictureTaken (Data() As Byte)
             
    camera1.StartPreview

   SQL1.ExecNonQuery2("INSERT INTO People VALUES _ ('First','Last','NickName','Picture')",_
("Joseph", "Bloggs", "Joe", Array As Object (Data)))
   
   btnTakePicture.Enabled = True

End Sub

Can this be executed just with a simple SQL.ExecQuery ? An example with both would be appreciated.

Thanks
 

RichardN

Well-Known Member
Licensed User
Longtime User
Thanks Arel.

Will ExecNonQuery() accept a byte array var included in the SQL string?
For instance when we use an SQL INSERT statement to insert a whole new row in the database without specifying column names ?

Something like...
SQL1.ExecNonQuery("INSERT INTO People VALUES " & Array As Object ("Joseph", "Bloggs", "Joe", Data))
 
Last edited:
Upvote 0

tremara1

Active Member
Licensed User
Longtime User
language problem

Erel, I think you have been coding to long you are starting to use code as your first language...do you speak in code as well??.....LOL
 
Upvote 0
Top