-
Notifications
You must be signed in to change notification settings - Fork 425
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
API and JavaDoc changes for Spatial Datatypes #752
Changes from 3 commits
73edf05
a09c247
3f694ff
243f294
537959f
862d71d
d86b237
eac074f
79c7e59
81a065f
7ec6fcc
272a729
54c5297
a3eb552
0de6184
b4fca56
3135521
2dfb95b
6f4af3d
8aba9e6
589c1c0
a61a58b
1d7800d
1f3e437
35d99a8
e156263
5ca2a83
2f886a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,10 @@ | |
|
||
package com.microsoft.sqlserver.jdbc; | ||
|
||
import java.nio.BufferUnderflowException; | ||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
import java.text.MessageFormat; | ||
|
||
|
||
public class Geography extends SQLServerSpatialDatatype { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs class description |
||
|
@@ -49,8 +51,14 @@ private Geography(byte[] wkb) throws SQLServerException { | |
buffer = ByteBuffer.wrap(wkb); | ||
buffer.order(ByteOrder.LITTLE_ENDIAN); | ||
|
||
parseWkb(); | ||
|
||
try { | ||
parseWkb(); | ||
} catch (NegativeArraySizeException | BufferUnderflowException | OutOfMemoryError e) { | ||
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_ParsingError")); | ||
Object[] msgArgs = {JDBCType.VARBINARY}; | ||
throw new SQLServerException(this, form.format(msgArgs), null, 0, false); | ||
} | ||
|
||
WKTsb = new StringBuffer(); | ||
WKTsbNoZM = new StringBuffer(); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2010,7 +2010,8 @@ public int[] executeBatch() throws SQLServerException, BatchUpdateException, SQL | |
} catch (SQLException e) { | ||
// throw a BatchUpdateException with the given error message, and return null for the updateCounts. | ||
throw new BatchUpdateException(e.getMessage(), null, 0, null); | ||
} catch (IllegalArgumentException e) { | ||
} | ||
catch (IllegalArgumentException | StringIndexOutOfBoundsException e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this change is not related to Spatial types? You probably need to update the comment below too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move this change out of this PR as we already have another active PR to track useBulkCopyWithBatchInsert API changes. It will be easier to track changes there. |
||
// If we fail with IllegalArgumentException, fall back to the original batch insert logic. | ||
if (getStatementLogger().isLoggable(java.util.logging.Level.FINE)) { | ||
getStatementLogger().fine("Parsing user's Batch Insert SQL Query failed: " + e.toString()); | ||
|
@@ -2154,7 +2155,8 @@ public long[] executeLargeBatch() throws SQLServerException, BatchUpdateExceptio | |
} catch (SQLException e) { | ||
// throw a BatchUpdateException with the given error message, and return null for the updateCounts. | ||
throw new BatchUpdateException(e.getMessage(), null, 0, null); | ||
} catch (IllegalArgumentException e) { | ||
} | ||
catch (IllegalArgumentException | StringIndexOutOfBoundsException e) { | ||
// If we fail with IllegalArgumentException, fall back to the original batch insert logic. | ||
if (getStatementLogger().isLoggable(java.util.logging.Level.FINE)) { | ||
getStatementLogger().fine("Parsing user's Batch Insert SQL Query failed: " + e.toString()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1662,14 +1662,30 @@ class Figure { | |
this.pointOffset = pointOffset; | ||
} | ||
|
||
/** | ||
* Returns the figuresAttribute value. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am changing everything to be consistent. For getters, can you please say "Gets blah blah"? |
||
* | ||
* @return byte figuresAttribute value. | ||
*/ | ||
public byte getFiguresAttribute() { | ||
return figuresAttribute; | ||
} | ||
|
||
/** | ||
* Returns the pointOffset value. | ||
* | ||
* @return int pointOffset value. | ||
*/ | ||
public int getPointOffset() { | ||
return pointOffset; | ||
} | ||
|
||
/** | ||
* Sets the figuresAttribute value. | ||
* | ||
* @param fa | ||
* figuresAttribute value. | ||
*/ | ||
public void setFiguresAttribute(byte fa) { | ||
figuresAttribute = fa; | ||
} | ||
|
@@ -1691,18 +1707,39 @@ class Shape { | |
this.openGISType = openGISType; | ||
} | ||
|
||
/** | ||
* Returns the parentOffset value. | ||
* | ||
* @return int parentOffset value. | ||
*/ | ||
public int getParentOffset() { | ||
return parentOffset; | ||
} | ||
|
||
/** | ||
* Returns the figureOffset value. | ||
* | ||
* @return int figureOffset value. | ||
*/ | ||
public int getFigureOffset() { | ||
return figureOffset; | ||
} | ||
|
||
/** | ||
* Returns the openGISType value. | ||
* | ||
* @return byte openGISType value. | ||
*/ | ||
public byte getOpenGISType() { | ||
return openGISType; | ||
} | ||
|
||
/** | ||
* Sets the figureOffset value. | ||
* | ||
* @param fo | ||
* figureOffset value. | ||
*/ | ||
public void setFigureOffset(int fo) { | ||
figureOffset = fo; | ||
} | ||
|
@@ -1721,6 +1758,11 @@ class Segment { | |
this.segmentType = segmentType; | ||
} | ||
|
||
/** | ||
* Returns the segmentType value. | ||
* | ||
* @return byte segmentType value. | ||
*/ | ||
public byte getSegmentType() { | ||
return segmentType; | ||
} | ||
|
@@ -1744,18 +1786,38 @@ class Point { | |
this.m = m; | ||
} | ||
|
||
/** | ||
* Returns the x coordinate value. | ||
* | ||
* @return double x coordinate value. | ||
*/ | ||
public double getX() { | ||
return x; | ||
} | ||
|
||
/** | ||
* Returns the y coordinate value. | ||
* | ||
* @return double y coordinate value. | ||
*/ | ||
public double getY() { | ||
return y; | ||
} | ||
|
||
/** | ||
* Returns the z (elevation) value. | ||
* | ||
* @return double z value. | ||
*/ | ||
public double getZ() { | ||
return z; | ||
} | ||
|
||
/** | ||
* Returns the m (measure) value. | ||
* | ||
* @return double m value. | ||
*/ | ||
public double getM() { | ||
return m; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need to import this?