Last active
November 14, 2016 08:20
-
-
Save dkeza/347a50555c45220286dfcd5f77499773 to your computer and use it in GitHub Desktop.
Test SebastiaanKlippert/go-foxpro-dbf Number, Datetime and Currency VisualFoxPro fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE testf (dtime t, number N(12), curr Y) | |
INSERT INTO testf (dtime, number, curr) VALUES (DATETIME(), 8027846523, 1234567890.1234) | |
RETURN .T. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"github.com/SebastiaanKlippert/go-foxpro-dbf" | |
) | |
func main() { | |
testnum, err := dbf.OpenFile("TESTF.DBF", new(dbf.Win1250Decoder)) | |
if err != nil { | |
log.Fatal(err) | |
return | |
} | |
defer testnum.Close() | |
record, err := testnum.RecordAt(0) | |
if err != nil { | |
log.Fatal(err) | |
return | |
} | |
log.Println(record.Field(testnum.FieldPos("DTIME"))) | |
log.Println(record.Field(testnum.FieldPos("NUMBER"))) | |
CURR, _ := record.Field(testnum.FieldPos("CURR")) | |
log.Printf("%f\n", CURR) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
testf.dbf table file for testing
(rename test.dbf.jpg to test.dbf)