firebird save textview buffer gtk#

143 Views Asked by At

ok, I have a textview and I want to save content, that's what serialized, with the following code.

protected byte[] serializar(TextBuffer buffer)
{
    TextIter inicio, final;
    buffer.GetBounds(out inicio, out final); 
    Atom serialFormat = buffer.RegisterDeserializeTagset(null);
    byte[] datos = buffer.Serialize(buffer, serialFormat, inicio, final);
    return datos;
}

I have to read this one

protected Gtk.TextBuffer deserealizar (byte[] datos)
{
    TextBuffer txtBuffer = textview2.Buffer;
    Gdk.Atom serialFormat = txtBuffer.RegisterDeserializeTagset(null); 
    ulong datostamano = (ulong) datos.LongLength; 
    TextIter start = txtBuffer.StartIter; 
    txtBuffer.Deserialize(txtBuffer, serialFormat, ref start, datos, datostamano);

    return txtBuffer;
}

the code works, but when I insert firebird

insert ... value (serializar(textview.buffer))

i cant read the byte

how can insert the byte?, the db has a blob field, perhaps insert wrong

So how would the proper way to insert and read it in firebird?

0

There are 0 best solutions below