Skip to content

Commit

Permalink
ODBC-331 Moved C/C to 3.2 branch
Browse files Browse the repository at this point in the history
It's been updated to v3.2.4. utf8 charset is treated as utf8mb3, to
avoid 3.2 change to treat it as utf8mb4 to affect users.
  • Loading branch information
lawrinn committed Sep 9, 2021
1 parent ff3031c commit 5133f68
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libmariadb
7 changes: 6 additions & 1 deletion ma_connection.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************************************************************************
Copyright (C) 2013,2019 MariaDB Corporation AB
Copyright (C) 2013,2021 MariaDB Corporation AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
Expand All @@ -19,6 +19,7 @@
#include <ma_odbc.h>

extern const char* DefaultPluginLocation;
static const char* utf8mb3 = "utf8mb3";

struct st_madb_isolation MADB_IsolationLevel[] =
{
Expand Down Expand Up @@ -684,6 +685,10 @@ SQLRETURN MADB_DbcConnectDB(MADB_Dbc *Connection,

if (!MADB_IS_EMPTY(Dsn->CharacterSet))
{
if (strcmp(Dsn->CharacterSet, "utf8") == 0)
{
cs_name= utf8mb3;
}
cs_name= Dsn->CharacterSet;
}
else if (Connection->IsAnsi)
Expand Down
2 changes: 1 addition & 1 deletion ma_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ size_t MADB_GetDisplaySize(MYSQL_FIELD *Field, MARIADB_CHARSET_INFO *charset)
/* {{{ MADB_GetOctetLength */
size_t MADB_GetOctetLength(MYSQL_FIELD *Field, unsigned short MaxCharLen)
{
size_t Length= MIN(MADB_INT_MAX32, Field->length);
size_t Length= MIN(MADB_INT_MAX32, Field->/*max_*/length);

switch (Field->type) {
case MYSQL_TYPE_NULL:
Expand Down
5 changes: 5 additions & 0 deletions test/connstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,11 @@ ODBC_TEST(odbc_284)
IS_STR(Dsn->Description, descr, strlen(descr) + 1);
IS_STR(Dsn->ServerName, host, strlen(host) + 1);

RESET_DSN(Dsn);
_snprintf(connstr4dsn, sizeof(connstr4dsn), "driver={MariaDB ODBC 3.0 Driver};server={127.0.0.1};port=16001;database={test};pwd={}}};uid={root}}};OPTION=131;");

IS(MADB_ParseConnString(Dsn, connstr4dsn, SQL_NTS, ';'));

return OK;
}

Expand Down

0 comments on commit 5133f68

Please sign in to comment.