Skip to content

Commit

Permalink
add tzname optional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nakagami committed Dec 8, 2018
1 parent cc3394f commit e3b05ee
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ param1, param2... are
.. csv-table::
:header: Name,Description,Default,Note

role,Role name,
auth_plugin_name,Authentication plugin name.,Srp,Srp256/Srp/Legacy_Auth are available.
wire_crypt,Enable wire data encryption or not.,true,For Firebird 3.0+
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+
28 changes: 14 additions & 14 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ import (
)

type firebirdsqlConn struct {
wp *wireProtocol
tx *firebirdsqlTx
addr string
dbName string
user string
password string
column_name_to_lower bool
isAutocommit bool
clientPublic *big.Int
clientSecret *big.Int
transHandles []int32
timeZoneIds map[int]string
wp *wireProtocol
tx *firebirdsqlTx
addr string
dbName string
user string
password string
columnNameToLower bool
isAutocommit bool
clientPublic *big.Int
clientSecret *big.Int
transHandles []int32
timeZoneIds map[int]string
}

func (fc *firebirdsqlConn) begin(isolationLevel int) (driver.Tx, error) {
Expand Down Expand Up @@ -777,7 +777,7 @@ func newFirebirdsqlConn(dsn string) (fc *firebirdsqlConn, err error) {
fc.dbName = dbName
fc.user = user
fc.password = password
fc.column_name_to_lower = column_name_to_lower
fc.columnNameToLower = column_name_to_lower
fc.isAutocommit = true
fc.tx, err = newFirebirdsqlTx(fc, ISOLATION_LEVEL_READ_COMMITED, fc.isAutocommit)
fc.clientPublic = clientPublic
Expand Down Expand Up @@ -817,7 +817,7 @@ func createFirebirdsqlConn(dsn string) (fc *firebirdsqlConn, err error) {
fc.dbName = dbName
fc.user = user
fc.password = password
fc.column_name_to_lower = column_name_to_lower
fc.columnNameToLower = column_name_to_lower
fc.isAutocommit = true
fc.tx, err = newFirebirdsqlTx(fc, ISOLATION_LEVEL_READ_COMMITED, fc.isAutocommit)
fc.clientPublic = clientPublic
Expand Down
2 changes: 1 addition & 1 deletion rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (rows *firebirdsqlRows) Columns() []string {
columns := make([]string, len(rows.stmt.xsqlda))
for i, x := range rows.stmt.xsqlda {
columns[i] = x.aliasname
if rows.stmt.tx.fc.column_name_to_lower {
if rows.stmt.tx.fc.columnNameToLower {
columns[i] = strings.ToLower(columns[i])
}
}
Expand Down
5 changes: 3 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ func parseDSN(dsn string) (addr string, dbName string, user string, passwd strin
m, _ := url.ParseQuery(u.RawQuery)

var default_options = map[string]string{
"role": "",
"auth_plugin_name": "Srp",
"wire_crypt": "true",
"column_name_to_lower": "false",
"role": "",
"tzname": "",
"wire_crypt": "true",
}

for k, v := range default_options {
Expand Down

0 comments on commit e3b05ee

Please sign in to comment.