ODBC Driver for Linear

Build 26.0.9776

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 title, description FROM Issue WHERE priority = ?", "1")
defer rows.Close()
for rows.Next() {
        var (
                title string
                description string
        )

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

Reusable Statements

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

stmt, _ := db.Prepare("SELECT title, description FROM Issue WHERE priority = ?")
defer stmt.Close()

rows, _ := stmt.Query("1 1")
defer rows.Close()
for rows.Next() {
        var (
                title string
                description string
        )

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

rows, _ = stmt.Query("1 2")
defer rows.Close()
for rows.Next() {
        var (
                title string
                description string
        )

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

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9776