Skip to content

Commit

Permalink
Address Github automation feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeytenmsft committed Jan 14, 2024
1 parent d2e76c3 commit 8624c38
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lcids_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
//
// None of the SQL syntax uses any SQL Server version-specific syntax,
// and should work on any version without change.
const comparisonQueriesGeneratorSql = `
const comparisonQueriesGeneratorSQL = `
--
-- Generates SELECT statements for fetching data encoded with various code pages
-- along with the same data encoded in UTF-16.
Expand Down Expand Up @@ -264,9 +264,9 @@ type CpLcidComparisonMap map[CpLcid]CpLcidComparisonData

// Builds a map of LCID fetching queries for all codepage/LCID pairs.
func buildLcidFetchComparisonMap(conn *sql.DB, t *testing.T) CpLcidComparisonMap {
stmt, err := conn.Prepare(comparisonQueriesGeneratorSql)
stmt, err := conn.Prepare(comparisonQueriesGeneratorSQL)
if err != nil {
t.Fatalf("Unable to run comparison queries generator query %s", err.Error())
t.Error("Unable to run comparison queries generator query", err.Error())
}
defer stmt.Close()

Expand All @@ -290,14 +290,22 @@ func buildLcidFetchComparisonMap(conn *sql.DB, t *testing.T) CpLcidComparisonMap
}

var lcid int32
binary.Read(bytes.NewReader(lcidRaw), binary.BigEndian, &lcid)
err = binary.Read(bytes.NewReader(lcidRaw), binary.BigEndian, &lcid)
if err != nil {
t.Error("Failed to convert LCID from binary to int:", err.Error())
}

cplcid := CpLcid{codepage, lcid}
cplciddata := CpLcidComparisonData{collation, sqltext}

result[cplcid] = cplciddata
}

err = rows.Err()
if err != nil {
t.Error("Rows containing comparison queries have errors", err)
}

return result
}

Expand All @@ -308,7 +316,7 @@ func verifyLcidFetch(conn *sql.DB, sqltext *string, t *testing.T) bool {

err := conn.QueryRow(*sqltext).Scan(&refdata, &cpdata)
if err != nil {
t.Fatal("Cannot scan reference and codepage data", err)
t.Error("Cannot scan reference and codepage data", err)
}

return refdata == cpdata
Expand Down

0 comments on commit 8624c38

Please sign in to comment.