otl 向 oracle blob 写大文本文件,求解

zhangpeirong 2010-12-29 05:19:44
otl_connect conn;

conn.rlogon( "", 1 );

otl_long_string f2(60000);
conn.set_max_long_size(60000);
const char * sql_get_config="INSERT INTO tbtestgamedata VALUES(:P1<int>,empty_blob()) returning testdata into :testdata<blob>";// returning f1 into :f2<blob,in>

otl_stream get_info( 1, sql_get_config, conn );
get_info.set_commit(0);
char buf[260];
std::string _path;
GetModuleFileNameA( 0, buf, 260 );
std::string f=buf;
// 分析文件路径
size_t i=f.find_last_of( "\\/" );
_path=f.substr( 0, i );
_path += "\\312.XML";
FILE *fp;
for(int i = 0; i < 1; i++)
{
fp = fopen( _path.c_str(), "rb" );
if(fp == NULL)
std::cout << _path.c_str() << "找不到";
int size = filelength(fileno(fp));
char * b=new char[size];
fread( b, 1, size, fp );
for(int j =0; j <size; j++)
{
f2[j]=b[j];
}
f2.set_len(size);
otl_lob_stream lob;
get_info <<i;
get_info <<f2;
//set_info <<i;

//lob <<f2;
//lob<<f2;
lob.close();
fclose(fp);
}
conn.commit();
conn.logoff();
return 0;
...全文
102 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Snovate 2012-05-29
  • 打赏
  • 举报
回复
大哥,有没有解决读写BLOB的问题?我用的是Oracle 10.2也出现这问题怎么玩就是玩不通啊,一到,open就抛出异常了,求帮助啊
zhangpeirong 2010-12-29
  • 打赏
  • 举报
回复
数据库里的字段是blob
zhangpeirong 2010-12-29
  • 打赏
  • 举报
回复
<<otl_long_string 报异常,怎么解决

4,011

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧