Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLColAttribute using SQL_DESC_OCTET_LENGTH doesn't return the maximum length #2677

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working Client interfaces normal

Comments

@monetdb-team
Copy link

Date: 2010-09-27 18:28:27 +0200
From: @skinkie
To: clients devs <>
Version: 11.1.1 (Mar2011) [obsolete]

Last updated: 2011-03-28 17:31:39 +0200

Comment 14940

Date: 2010-09-27 18:28:27 +0200
From: @skinkie

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.8 Safari/534.7
Build Identifier:

Following up http://bugs.monetdb.org/show_bug.cgi?id=2660

I investigated what call should provide the client interface with the maximum bytes of the column. The right [1] return values are:

  1. The maximum storage size ever possible (MSSQL)
  2. The maximum storage size used (MySQL)

MonetDB seems to return the same values for:
SQL_DESC_DISPLAY_SIZE (also used in SQLBindCol)
SQL_DESC_LENGTH (not tested)
SQL_DESC_OCTET_LENGTH (equal to Display Size)

As Sjoerd pointed out in [2] the return value here should be the display size times 6. Or (preferably) the maximum storage size for the greatest field.

[1] http://www.tech-archive.net/Archive/Data/microsoft.public.data.odbc/2004-06/0011.html
[2] http://bugs.monetdb.org/show_bug.cgi?id=2660

Reproducible: Always

Comment 15410

Date: 2011-01-24 14:13:29 +0100
From: @grobian

So, this bug is just about returning 6x SQL_DESC_DISPLAY_SIZE as SQL_DESC_OCTET_LENGTH?

If so, care to cook a patch?

Comment 15447

Date: 2011-02-05 16:01:26 +0100
From: @skinkie

Created attachment 52
Attempt to times 6 the octet length.

The attached patch is an attempt to only do it for 'from' MonetDB.

Attached file: octet_length_times_six.diff (text/plain, 2696 bytes)
Description: Attempt to times 6 the octet length.

Comment 15454

Date: 2011-02-14 14:56:59 +0100
From: @sjoerdmullender

Changeset 0be9028dca99 made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=0be9028dca99

Changeset description:

SQL_DESC_OCTET_LENGTH should give the size in bytes required to copy the data.
This fixes bug #2677.

Comment 15455

Date: 2011-02-14 14:58:54 +0100
From: @sjoerdmullender

Thanks for the patch. I have adapted it slightly and checked it in.
The adaptation is mainly for the closing NULL byte which should also be taken into account.
I'm assuming I can now close the bug.

Comment 15647

Date: 2011-03-28 17:31:39 +0200
From: @sjoerdmullender

The Mar2011 version has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Client interfaces normal
Projects
None yet
Development

No branches or pull requests

2 participants