cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

sql: Add DATE/TIMESTAMP/INTERVAL parameters

Open vivekmenezes opened this issue 11 years ago • 3 comments

These parameter types have to be embedded in the sql. Allow passing these as parameters.

vivekmenezes avatar Sep 02 '15 15:09 vivekmenezes

Supporting date/timestamp parameters should be straightforward (we're already passing time.Time parameters to the server, just not using them). Passing interval will be more interesting as there is not native support for time.Duration. While that type is simply an int64, I worry about the type checking after FillArgs is called. Argument filling might need to be augmented so that it is passed the expected type of the argument. Maybe. I haven't looked at this enough to be sure.

petermattis avatar Sep 02 '15 17:09 petermattis

I think we can have the user specify the type in the SQL. So when passing in an interval they would use an int64 and specify "INTERVAL $3" in the sql. Same with Date, "Date $4," where $4 is of type time.Time

vivekmenezes avatar Sep 02 '15 17:09 vivekmenezes

Ah, yes, that should work.

petermattis avatar Sep 02 '15 17:09 petermattis