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

[BUG] STAsBinary returns null for single point #1073

Closed
PavelPenkov opened this issue Jun 3, 2019 · 2 comments
Closed

[BUG] STAsBinary returns null for single point #1073

PavelPenkov opened this issue Jun 3, 2019 · 2 comments
Assignees
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.

Comments

@PavelPenkov
Copy link

Driver version

7.3.0.jre-8-preview

SQL Server version

Microsoft SQL Server 2017 (RTM-CU15) (KB4498951) - 14.0.3162.1 (X64)
May 15 2019 19:14:30
Copyright (C) 2017 Microsoft Corporation
Developer Edition (64-bit) on Linux (Ubuntu 16.04.6 LTS)

Client Operating System

Mac OS X

JAVA/JVM version

1.8.0

Table schema

CREATE TABLE points (location GEOGRAPHY)

Problem description

STAsBinary() returns null for single point values.
The problem is STAsBinary() always returns value of wkbNoZM field but if a Geography variable represents a single point then serializeToWkb writes to wkb field and wkbNoZM stays null. Here's relevant code in the driver

        if (isSinglePoint || isSingleLineSegment) {
            wkb = buf.array();
            return;
        }

JDBC trace logs

Reproduction code

        Geography point = Geography.parse("POINT (10 20)");

        byte[] wkb = point.STAsBinary();

        System.out.println(wkb);
@PavelPenkov PavelPenkov added the Bug A bug in the driver. A high priority item that one can expect to be addressed quickly. label Jun 3, 2019
@PavelPenkov PavelPenkov changed the title [BUG] [BUG] STAsBinary returns null for single point Jun 3, 2019
@rene-ye
Copy link
Member

rene-ye commented Jun 3, 2019

Hi @PavelPenkov, the team will look into this.

@ulvii
Copy link
Contributor

ulvii commented Sep 19, 2019

#1074 merged.

@ulvii ulvii closed this as completed Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.
Projects
None yet
Development

No branches or pull requests

4 participants