-
Couldn't load subscription status.
- Fork 12
Open
Description
Environment
- Engine:
postgresql - Plugin:
sqlc-gen-kotlin_1.2.0.wasm/22b437ecaea66417bbd3b958339d9868ba89368ce542c936c37305acf373104b - sqlc version: 1.28.0
Issue
Setup
I have the following migration.
CREATE TABLE counts (
slug text PRIMARY KEY,
count numeric NOT NULL,
increments numeric
);I have the following queries.
-- name: ListCounts :many
SELECT *
FROM counts;
-- name: CreateCounts :one
INSERT INTO counts (
slug,
count,
increments
) VALUES (
$1,
$2,
$3
) RETURNING *;Generated Code
The generated models
data class Count (
val slug: String,
val count: java.math.BigDecimal,
val increments: java.math.BigDecimal?
)Generated queries
@Throws(SQLException::class)
override fun createCounts(
slug: String,
count: java.math.BigDecimal,
increments: java.math.BigDecimal?): Count? {
return conn.prepareStatement(createCounts).use { stmt ->
stmt.setString(1, slug)
stmt.setjava.math.BigDecimal(2, count)
stmt.setjava.math.BigDecimal(3, increments)
val results = stmt.executeQuery()
if (!results.next()) {
return null
}
val ret = Count(
results.getString(1),
results.getjava.math.BigDecimal(2),
results.getjava.math.BigDecimal(3)
)
if (results.next()) {
throw SQLException("expected one row in result set, but got many")
}
ret
}
}Errors
- There is no
stmt.setjava.math.BigDecimal - There is no
results.getjava.math.BigDecimal
Proposed changes
- Update the postgres type of numeric to be just
BigDecimaland importjava.math.BigDecimalwhen used
Metadata
Metadata
Assignees
Labels
No labels