Quantcast

ODBC and longtext limitation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ODBC and longtext limitation

leif.einar

Hi list,

 

We are using OTP18.3 on Centos towards a MySQL database using ODBC. When switching a column to LONGTEXT, ODBC type SQL_LONGVARCHAR, we noticed that the values were chopped off when reading from Erlang.

 

Reading odbcserver.h and odbcserver.c in the erlang distribution this was no surprise, as the ‘size’ variable is set to MAXCOLSIZE (=8001).

 

Increasing this define and recompiling the odbcserver fixed the limitation. Has anyone else experienced this limitation, and perhaps come up with a better solution? The solution feels wrong, since the maximum value of a LONGTEXT is rather big, and you do not want to malloc 4GB of memory for each LONGTEXT column.

 

Best Regards

Leif Einar Aune

 

 


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ODBC and longtext limitation

Éric Pailleau

Hi,
Did you considered using blob and LONGVARBINARY instead ?
This however imply use of temporary tables on some request at mysql side if I remember well.

Regards

"Envoyé depuis mon mobile " Eric



---- Leif Einar Aune a écrit ----

Hi list,

 

We are using OTP18.3 on Centos towards a MySQL database using ODBC. When switching a column to LONGTEXT, ODBC type SQL_LONGVARCHAR, we noticed that the values were chopped off when reading from Erlang.

 

Reading odbcserver.h and odbcserver.c in the erlang distribution this was no surprise, as the ‘size’ variable is set to MAXCOLSIZE (=8001).

 

Increasing this define and recompiling the odbcserver fixed the limitation. Has anyone else experienced this limitation, and perhaps come up with a better solution? The solution feels wrong, since the maximum value of a LONGTEXT is rather big, and you do not want to malloc 4GB of memory for each LONGTEXT column.

 

Best Regards

Leif Einar Aune

 

 


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ODBC and longtext limitation

leif.einar

Thanks for the tip, but BLOBs have the same error – from the source code (lib/odbc/c_src/odbcserver.c):

 

if(sql_type == SQL_LONGVARCHAR || sql_type == SQL_LONGVARBINARY || sql_type == SQL_WLONGVARCHAR)

                  size = MAXCOLSIZE;

 

So BLOBs will be chopped off as well

 

Best Regards

Leif Einar

 

From: Éric Pailleau [mailto:[hidden email]]
Sent: mandag 8. mai 2017 12.31
To: Erlang Questions <[hidden email]>; Leif Einar Aune <[hidden email]>
Subject: Re: [erlang-questions] ODBC and longtext limitation

 

Hi,
Did you considered using blob and LONGVARBINARY instead ?
This however imply use of temporary tables on some request at mysql side if I remember well.

Regards

"Envoyé depuis mon mobile " Eric



---- Leif Einar Aune a écrit ----

Hi list,

 

We are using OTP18.3 on Centos towards a MySQL database using ODBC. When switching a column to LONGTEXT, ODBC type SQL_LONGVARCHAR, we noticed that the values were chopped off when reading from Erlang.

 

Reading odbcserver.h and odbcserver.c in the erlang distribution this was no surprise, as the ‘size’ variable is set to MAXCOLSIZE (=8001).

 

Increasing this define and recompiling the odbcserver fixed the limitation. Has anyone else experienced this limitation, and perhaps come up with a better solution? The solution feels wrong, since the maximum value of a LONGTEXT is rather big, and you do not want to malloc 4GB of memory for each LONGTEXT column.

 

Best Regards

Leif Einar Aune

 

 


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...