Skip to content
Firebird RDBMS sql driver for Go (golang)
Go C
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_examples
attic additional modification for pull request #77 Mar 1, 2019
.gitignore Remove unnecessary fmt.Sprintf May 29, 2018
.travis.yml travis upgrade to xenial Aug 20, 2019
LICENSE
README.rst fix: subscriber cancel event. added examples Oct 4, 2019
connection.go Refactoring some code Sep 23, 2019
consts.go implements firebird events Oct 3, 2019
decfloat.go fix decfloat Jan 2, 2019
decode_speed_test.go Avoid intermediate allocations for Firebird conversions. Oct 9, 2018
driver.go update copyright year Mar 2, 2019
driver_go18.go Add a simple check for current firebird connection Aug 23, 2019
driver_go18_test.go int128 support Sep 27, 2019
driver_test.go Transaction tests Sep 23, 2019
errmsgs.go Add package description. Mar 1, 2019
event.go comments Oct 6, 2019
event_test.go comments Oct 6, 2019
eventmanager.go
go.mod add go.mod Jun 9, 2019
remoteEvent.go comments Oct 6, 2019
result.go update copyright year Mar 2, 2019
rows.go Transaction tests Sep 23, 2019
srp.go update copyright year Mar 2, 2019
srp_test.go update copyright year Mar 2, 2019
statement.go Transaction tests Sep 23, 2019
subscriber.go fix aux port parsing Oct 6, 2019
timezonemap.go separate timezone map to timezonemap.go Mar 2, 2019
transaction.go
transaction_test.go Adding extra transaction test Sep 23, 2019
utils.go int128 support Sep 27, 2019
utils_test.go add test for issue #78 Mar 6, 2019
wireprotocol.go implements firebird events Oct 3, 2019
xsqlvar.go int128 support Sep 27, 2019

README.rst

firebirdsql (Go firebird sql driver)

Firebird RDBMS http://firebirdsql.org SQL driver for Go

https://travis-ci.org/nakagami/firebirdsql.svg?branch=master

Requirements

  • Firebird 2.5 or higher
  • Golang 1.7 or higher

Modules get (go version < 1.11)

$ go get github.com/cznic/mathutil
$ go get github.com/kardianos/osext
$ go get github.com/shopspring/decimal
$ go get github.com/nakagami/firebirdsql
$ go get gitlab.com/nyarla/go-crypt

Example

package main

import (
    "fmt"
    "database/sql"
    _ "github.com/nakagami/firebirdsql"
)

func main() {
    var n int
    conn, _ := sql.Open("firebirdsql", "user:password@servername/foo/bar.fdb")
    defer conn.Close()
    conn.QueryRow("SELECT Count(*) FROM rdb$relations").Scan(&n)
    fmt.Println("Relations count=", n)

}

See also driver_test.go

package main

   import (
    "fmt"
    "github.com/nakagami/firebirdsql"
)

func main() {
    dsn := "user:password@servername/foo/bar.fdb"
    events := []string{"my_event", "order_created"}
    fbEvent, _ := firebirdsql.NewFBEvent(dsn)
    defer fbEvent.Close()
    sbr, _ := fbEvent.Subscribe(events, func(event firebirdsql.Event) { //or use SubscribeChan
        fmt.Printf("event: %s, count: %d, id: %d, remote id:%d \n", event.Name, event.Count, event.ID, event.RemoteID)
    })
    defer sbr.Unsubscribe()
    go func() {
            fbEvent.PostEvent(events[0])
            fbEvent.PostEvent(events[1])
    }()
    <- make(chan struct{}) //wait
}

See also _example

Connection string

user:password@servername[:port_number]/database_name_or_file[?params1=value1[&param2=value2]...]

General

  • user: login user
  • password: login password
  • servername: Firebird server's host name or IP address.
  • port_number: Port number. default value is 3050.
  • database_name_or_file: Database path (or alias name).

Optional

param1, param2... are

Name Description Default Note
auth_plugin_name Authentication plugin name. Srp Srp256/Srp/Legacy_Auth are available.
column_name_to_lower Force column name to lower false For "github.com/jmoiron/sqlx"
role Role name    
tzname Time Zone name For Firebird 4.0+  
wire_crypt Enable wire data encryption or not. true For Firebird 3.0+
You can’t perform that action at this time.