H
H
Hoobert2012-03-28 12:30:48
Oracle
Hoobert, 2012-03-28 12:30:48

BLToolkit and Oracle BLOB?

I can't figure out how to insert a string into a BLOB type field using BLToolkit. There was no such example on the official website, and on the Internet, too. When inserting, an error occurs:

ORA-01461: допускается привязка LONG значения только для занесения в столбец LONG

The database has the following table:
CREATE TABLE "MF_WORKSPACE_THUMBNAILS" (
  "WORKSPACE_ID" NUMBER NOT NULL,
  "THUMBNAIL" BLOB NOT NULL)

The following class has been created for BLToolkit:
[TableName("MF_WORKSPACE_THUMBNAILS")]
public class WorkspaceThumbnails
{
    [MapField("WORKSPACE_ID")]
    public int WorkspaceID;

    [MapField("THUMBNAIL")]
    public object Thumbnail;
}

This is how the insert happens:
database.Into(database.WorkspaceThumbnails)
    .Value(t => t.WorkspaceID, id)
    .Value(t => t.Thumbnail, s)
    .Insert();

Where "s" is a 100x75px base64 encoded image.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kefir, 2012-04-05
@Hoobert

Have you ever encountered the fact that bltoolkit will pass the Thumbnail value as a parameter with OracleDbType = Raw set, and, accordingly, a 32kb limit on the array size?

H
Hoobert, 2012-03-29
@Hoobert

Everything turned out to be much easier. You just need to replace the object Thumbnail with a byte[] Thumbnail and everything will resolve itself and be written to the database. He outwitted himself in the end.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question