mirror of
https://github.com/nxshock/csv2db.git
synced 2025-04-20 01:21:51 +05:00
Compare commits
No commits in common. "3606f388906ec8f863487fdfffd31b1936cdf8ac" and "c4f18766cbbbd0fe46ffd10cf21cba60ae8aebbf" have entirely different histories.
3606f38890
...
c4f18766cb
7
main.go
7
main.go
@ -4,7 +4,6 @@ import (
|
||||
"bufio"
|
||||
"database/sql"
|
||||
"encoding/csv"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
@ -75,10 +74,6 @@ var app = &cli.App{
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
if len(strings.Split(c.String("table"), ".")) != 2 {
|
||||
return errors.New("table name must be in schema.name format")
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
db, err = sql.Open("sqlserver", fmt.Sprintf("sqlserver://%s?database=%s", c.String("server"), c.String("database")))
|
||||
@ -140,7 +135,7 @@ func processReader(c *cli.Context, r io.Reader) error {
|
||||
reader.TrimLeadingSpace = false
|
||||
reader.FieldsPerRecord = len(c.String("fields"))
|
||||
|
||||
if runes := []rune(c.String("comma")); len(runes) > 0 && runes[0] == 't' {
|
||||
if []rune(c.String("comma"))[0] == 't' {
|
||||
reader.Comma = '\t'
|
||||
} else {
|
||||
reader.Comma = []rune(c.String("comma"))[0]
|
||||
|
Loading…
x
Reference in New Issue
Block a user