205
return (const PBMSEnginePtr)NULL;
209
209
//---------------
210
int32_t MSEngine::createBlob(const char *db_name, const char *tab_name, char *blob, size_t blob_len, PBMSBlobURLPtr blob_url, PBMSResultPtr result)
210
bool MSEngine::try_createBlob(CSThread *self, const char *db_name, const char *tab_name, char *blob, size_t blob_len, PBMSBlobURLPtr blob_url)
216
CSInputStream *i_stream = NULL;
212
volatile bool rtc = true;
218
CLOBBER_PROTECT(err);
220
if ((err = enterConnectionNoThd(&self, result)))
216
CSInputStream *i_stream = NULL;
225
218
otab = openTable(db_name, tab_name, true);
232
225
CSException::throwException(CS_CONTEXT, MS_ERR_RECOVERY_IN_PROGRESS, "Cannot create BLOBs during repository recovery.");
234
227
backtopool_(otab);
236
int32_t MSEngine::createBlob(const char *db_name, const char *tab_name, char *blob, size_t blob_len, PBMSBlobURLPtr blob_url, PBMSResultPtr result)
242
if ((err = enterConnectionNoThd(&self, result)))
246
if (try_createBlob(self, db_name, tab_name, blob, blob_len, blob_url))
237
247
err = exceptionToResult(&self->myException, result);
243
252
//---------------
253
bool MSEngine::try_referenceBlob(CSThread *self, const char *db_name, const char *tab_name, PBMSBlobURLPtr ret_blob_url, char *blob_url, uint16_t col_index)
255
volatile bool rtc = true;
260
if (! PBMSBlobURLTools::couldBeURL(blob_url, &blob)){
261
char buffer[CS_EXC_MESSAGE_SIZE];
263
cs_strcpy(CS_EXC_MESSAGE_SIZE, buffer, "Incorrect URL: ");
264
cs_strcat(CS_EXC_MESSAGE_SIZE, buffer, blob_url);
265
CSException::throwException(CS_CONTEXT, MS_ERR_INCORRECT_URL, buffer);
268
otab = openTable(db_name, tab_name, true);
271
otab->useBlob(blob.bu_type, blob.bu_db_id, blob.bu_tab_id, blob.bu_blob_id, blob.bu_auth_code, col_index, blob.bu_blob_size, blob.bu_blob_ref_id, ret_blob_url);
244
282
int32_t MSEngine::referenceBlob(const char *db_name, const char *tab_name, PBMSBlobURLPtr ret_blob_url, char *blob_url, uint16_t col_index, PBMSResultPtr result)
248
286
int32_t err = MS_OK;
252
CLOBBER_PROTECT(err);
254
288
if ((err = enterConnectionNoThd(&self, result)))
260
if (! PBMSBlobURLTools::couldBeURL(blob_url, &blob)){
261
char buffer[CS_EXC_MESSAGE_SIZE];
263
cs_strcpy(CS_EXC_MESSAGE_SIZE, buffer, "Incorrect URL: ");
264
cs_strcat(CS_EXC_MESSAGE_SIZE, buffer, blob_url);
265
CSException::throwException(CS_CONTEXT, MS_ERR_INCORRECT_URL, buffer);
268
otab = openTable(db_name, tab_name, true);
271
otab->useBlob(blob.bu_type, blob.bu_db_id, blob.bu_tab_id, blob.bu_blob_id, blob.bu_auth_code, col_index, blob.bu_blob_size, blob.bu_blob_ref_id, ret_blob_url);
292
if (try_referenceBlob(self, db_name, tab_name, ret_blob_url, blob_url, col_index))
276
293
err = exceptionToResult(&self->myException, result);
282
299
//---------------
283
int32_t MSEngine::dereferenceBlob(const char *db_name, const char *tab_name, char *blob_url, PBMSResultPtr result)
300
bool MSEngine::try_dereferenceBlob(CSThread *self, const char *db_name, const char *tab_name, char *blob_url)
290
CLOBBER_PROTECT(err);
292
if ((err = enterConnectionNoThd(&self, result)))
302
volatile bool rtc = true;
297
307
if (! PBMSBlobURLTools::couldBeURL(blob_url, &blob)){
298
308
char buffer[CS_EXC_MESSAGE_SIZE];
323
333
CSException::throwException(CS_CONTEXT, MS_ERR_INCORRECT_URL, buffer);
344
int32_t MSEngine::dereferenceBlob(const char *db_name, const char *tab_name, char *blob_url, PBMSResultPtr result)
349
if ((err = enterConnectionNoThd(&self, result)))
353
if (try_dereferenceBlob(self, db_name, tab_name, blob_url))
329
354
err = exceptionToResult(&self->myException, result);
359
bool MSEngine::try_dropDatabase(CSThread *self, const char *db_name)
361
volatile bool rtc = true;
363
MSDatabase::dropDatabase(db_name);
335
372
int32_t MSEngine::dropDatabase(const char *db_name, PBMSResultPtr result)
340
CLOBBER_PROTECT(err);
342
377
if ((err = enterConnectionNoThd(&self, result)))
347
MSDatabase::dropDatabase(db_name);
382
if (try_dropDatabase(self, db_name))
350
383
err = exceptionToResult(&self->myException, result);
355
388
//---------------
356
389
typedef struct UnDoInfo {
357
390
bool udo_WasRename;