comparison Framework/MySQL/MySQLStatement.cpp @ 46:6a574d810b98

Compatibility with MySQL 8.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Jul 2018 12:27:40 +0200
parents b2ff1cd2907a
children 714c5d2bee76
comparison
equal deleted inserted replaced
44:95f0f57f8920 46:6a574d810b98
149 switch (field.charsetnr) 149 switch (field.charsetnr)
150 { 150 {
151 case 45: // utf8mb4_general_ci 151 case 45: // utf8mb4_general_ci
152 case 46: // utf8mb4_bin 152 case 46: // utf8mb4_bin
153 case 224: // utf8mb4_unicode_ci => RECOMMENDED collation 153 case 224: // utf8mb4_unicode_ci => RECOMMENDED collation
154 case 255: // utf8mb4_0900_ai_ci => necessary for MySQL 8.0
154 // https://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci 155 // https://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
155 orthancType_ = ValueType_Utf8String; 156 orthancType_ = ValueType_Utf8String;
156 break; 157 break;
157 158
158 case 63: 159 case 63:
393 mysql_stmt_attr_set(statement_, STMT_ATTR_CURSOR_TYPE, (void*) &type); 394 mysql_stmt_attr_set(statement_, STMT_ATTR_CURSOR_TYPE, (void*) &type);
394 } 395 }
395 } 396 }
396 397
397 398
399 MySQLStatement::~MySQLStatement()
400 {
401 try
402 {
403 Close();
404 }
405 catch (Orthanc::OrthancException&)
406 {
407 // Ignore possible exceptions due to connection loss
408 }
409 }
410
411
398 MYSQL_STMT* MySQLStatement::GetObject() 412 MYSQL_STMT* MySQLStatement::GetObject()
399 { 413 {
400 if (statement_ == NULL) 414 if (statement_ == NULL)
401 { 415 {
402 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); 416 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);