ODBC Driver for Trello

Build 20.0.7587

Parameterized Statements

The following code example shows how to bind parameters to create parameterized statements.

Single-Use Statements

The Query and Exec functions both accept additional parameters for binding query parameters to values.

rows, _ := db.Query("SELECT BoardId, Name FROM Boards WHERE Name = ?", "Public Board")
defer rows.Close()
for rows.Next() {
        var (
                BoardId string
                Name string
        )

        rows.Scan(&BoardId, &Name)
        fmt.Printf("BoardId = %s, Name = %s\n", BoardId, Name)
}

Reusable Statements

The Prepare function creates prepared Stmt objects, which can be re-used across multiple Query and Exec calls.

stmt, _ := db.Prepare("SELECT BoardId, Name FROM Boards WHERE Name = ?")
defer stmt.Close()

rows, _ := stmt.Query("Public Board 1")
defer rows.Close()
for rows.Next() {
        var (
                BoardId string
                Name string
        )

        rows1.Scan(&BoardId, &Name)
        fmt.Printf("BoardId = %s, Name = %s\n", BoardId, Name)
}

rows, _ = stmt.Query("Public Board 2")
defer rows.Close()
for rows.Next() {
        var (
                BoardId string
                Name string
        )

        rows2.Scan(&BoardId, &Name)
        fmt.Printf("BoardId = %s, Name = %s\n", BoardId, Name)
}

Copyright (c) 2020 CData Software, Inc. - All rights reserved.
Build 20.0.7587