I am pretty ignorant when it comes to the true power of the database side of ignition. One thing I was wondering is if I can store entire files such as images (.jpg) or drawings (.dxf) in the database itself and be able to recall those at will. I currently use a local file path and then just display files based on those paths but I would like to centralize these images so if a client doesn’t have access to network drive the images can still be accessed. I have found a few mentions that this is possible in the forums (readfileasbytes???) but nothing about how to store them or restore them?
And of course the follow up to this would be, are there any examples anywhere?
Make sure your db has a column of type BLOB (or its variants). Your image is really just a byte array – you store the bytes in the database and later retrieve them, just like reading the file from disk.
I all you really want is central storage without having to deal with drive mappings and file services, you can use system.util.sendRequest() to delegate to a message handler on the gateway and use system.file.readFileAsBytes() there, sending the response bytes back to the client.
Although I believe understand the theory I do not understand how to carry it out. Would these be standard SQL commands I could use in a script or are we at python/jython level at this point?
The only python scripting would be a call to system.db.runQuery and its variants. That query will be just standard SQL, and a google search will give you a whole lot of examples of storing and retrieving images.