[CONJ-148] getColumnDisplaySize() give back zero when column type is LONGVARCHAR Created: 2015-04-13  Updated: 2018-01-24  Resolved: 2018-01-24

Status: Closed
Project: MariaDB Connector/J
Component/s: metadata
Affects Version/s: 1.1.8
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Eid Badr Assignee: Georg Richter
Resolution: Won't Fix Votes: 0
Labels: None
Environment:

Windows 7 64-bit



 Description   

Hello

the method getColumnDisplaySize() in ResultSetMetaData give back zero when the column type is LONGVARCHAR.

I have created tableX with one column of type longtext in the database and when I query the display size, then its 0.

ResultSet rs1 = stmt1.executeQuery("select * from tableX");
try
{
  ResultSetMetaData resultSetMetaDataOfTable = rs1.getMetaData();
  int iColumnDisplaySize = resultSetMetaDataOfTable.getColumnDisplaySize(1);
  System.out.println(iColumnDisplaySize); // output is 0
}



 Comments   
Comment by Vladislav Vaintroub [ 2015-08-26 ]

This is not unusual for JDBC driver to return 0 for fields of unknown width. See for example https://msdn.microsoft.com/en-us/library/ms378162%28v=SQL.110%29.aspx , or also discussion here https://bugs.mysql.com/bug.php?id=6399 , particularly from 1 dec 2010 "4. Note that for very large blob types I propose to return 0, which according to JDBC specs means "unknown width"."

What is the value you would expect? If width is know ,like CHAR(30), this method would return 30. But for LONGVARCHAR and LONGVARBINARY there is no width.

Comment by Diego Dupin [ 2018-01-24 ]

Closing since that is the expected behaviour

Generated at Thu Feb 08 03:13:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.