Compare commits

..

No commits in common. "3e96fdbb353dbe6ba69b8f681a95d605e31da72b" and "92f089b828d89c73453e5e3326de631c816a154e" have entirely different histories.

3 changed files with 7 additions and 9 deletions

View File

@ -41,10 +41,8 @@ func (ft FieldType) ParseValue(reader Reader, s string) (any, error) {
return s, nil
case Integer:
return strconv.ParseInt(s, 10, 64)
case Float, Money:
s = strings.ReplaceAll(s, ",", ".")
s = strings.ReplaceAll(s, " ", "")
return strconv.ParseFloat(s, 64)
case Float:
return strconv.ParseFloat(strings.ReplaceAll(s, ",", "."), 64)
case Date:
if i, ok := reader.(CustomDateParser); ok {
t, err := i.ParseDate(s)
@ -79,7 +77,7 @@ func (ft FieldType) SqlFieldType() string {
case Float:
return "float"
case Money:
return "numeric(15, 2)" // TODO: https://github.com/denisenkom/go-mssqldb/issues/460
panic("do not implemented - see https://github.com/denisenkom/go-mssqldb/issues/460") // TODO: https://github.com/denisenkom/go-mssqldb/issues/460
case Date:
return "date"
case Timestamp:

View File

@ -17,7 +17,7 @@ func TestCsvReaderBasic(t *testing.T) {
encoding: "win1251",
comma: rune(";"[0]),
skipRows: 3,
fieldsTypes: "s ttmmsssss",
fieldsTypes: "s ttffsssss",
dateFormat: "02.01.2006",
timestampFormat: "02.01.2006 15:04:05",
timezone: time.Local}
@ -34,7 +34,7 @@ func TestCsvReaderBasic(t *testing.T) {
t2 := time.Date(2023, 03, 20, 0, 0, 0, 0, time.Local)
assert.Equal(t, []any{"307814009186", t1, t2, 499.00, 488.52, "522598******7141", "REZE64", "Покупка", "35068281112", "307817403283"}, row)
_, err = csvReader.GetRow(false)
row, err = csvReader.GetRow(false)
assert.Equal(t, err, io.EOF)
err = csvReader.Close()

View File

@ -14,7 +14,7 @@ func TestDbfReaderBasic(t *testing.T) {
assert.NoError(t, err)
options := &Options{
fieldsTypes: "sssssstdmmsss",
fieldsTypes: "sssssstdffsss",
timezone: time.Local,
encoding: "cp866"}
@ -30,7 +30,7 @@ func TestDbfReaderBasic(t *testing.T) {
t2 := time.Date(2023, 02, 21, 0, 0, 0, 0, time.Local)
assert.Equal(t, []any{"719089383780", "44", "8644", "570000009312", "STOLOVAYA TSPP", "844417", t1, t2, 1757.08, 1713.15, "536829XXXXXX9388", "UM1TS8", "D"}, row)
_, err = dbfReader.GetRow(false)
row, err = dbfReader.GetRow(false)
assert.Equal(t, err, io.EOF)
err = dbfReader.Close()