m_ptCodec = QTextCodec::codecForName("utf8");//....m_ptCodec->toUnicode(sqTemperature.value(0).toString().utf8()));
QVariant QIBaseResultPrivate::fetchBlob(ISC_QUAD *bId){ isc_blob_handle handle = 0; isc_open_blob2(status, &ibase, &trans, &handle, bId, 0, 0); if (isError("Unable to open BLOB", QSqlError::Statement)) return QVariant(); unsigned short len = 0; static char blob_items[] = { isc_info_blob_max_segment, isc_info_blob_num_segments, isc_info_blob_type}; char res_buffer[32]; int length; ISC_STATUS stat = isc_blob_info(status, &handle,sizeof(blob_items), blob_items, sizeof(res_buffer), res_buffer); char *p, item; long max_size = 0L, num_segments = 0L; for (p = res_buffer; *p != isc_info_end ;) { item = *p++; length = (short)isc_vax_integer(p, 2); p += 2; switch (item) { case isc_info_blob_max_segment: max_size = isc_vax_integer(p, length); break; case isc_info_blob_num_segments: num_segments = isc_vax_integer(p, length); break; case isc_info_truncated: /* handle error */ break; default: break; } p += length; }; QByteArray ba(max_size); uint osize = max_size; for (int i=0; i<num_segments; i++) { stat = isc_get_segment(status, &handle, &len, osize, ba.data() + osize*i); ba.resize(ba.size() + len); } bool isErr = isError("Unable to read BLOB", QSqlError::Statement); isc_close_blob(status, &handle); if (isErr) return QVariant(); ba.resize(ba.size()-max_size); printf("Error %d length is %d\n", isErr, ba.size()); return ba;}///...........void QIBaseResultPrivate::writeBlob(int i, const QByteArray &ba){ isc_blob_handle handle = 0; ISC_QUAD *bId = (ISC_QUAD*)inda->sqlvar[i].sqldata; isc_create_blob2(status, &ibase, &trans, &handle, bId, 0, 0); if (!isError("Unable to create BLOB", QSqlError::Statement)) { uint i = 0; while (i < ba.size()) { isc_put_segment(status, &handle, QMIN(ba.size() - i, SHRT_MAX), ba.data()+i); if (isError("Unable to write BLOB")) break; i += SHRT_MAX; } } isc_close_blob(status, &handle);}