empty VBLOB data with correct length

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Apr 29 22:27:41 CDT 2005


On 4/29/05 4:47 PM, "Tomas Dikk" <t.dikk at se-dd.com> wrote:

Hi Thomas,

> hi everybody, i hope somebody could help me on this problem.
> i tried really for a long time and wasn't able to solve the problem.
> i'm programming in java and using valentina 1.1.
> 
> in short, i store some byte[] to a blob field, and then read
> it out again, and i check the length of the read out data which
> is what i stored, but when i read individual bytes, they are all
> zero. i made an example which you could check out:
> 
> it consists of 3 classes, App for testing, Table and DB for the DB/data
> 
> here is the code (it is a simple example to reproduce the behavior)
> 
> ################## APP.JAVA #######################
> 
> package blobtest;
> import com.paradigmasoft.valentina.vjdk.*;
> 
> public class App {
> 
> public static void main(String[] args) {
> try {
> // open
> VJDK.init(4 * 1024 * 1024, "", "");
> VJDK.setDebugLevel(2);
> db = new DB();
> 
> // do some operations
> Table t = db.get_table();
> 
> byte[] ba = new byte[2]; // make a byte buffer
> ba[0] = 1;
> ba[1] = 2;
> t.setBlank(); // clear temp record
> t.field_blob.setBLOBLength(2); // set length of blob data
> t.field_blob.deleteBLOBData(); // delete blob data of buffer record (not
> really necessary)
> t.field_blob.writeBLOBData(ba, ba.length, 0); // (buffer, buffer length, from
> where)
> t.addRecord(); // store record in db

Well, something wrong here.

To add record with some BLOB value you should write the following logic:

  byte[] ba = new byte[2]; // make a byte buffer
  ba[0] = 1;
  ba[1] = 2;

  t.setBlank(); // clear temp record

      t.field_blob.writeBLOBData(ba, ba.length, 0);

  t.addRecord(); // store record in db



-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list