Cursussen/Courses Codesnippets     Top 
B4A-database - Remarks


Remarks
During the testing phase of this project there were a few issues with the database content of the test databases.
- Some field names contained non alphabetical characters or non numerical characters or the underscore sign like for example: / ( ) To display these field names you have to put them between square-brackets [ and ]. The B4XTable can then display them correctly.
- Field names in a foreign non alphabetic language need to be between square-brackets too.
- There were fields that contained data with a datatype of BLOB or GRAPHIC. The content of those fields couldn't be converted to a bitmap (ancient bitmap format???). When the content of the blob field was replaced with for instance a JPG image that was downloaded from the internet then that image could be shown in the photo dialog.
- In SOME tables from the test database dbdemos.db3 (the demo database from SQLite Expert Personal windows application) the standard Search field from the B4XTable throws a runtime exception error. When you type a letter k (capital letter or not) in the search field of the B4XTable as shown in the image below then the error shows up and ends the app.
This could be a bug in the B4XTable class or the content of that table is questionable. This was the error: "java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference"
EDIT: this situation occurs when the content of a field is set to NULL. So you have to change a piece of code. Changes these lines in the fill_B4XTable subroutine:
			If typeslst.Get(i) <> "BLOB" And typeslst.Get(i) <> "GRAPHIC" Then
				'Log(typeslst.Get(i))
				rec.Add(rs1.GetString2(i))
			Else
				rec.Add(typeslst.Get(i))
			End If
into these lines:
			If typeslst.Get(i) <> "BLOB" And typeslst.Get(i) <> "GRAPHIC" Then
				'Log(typeslst.Get(i))
				If rs1.GetString2(i) <> Null Then
					rec.Add(rs1.GetString2(i))
				Else
					rec.Add("NULL")
				End If
			Else
				rec.Add(typeslst.Get(i))
			End If
When a field was set to NULL we set the B4XTable cell content to the text "NULL".
The search field now functions normally.
- You can test the app with the database from the B4A-budget tutorial. In the first chapter of this tutorial you can find the instructions on how to export the database from the B4A-budget app.


X

Paragraphs

Remarks