  | |  | MyODBC and BLOB 's | MyODBC and BLOB 's 2005-04-19 - By Ian Klassen
Back Hello,
I'm trying to figure out why MyODBC is having trouble extending the size of net ->buff to accomodate a large (greater than 8k) BLOB.
Here's the MFC code I'm using as a test:
db.OpenEx(_T("dsn=test"), CDatabase::noOdbcDialog);
CMySet rs(&db); rs.Open(CRecordset::snapshot); rs.AddNew(); rs.m_id = 1; // int rs.m_type = 2; // int rs.m_pr1.SetSize(9000); // CByteArray (initial size is 12000)
// fill in test data into byte array for (int i = 0; i < 9000; i++) { rs.m_pr1[i] = 1; }
rs.Update();
The buff size is initally set to 8199 as seen in the ODBC debug log.
| >my_net_init | | >_mymalloc | | | enter: Size: 8199 | | | exit: ptr: 0x14d737e0 | | <_mymalloc | | >vio_fastsend | | | exit: 0 | | <vio_fastsend | <my_net_init
However, when it has to grow, I get a memory allocation error. I can't realloc the memory pointed to by net->buff without getting an error.
| >add_to_buffer | | enter: from: ',' length: 1 | | >extend_buffer | | | enter: current_length: 3 length: 1 buffer_length: 8192 | | | INFO: to: 14d737e3, buff: 14d737e0 | | <extend_buffer | <add_to_buffer | copy_rowdata: buffer: '', length: 9001, actual: 1 | >extend_buffer | | enter: current_length: 4 length: 9001 buffer_length: 8192 | | >my_realloc | | | my: ptr: 0x14d737e0 size: 16384 my_flags: 16
The address trying to be reallocated (to 16k) is the same address as the one initially allocated (to 8199) so I don't see why there should be a problem. Any idea as to what's going on?
Ian
-- MySQL ODBC Mailing List For list archives: http://lists.mysql.com/myodbc To unsubscribe: http://lists.mysql.com/myodbc?unsub=mysql@(protected)
Earn $52 per hosting referral at Lunarpages.
|
|
 |