Share My Creation SQLite Viewer

SS-2013-11-25_17.34.16.png


A small example that lets you load a SQLite database and see its contents. The program tries to load BLOB fields as images.


Updated file is attached to post #4.
 
Last edited:

billzhan

Active Member
Licensed User
Longtime User
An Error found on xp sp3+b4j beta4.
When open file R:/data.db
LoadDatabase("", f)-> f ="R:\data.db" which is right
LoadDatabase(Dir As String, FileName As String)-> sql initialize to open "\R:\data.db" so it can not be opened.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Here's the fixed version that works with beta 6.
Hi All,

have tested with latest B4J 1.06. The blob fields are not shown.
Please find the sqlite3 testdatabase attached.
 

Attachments

  • blob.zip
    1,021 bytes · Views: 608

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi Erel,

found the issue with the BLOBS. The BLOBS loaded had BMP format, which seems to be not supported?

Retested with GIF and PNG files works fine. Inserting using:

B4X:
Sub InsertBlob(blobname As String)
    Log("SQL Insert BLOB :: Start")
    If File.Exists(File.DirApp, blobname) = False Then
        Log("BLOB File NOT Exists: " & File.DirApp & ", " & blobname)
        Return
    End If
    Log("BLOB File Exists: " & File.DirApp & ", " & blobname)
    'convert the image file to a bytes array
    Dim InputStream1 As InputStream
    InputStream1 = File.OpenInput(File.DirApp, blobname)
    Dim OutputStream1 As OutputStream
    OutputStream1.InitializeToBytesArray(1000)
    File.Copy2(InputStream1, OutputStream1)
    Dim Buffer() As Byte 'declares an empty array
    Buffer = OutputStream1.ToBytesArray
    'write the image to the database
    Log("SQL Insert ...")
    SQL.ExecNonQuery2("INSERT INTO images VALUES(NULL, ?, ?)", Array As Object(blobname, Buffer))
    Log("SQL Insert BLOB :: End")
End Sub
 

tsteward

Well-Known Member
Licensed User
Longtime User
How can I modify this app to have webview to show the text fields?
Most of my text fields contain html code. Or is this not feasible?
 

JOTHA

Well-Known Member
Licensed User
Longtime User
Hi Erel,

i got this errror-message:
java.lang.NoClassDefFoundError: javafx/scene/control/Dialog

Is there a Library missing?

THX in advance ...
 

JOTHA

Well-Known Member
Licensed User
Longtime User
Hi Erel,

no, i use Java 8.0650.17.
Should i upgrade?
 

JOTHA

Well-Known Member
Licensed User
Longtime User
... I've installed B4J on another PC with WIN7 ... there it works!
But on my Laptop with WIN10 there is the following Log after compilation:
Program started.
main._process_globals (java line: 143)
java.lang.NoClassDefFoundError: javafx/scene/control/Dialog
at b4j.example.main._process_globals(main.java:143)
at b4j.example.main.initializeProcessGlobals(main.java:131)
at b4j.example.main.start(main.java:33)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(LauncherImpl.java:821)
at com.sun.javafx.application.LauncherImpl$$Lambda$51/1996990761.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323)
at com.sun.javafx.application.PlatformImpl$$Lambda$45/1349277854.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/851662109.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/1147985808.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)
at com.sun.glass.ui.win.WinApplication$$Lambda$37/728890494.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: javafx.scene.control.Dialog
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 17 more

... any ideas what to do?
THX
 
Top