~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/events_ms.cc

  • Committer: Brian Aker
  • Date: 2010-07-20 02:17:09 UTC
  • mto: This revision was merged to the branch mainline in revision 1665.
  • Revision ID: brian@gaz-20100720021709-1yeehbw8d5vbtmlc
Removed identifier bit

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
                field = data.table.getBlobFieldAt(i);
59
59
 
60
60
                // Get the blob record:
61
 
                blob_rec = new_row + field->offset(data.table.getInsertRecord());
 
61
                blob_rec = new_row + field->offset(data.table.record[0]);
62
62
                packlength = field->pack_length() - data.table.getBlobPtrSize();
63
63
 
64
64
                length = field->get_length(blob_rec);
90
90
                }
91
91
                
92
92
                // Signal PBMS to delete the reference to the BLOB.
93
 
                err = MSEngine::referenceBlob(data.table.getSchemaName(), data.table.getTableName(), &blob_url_buffer, blob_url, field->position(), &result);
 
93
                err = MSEngine::referenceBlob(data.table.getSchemaName(), data.table.getTableName(), &blob_url_buffer, blob_url, field->field_index, &result);
94
94
                if (err) {
95
95
                        // If it fails log the error and continue to try and release any other BLOBs in the row.
96
96
                        fprintf(stderr, "PBMSEvents: referenceBlob(\"%s.%s\", \"%s\" ) error (%d):'%s'\n", 
136
136
                field = data.table.getBlobFieldAt(i);
137
137
 
138
138
                // Get the blob record:
139
 
                blob_rec = (char *)old_row + field->offset(data.table.getInsertRecord());
 
139
                blob_rec = (char *)old_row + field->offset(data.table.record[0]);
140
140
                packlength = field->pack_length() - data.table.getBlobPtrSize();
141
141
 
142
142
                length = field->get_length((unsigned char *)blob_rec);
206
206
        }
207
207
        
208
208
        // Tell PBMS to add a reference to the BLOB.
209
 
        err = MSEngine::referenceBlob(db, table_name, &blob_url_buffer, blob_url, field->position(), &result);
 
209
        err = MSEngine::referenceBlob(db, table_name, &blob_url_buffer, blob_url, field->field_index, &result);
210
210
        if (err) {
211
211
                // If it fails log the error and continue to try and release any other BLOBs in the row.
212
212
                fprintf(stderr, "PBMSEvents: referenceBlob(\"%s.%s\", \"%s\" ) error (%d):'%s'\n", 
222
222
                char *blob = possible_blob_url; // This is the BLOB as the server currently sees it.
223
223
                
224
224
                if (length != org_length) {
225
 
                        field->store_length(blob_rec, packlength);
 
225
                        field->store_length(blob_rec, packlength, length);
226
226
                }
227
227
                
228
228
                if (length > org_length) {
286
286
                // Get the blob record:
287
287
                packlength = field->pack_length() - data.table.getBlobPtrSize();
288
288
 
289
 
                blob_rec = (unsigned char *)data.row + field->offset(data.table.getInsertRecord());
 
289
                blob_rec = (unsigned char *)data.row + field->offset(data.table.record[0]);
290
290
                length = field->get_length(blob_rec);
291
291
                memcpy(&blob_url, blob_rec +packlength, sizeof(char*));
292
292
 
343
343
                // Check to see if the BLOB data was updated.
344
344
 
345
345
                // Get the blob records:
346
 
                field_offset = field->offset(data.table.getInsertRecord());
 
346
                field_offset = field->offset(data.table.record[0]);
347
347
                packlength = field->pack_length() - data.table.getBlobPtrSize();
348
348
 
349
349
                if (new_null) {
397
397
                
398
398
                if ( (new_null == false) || (old_null == false)) {
399
399
                        const unsigned char *blob_rec;                  
400
 
                        size_t field_offset = field->offset(data.table.getInsertRecord());
 
400
                        size_t field_offset = field->offset(data.table.record[0]);
401
401
                        size_t packlength = field->pack_length() - data.table.getBlobPtrSize();
402
402
                        char *old_blob_url, *new_blob_url;
403
403
                        
440
440
                // Get the blob record:
441
441
                packlength = field->pack_length() - data.table.getBlobPtrSize();
442
442
 
443
 
                blob_rec = data.row + field->offset(data.table.getInsertRecord());
 
443
                blob_rec = data.row + field->offset(data.table.record[0]);
444
444
                length = field->get_length(blob_rec);
445
445
                memcpy(&blob_url, blob_rec +packlength, sizeof(char*));
446
446