[prev in list] [next in list] [prev in thread] [next in thread]
List: groovy-user
Subject: Issue with GroovySQL and insidious type conversion
From: Pascal DeMilly <list.groovy () newgenesys ! com>
Date: 2004-09-22 22:09:59
Message-ID: 1095890997.12274.127.camel () standing-cow ! home
[Download RAW message or body]
I have the following MySQL table
create Table Accounts (
CustomerNo CHAR(7) not NULL,
ContractNo CHAR(2) not NULL
)
Some of those CustomerNo starts with zeroes and are all numeric.
When creating a query with GroovySQL, groovy strip the leading zeroes.
crs.eachRow ("select * from Contracts") {
println "[${it.CustomerNo}-${it.ContractNo}"
}
This would not be important in the above case, except when I want to use
it as a parameter of another SQL query. It will then not match and fail.
ie: "select * from Customers where CustomerNo = ${it.CustomerNo}"
How can I force groovy not make the translation from a String to an
Integer. I tried forcing it with casting but it doesn't work.
I will appreciate any help. This has been torturing me all day
Pascal
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic