44 "context"
55 "database/sql/driver"
66 "fmt"
7+ "strconv"
78 "time"
89
910 "github.com/databricks/databricks-sql-go/driverctx"
@@ -342,7 +343,7 @@ func (c *conn) executeStatement(ctx context.Context, query string, args []driver
342343}
343344
344345func namedValuesToTSparkParams (args []driver.NamedValue ) []* cli_service.TSparkParameter {
345- var ts []string = []string {"STRING" , "DOUBLE" , "BOOLEAN" }
346+ var ts []string = []string {"STRING" , "DOUBLE" , "BOOLEAN" , "TIMESTAMP" , "FLOAT" , "INTEGER" , "TINYINT" , "SMALLINT" , "BIGINT" }
346347 var params []* cli_service.TSparkParameter
347348 for i := range args {
348349 arg := args [i ]
@@ -366,47 +367,51 @@ func namedValuesToTSparkParams(args []driver.NamedValue) []*cli_service.TSparkPa
366367 case int :
367368 f := float64 (t )
368369 param .Value .DoubleValue = & f
369- param .Type = & ts [1 ]
370+ param .Type = & ts [5 ]
370371 case uint :
371372 f := float64 (t )
372373 param .Value .DoubleValue = & f
373- param .Type = & ts [1 ]
374+ param .Type = & ts [5 ]
374375 case int8 :
375376 f := float64 (t )
376377 param .Value .DoubleValue = & f
377- param .Type = & ts [1 ]
378+ param .Type = & ts [6 ]
378379 case uint8 :
379380 f := float64 (t )
380381 param .Value .DoubleValue = & f
381- param .Type = & ts [1 ]
382+ param .Type = & ts [6 ]
382383 case int16 :
383384 f := float64 (t )
384385 param .Value .DoubleValue = & f
385- param .Type = & ts [1 ]
386+ param .Type = & ts [7 ]
386387 case uint16 :
387388 f := float64 (t )
388389 param .Value .DoubleValue = & f
389- param .Type = & ts [1 ]
390+ param .Type = & ts [7 ]
390391 case int32 :
391392 f := float64 (t )
392393 param .Value .DoubleValue = & f
393- param .Type = & ts [1 ]
394+ param .Type = & ts [5 ]
394395 case uint32 :
395396 f := float64 (t )
396397 param .Value .DoubleValue = & f
397- param .Type = & ts [1 ]
398+ param .Type = & ts [5 ]
398399 case int64 :
399- f := float64 ( t )
400- param .Value .DoubleValue = & f
401- param .Type = & ts [1 ]
400+ s := strconv . FormatInt ( t , 10 )
401+ param .Value .StringValue = & s
402+ param .Type = & ts [8 ]
402403 case uint64 :
403- f := float64 ( t )
404- param .Value .DoubleValue = & f
405- param .Type = & ts [1 ]
404+ s := strconv . FormatUint ( t , 10 )
405+ param .Value .StringValue = & s
406+ param .Type = & ts [8 ]
406407 case float32 :
407408 f := float64 (t )
408409 param .Value .DoubleValue = & f
409- param .Type = & ts [1 ]
410+ param .Type = & ts [4 ]
411+ case time.Time :
412+ s := t .String ()
413+ param .Value .StringValue = & s
414+ param .Type = & ts [3 ]
410415 default :
411416 s := fmt .Sprintf ("%s" , arg .Value )
412417 param .Value .StringValue = & s
0 commit comments