Skip to content

Commit 2535416

Browse files
committed
Fix incorrect FreeTDS login option indices
1 parent de72b79 commit 2535416

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Sources/SQLClientSwift/SQLClient.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,15 +288,14 @@ public actor SQLClient {
288288
dbsetlname(lgn, "SQLClientSwift", 5) // DBSETAPP
289289

290290
// Ensure we get UTF-8 from the server for N-types
291-
// index 7 is DBSETCHARSET
292-
dbsetlname(lgn, "UTF-8", 7)
293-
294-
if let port = options.port { dbsetlshort(lgn, Int32(port), 13) } // DBSETPORT
295-
if options.encryption != .request { dbsetlname(lgn, options.encryption.rawValue, 17) } // DBSETENCRYPTION
296-
dbsetlbool(lgn, options.useNTLMv2 ? 1 : 0, 16) // DBSETNTLMV2
297-
if options.networkAuth { dbsetlbool(lgn, 1, 15) } // DBSETNETWORKAUTH
298-
if options.readOnly { dbsetlbool(lgn, 1, 14) } // DBSETREADONLY
299-
if options.useUTF16 { dbsetlbool(lgn, 1, 18) } // DBSETUTF16
291+
dbsetlname(lgn, "UTF-8", 10) // DBSETCHARSET
292+
293+
if let port = options.port { dbsetlshort(lgn, Int32(port), 1006) } // DBSETPORT
294+
if options.encryption != .request { dbsetlname(lgn, options.encryption.rawValue, 1005) } // DBSETENCRYPTION
295+
dbsetlbool(lgn, options.useNTLMv2 ? 1 : 0, 1002) // DBSETNTLMV2
296+
if options.networkAuth { dbsetlbool(lgn, 1, 101) } // DBSETNETWORKAUTH
297+
if options.readOnly { dbsetlbool(lgn, 1, 1003) } // DBSETREADONLY
298+
if options.useUTF16 { dbsetlbool(lgn, 1, 1001) } // DBSETUTF16
300299
if options.loginTimeout > 0 { dbsetlogintime(Int32(options.loginTimeout)) }
301300

302301
guard let conn = dbopen(lgn, options.server) else {

0 commit comments

Comments
 (0)