Exec

Exec execute query which doesn’t require result set. It is suitable to execute queries that doesn’t return any record but success or failure, for example create table..., drop table..., insert into....

  • Request ExecRequest
FieldTypeDesc
sqlstringsql query text
paramsarray of anyquery bind variables
  • Response ExecResponse
FieldTypeDesc
succesbooltrue success, false error
reasonstringresponse message
elapsestringstring to represent elapse time

Examples

Go

Create table

sqlText := `
    create tag table example (
        name varchar(100) primary key, 
        time datetime basetime, 
        value double
    )`

cli.Exec(sqlText)

Drop table

sqlText := `drop table example`
cli.Exec(sqlText)

Insert

sqlText := `insert into example (name, time, value) values (?, ?, ?)`
cli.Exec(sqlText, "tag-name-1", time.Now(), 1.234)
Last updated on