| 590 | } |
| 591 | |
| 592 | void CMysqlConnection::GetString(int Col, char *pBuffer, int BufferSize) |
| 593 | { |
| 594 | Col -= 1; |
| 595 | |
| 596 | for(int i = 0; i < BufferSize; i++) |
| 597 | { |
| 598 | pBuffer[i] = '\0'; |
| 599 | } |
| 600 | |
| 601 | MYSQL_BIND Bind; |
| 602 | unsigned long Length; |
| 603 | my_bool IsNull; |
| 604 | my_bool Error; |
| 605 | mem_zero(&Bind, sizeof(Bind)); |
| 606 | Bind.buffer_type = MYSQL_TYPE_STRING; |
| 607 | Bind.buffer = pBuffer; |
| 608 | // leave one character for null-termination |
| 609 | Bind.buffer_length = BufferSize - 1; |
| 610 | Bind.length = &Length; |
| 611 | Bind.is_null = &IsNull; |
| 612 | Bind.is_unsigned = false; |
| 613 | Bind.error = &Error; |
| 614 | if(mysql_stmt_fetch_column(m_pStmt.get(), &Bind, Col, 0)) |
| 615 | { |
| 616 | StoreErrorStmt("fetch_column:string"); |
| 617 | dbg_assert_failed("Error in GetString(%d): error fetching column %s", Col + 1, m_aErrorDetail); |
| 618 | } |
| 619 | dbg_assert(!IsNull, "Error in GetString(%d): NULL", Col + 1); |
| 620 | dbg_assert(!Error, "Error in GetString(%d): truncation occurred", Col + 1); |
| 621 | } |
| 622 | |
| 623 | int CMysqlConnection::GetBlob(int Col, unsigned char *pBuffer, int BufferSize) |
| 624 | { |
no test coverage detected