How to store/retrieve large blobs in SybaseCT

Article ID: 874
Last updated: 05 Feb, 2008
Article ID: 874
Last updated: 05 Feb, 2008
Revision: 1
Views: 7949
Posted: 11 Nov, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


When reading back binary large objects (blobs) from sybase I only get back 32K.


Cause


Sybase places two limits on the data being sent from the server. The textsize is the amount of data the server will send, and the textlimit is the amount of data the client will store.


Action


You need to set both the client and the server side limit. Include the following libraries (libctl7d is the MultiDebugShared version of the DBTools Sybase CT access library, you may change this to something that is appropriate for your project):
  • -I$(ROGUE)/ctlibsrc -I$(SYBASE)/include -L$(ROGUE)/lib -lctl7d -L$(SYBASE)/lib -lct
#include < rw/db/db.h>
#include < ctlenvh.h>
#include < ctlsysh.h>

// define BLOBSIZE to a suitable number of Kb
#define BLOBSIZE 100000

...
// Get correct environment handle by typecasting
RWDBSybCtLibEnvironmentHandle *envHandle = (RWDBSybCtLibEnvironmentHandle *)db.environmentHandle();
envHandle->textLimit(BLOBSIZE);

// Get a system handle from a connection
RWDBConnection cn = myDatabase.connection();
cn.beginTransaction(); RWDBSybCtLibSystemHandle* sysh = (RWDBSybCtLibSystemHandle*) cn.systemHandle();
sysh->textSize(BLOBSIZE);
cn.CommitTransaction()
// set the server side limit
ct_options(sysh->csconn(), RWDB_CS_SET, CS_OPT_TEXTSIZE, &limit, RWDB_CS_UNUSED, NULL);
This article was:   Helpful | Not helpful
Report an issue
Article ID: 874
Last updated: 05 Feb, 2008
Revision: 1
Views: 7949
Posted: 11 Nov, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category