Home » U++ Library support » U++ SQL » Oracle8: Insert a long RAW Value
|
|
Re: Oracle8: Insert a long RAW Value [message #26745 is a reply to message #26743] |
Tue, 25 May 2010 15:00   |
|
luzr wrote on Tue, 25 May 2010 15:24 |
SQL.Execute("update TABLE set DATA = ? where ID = ?", SqlRaw(data), q);
You cannot use SqlExp for this. That is why I usually split the process into two parts: I use SqlExp to do the insert, then update to set longraw value.
Mirek
|
in oracle8 you use SqlRaw?
I see only in Oracle7 it is processed!
|
|
|
|
Re: Oracle8: Insert a long RAW Value [message #26761 is a reply to message #26748] |
Wed, 26 May 2010 13:52   |
|
luzr wrote on Tue, 25 May 2010 17:49 |
tojocky wrote on Tue, 25 May 2010 09:00 |
luzr wrote on Tue, 25 May 2010 15:24 |
SQL.Execute("update TABLE set DATA = ? where ID = ?", SqlRaw(data), q);
You cannot use SqlExp for this. That is why I usually split the process into two parts: I use SqlExp to do the insert, then update to set longraw value.
Mirek
|
in oracle8 you use SqlRaw?
I see only in Oracle7 it is processed!
|
Yes, I am using Oracle7 (It works all the way up).
"7" is minimal requirement. They have changed C api in Oracle 8 and it does not support LONGRAW anymore (if I remember well), replacing it with BLOBs.
Mirek
|
Mirek,
I tried Oracle7 but without success:
It remain on execution command: oci7.oexec(&cda); from bool OCI7Connection::Execute() on second(last) call.
Can you help me with this? Maybe i did something wrong!
I uploaded image from file direct from file like this:
String v_img_data(LoadFile(p_image_location));
curr_st.SetParam(1, SqlRaw(v_img_data));
is it correct?
according by this documentation The method OCIDefineByPos support long raw type (SQLT_LBI).
Thank you in advance
[Updated on: Wed, 26 May 2010 15:27] Report message to a moderator
|
|
|
Re: Oracle8: Insert a long RAW Value [message #26763 is a reply to message #26761] |
Wed, 26 May 2010 15:17  |
|
OK!
The problem is resolved! the problem was: I lock the table in TORA.
Thank you Mirek for help!
I propose to include SqlRaw in Oracle8 class!
The patch is here:
Index: uppsrc/Oracle/Oci8.cpp
===================================================================
--- uppsrc/Oracle/Oci8.cpp (revision 2421)
+++ uppsrc/Oracle/Oci8.cpp (working copy)
@@ -69,7 +69,7 @@
struct Item {
T_OCI8& oci8;
int type;
- int16 len;
+ int len;
sb2 ind;
ub2 rl;
ub2 rc;
@@ -142,6 +142,7 @@
void SetParam(int i, Date d);
void SetParam(int i, Time d);
void SetParam(int i, Sql& refcursor);
+ void SetRawParam(int i, const String& s);
void AddColumn(int type, int len);
void GetColumn(int i, String& s) const;
@@ -296,6 +297,13 @@
PrepareParam(i, r.GetOraType(), r.GetMaxLen(), 0, r.GetType());
}
+void OCI8Connection::SetRawParam(int i, const String& s) {
+ int l = s.GetLength();
+ Item& p = PrepareParam(i, SQLT_LBI, l, 0, VOID_V);
+ memcpy(p.Data(), s, l);
+ p.ind = l ? 0 : -1;
+}
+
class Oracle8RefCursorStub : public SqlSource {
public:
Oracle8RefCursorStub(SqlConnection *cn) : cn(cn) {}
@@ -320,6 +328,9 @@
SetParam(i, String());
else
switch(q.GetType()) {
+ case SQLRAW_V:
+ SetRawParam(i, SqlRaw(q));
+ break;
case STRING_V:
case WSTRING_V:
SetParam(i, String(q));
[Updated on: Wed, 26 May 2010 15:19] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Apr 27 01:35:51 CEST 2025
Total time taken to generate the page: 0.00719 seconds
|