When I call the getBytes() on a perspective file upload I get the expected type of array.array. However if I move that getBytes() array to a param and then look at the ensuing type I get com.inductiveautomation.perspective.gateway.script.PropertyTreeScriptWrapper$ArrayWrapper.
How to I then take that param and later form it back to an array so I can pass it off to SQL to save as a longblob/varbinary(MAX)?
However, jython is often smart enough to construct raw java byte arrays when passing sequences into java APIs. Meaning, you might just be able to pass it to a PrepUpdate() and let JDBC have at it.
Otherwise, you’ll have to use the jarray module to reconstruct the plain byte array again.
BTW, why do you put it in a param? Unless it is private, that will make it go back to the browser, but as json. Blegh. Cache it in a script module dictionary if you can’t send it directly to the database. That’ll keep it in the gateway as a normal byte array.
Yes, but you’ll probably want a .clear() in there. Also note that doing it just like that will have it shared across all sessions. You probably want a dictionary at the top level with session ids for keys, and save a (timestamp, bytes) tuple. Then use a gateway timer to clean out stale entries.