Hello All,
In the following snippets: MYTABLE is an Oracle 12.x table. FILE_CONTAINER is a BLOB column.
Any insights and suggestions to make the following experiments (#2 and/or #3) work would be much appreciated.
Thank you!
-Simon
Experiment #1 of 3:
The following works, but only an empty BLOB object is created in the BLOB column.
sql="INSERT INTO MYTABLE"_
+ "("_
+ " ATTACHMENT_ID"_
+ ",FILE_NAME"_
+ ",FILE_CONTAINER"_
+ ",FILE_SIZE"_
+ ",USERID"_
+ ")"_
+ " VALUES"_
+ "("_
+ lvID.ToText+","_
+ "'"+parmFN+"',"_
+ "EMPTY_BLOB(),"_
+ lvFileSize.ToText+","_
+ "'"+Session.propLoginUID+"',"_
+ ")"
app.propdb.SQLExecute(sql)
app.propdb.Commit
Experiment #2 of 3:
The following terminates the WebApp.
With this message displayed on the web browser: “The application has gone off-line. Please try again later.”
“The application has gone off-line. Please try again later.”
sql=“INSERT INTO MYTABLE”_
- “(”_
- " ATTACHMENT_ID"_
- “,FILE_NAME”_
- “,FILE_CONTAINER”_
- “,FILE_SIZE”_
- “,USERID”_
- “)”_
- " VALUES"_
- “(?”_
- “,?”_
- “,?”_
- “,?”_
- “,?”_
- “)”
Dim ps As OracleSQLPreparedStatement = OracleSQLPreparedStatement(app.propdb.Prepare(sql))
ps.BindType(0, OracleSQLPreparedStatement.SQL_TYPE_INTEGER)
ps.BindType(1, OracleSQLPreparedStatement.SQL_TYPE_STRING)
ps.BindType(2, OracleSQLPreparedStatement.SQL_TYPE_CLOB) // same with …_STRING
ps.BindType(3, OracleSQLPreparedStatement.SQL_TYPE_INTEGER)
ps.BindType(4,OracleSQLPreparedStatement.SQL_TYPE_STRING)
ps.Bind(0, lvID)
ps.Bind(1, parmFN)
Dim fN As String = “…/” + parmFN
Dim fTarget as FolderItem = new FolderItem(fN)
If fTarget.Exists Then MsgBox(“File Found!”) // Yes - File Found
Dim bs As BinaryStream = BinaryStream.Open(fTarget, False)
ps.Bind(2, bs)
ps.Bind(3, lvFileSize)
ps.Bind(4, Session.propLoginUID)
ps.SQLExecute
app.propdb.Commit
Experiment #3 of 3:
The following also terminates the WebApp.
The same message was displayed on the web browser: "The application has gone off-line. Please try again later."
sql="INSERT INTO MYTABLE"_
+ "("_
+ " ATTACHMENT_ID"_
+ ",FILE_NAME"_
+ ",FILE_CONTAINER"_
+ ",FILE_SIZE"_
+ ",USERID"_
+ ")"_
+ " VALUES"_
+ "(?"_
+ ",?"_
+ ",?"_
+ ",?"_
+ ",?"_
+ ")"
Dim fTarget as FolderItem = new FolderItem(fN)
Dim bs As BinaryStream = BinaryStream.Open(fTarget, False)
Dim ps As OracleSQLPreparedStatement = OracleSQLPreparedStatement(app.propdb.Prepare(sql))
ps.SQLExecute(lvID,parmFN,bs,lvFileSize,Session.propLoginUID)
app.propdb.Commit