rds-data icon indicating copy to clipboard operation
rds-data copied to clipboard

adding decimal support

Open lbecker34 opened this issue 4 years ago • 4 comments

Change adds decimal support. Response for a decimal column from the AWS SDK is the following. Decimal columns are returned with a "stringValue" property.

{ "columnMetadata": [{ "arrayBaseColumnType": 0, "isAutoIncrement": false, "isCaseSensitive": false, "isCurrency": false, "isSigned": false, "label": "account", "name": "account", "nullable": 0, "precision": 100, "scale": 0, "schemaName": "", "tableName": "Movements", "type": 12, "typeName": "VARCHAR" }, { "arrayBaseColumnType": 0, "isAutoIncrement": false, "isCaseSensitive": true, "isCurrency": false, "isSigned": true, "label": "functional_amount", "name": "functional_amount", "nullable": 0, "precision": 27, "scale": 8, "schemaName": "", "tableName": "Movements", "type": 3, "typeName": "DECIMAL" }, { "arrayBaseColumnType": 0, "isAutoIncrement": false, "isCaseSensitive": true, "isCurrency": false, "isSigned": true, "label": "transaction_amount", "name": "transaction_amount", "nullable": 0, "precision": 27, "scale": 8, "schemaName": "", "tableName": "Movements", "type": 3, "typeName": "DECIMAL" } ], "numberOfRecordsUpdated": 0, "records": [ [{ "stringValue": "account" }, { "stringValue": "100.00000000" }, { "stringValue": "100.00000000" } ] ] }

lbecker34 avatar Jan 29 '21 18:01 lbecker34

I just figured out that inserts and updates are removing decimal places and entering the "longValue" also. So, I'm working on that now.

lbecker34 avatar Jan 29 '21 18:01 lbecker34

@lbecker34 I have not had a ton of time to work on this but there is an active PR that you may want to look at too that changes the return style (was going to be a v2 style update)

cbschuld avatar Jan 29 '21 18:01 cbschuld

@cbschuld Is there still value in me doing this then? When do you think that other PR will be done? I can still try and fix the bug where decimals are being rounded down to the whole number on update too.

lbecker34 avatar Jan 29 '21 18:01 lbecker34

@cbschuld This PR is now ready to go. I fixed the bug.

lbecker34 avatar Jan 29 '21 19:01 lbecker34