Hi Vincent
OCILIB works great but I am having a problem with the lob stuff.
Working on visual studio express 2012
The OCI_LobCreate function always returns null.
Also after doing a select of an existing record. I tried truncating using OCI_LobTruncate(lob,1);
Does not seem to do anything.
Your help will be appreciated.
Thanks
Martin
did you use the sql clause "for update" ?
Regards,
vincent
Thanks for your quick reply. I am actually a java programmer and not really an expert in c++.
Inserting a record.
lob is always null.
OCI_Lob * lob = OCI_LobCreate(cn, OCI_BLOB);
lob is null. Why? ****
String^ sql = "INSERT INTO AD_Image (ad_image_id, created, updated,createdby,updatedby,ad_client_id,ad_org_id,isactive,name,binarydata)" + " VALUES (AD_SEQUENCE_NEXTNO('AD_Image'), sysdate, sysdate, 100,100,1000012,0,'Y','Martin',:data)" + " returning ad_image_id into :i"; IntPtr ptrToNativeString = Marshal::StringToHGlobalAnsi(sql); char* sql_ch = static_cast<char*>(ptrToNativeString.ToPointer());</char*>
OCI_Prepare(st, sql_ch); OCI_BindLob(st, ":data", lob); OCI_RegisterInt(st, ":i"); boolean ret = OCI_Execute(st); printf("%d row inserted", OCI_GetAffectedRows(st)); // wsqImg and len is passed. uchar * wsqImg, uint len ret = OCI_LobWrite2(lob, wsqImg, &len,&len);
Did you have a look at the ocilib demo files (under demo folder)
Hi
Yes I did. I was able to do most things. Ex. Select a blob from a table
Just having a problem with taking an array of bytes. I get this from a fingerprint reader.
Then need to insert this array into a record as a blob.
I used one of the demo programs as a basis. Where you read a file and insert into a table.
I did get this to work. I suppose I am still learning.
I did a insert using the value EMPTY_BLOB().
Then I did a select ... for update and
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs)) { OCI_Lob *lob5 = OCI_GetLob(rs, 1); boolean ret = OCI_LobAppend(lob5, wsqImg, len); // wsqImg - passed buffer int lenold = OCI_LobGetLength(lob5); }
Still not sure why OCI_Lob * lob3 = OCI_LobCreate(cn, OCI_BLOB); always returns NULL though. Thanks
Hi Vincent
OCILIB works great but I am having a problem with the lob stuff.
Working on visual studio express 2012
The OCI_LobCreate function always returns null.
Also after doing a select of an existing record. I tried truncating using OCI_LobTruncate(lob,1);
Does not seem to do anything.
Your help will be appreciated.
Thanks
Martin
did you use the sql clause "for update" ?
Regards,
vincent
Hi Vincent
Thanks for your quick reply. I am actually a java programmer and not really an expert in c++.
Inserting a record.
lob is always null.
OCI_Lob * lob = OCI_LobCreate(cn, OCI_BLOB);
lob is null. Why? ****
String^ sql = "INSERT INTO AD_Image (ad_image_id, created, updated,createdby,updatedby,ad_client_id,ad_org_id,isactive,name,binarydata)" +
" VALUES (AD_SEQUENCE_NEXTNO('AD_Image'), sysdate, sysdate, 100,100,1000012,0,'Y','Martin',:data)" +
" returning ad_image_id into :i";
IntPtr ptrToNativeString = Marshal::StringToHGlobalAnsi(sql);
char* sql_ch = static_cast<char*>(ptrToNativeString.ToPointer());</char*>
Did you have a look at the ocilib demo files (under demo folder)
Hi
Yes I did. I was able to do most things. Ex. Select a blob from a table
Just having a problem with taking an array of bytes. I get this from a fingerprint reader.
Then need to insert this array into a record as a blob.
I used one of the demo programs as a basis. Where you read a file and insert into a table.
Thanks
Martin
Hi Vincent
I did get this to work. I suppose I am still learning.
I did a insert using the value EMPTY_BLOB().
Then I did a select ... for update and
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs)) {
OCI_Lob *lob5 = OCI_GetLob(rs, 1);
boolean ret = OCI_LobAppend(lob5, wsqImg, len); // wsqImg - passed buffer
int lenold = OCI_LobGetLength(lob5);
}
Still not sure why OCI_Lob * lob3 = OCI_LobCreate(cn, OCI_BLOB);
always returns NULL though.
Thanks