Skip to content

Commit 56180ca

Browse files
committed
Refresh repository and setup git sync
Bring code and other files inline with those on desktop computer - as git repository was originally created as individual file uploads. Switched to use local repository and mange changes via syncing going forward using git.
1 parent 360f4b4 commit 56180ca

File tree

10 files changed

+2035
-3
lines changed

10 files changed

+2035
-3
lines changed

License.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2014, Simon Rowe <[email protected]>. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are met:
5+
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of the Simon Rowe <[email protected]> nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL Simon Rowe <[email protected]> BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ MAC32=GOOS=darwin GOARCH=386
2121
# To build Mac OS X 64 bit version:
2222
MAC64=GOOS=darwin GOARCH=amd64
2323

24+
LIBFLAGS=
25+
#-DWIN32_LEAN_AND_MEAN -DUSE_MINGW_ANSI_STDIO=1
26+
# -DWIN32_LEAN_AND_MEAN=1
27+
# -DUSE_MINGW_ANSI_STDIO=1
28+
# -lsqlite3 - include sqlite3 library
29+
#
2430
$(OUTNAME): $(SRC)
2531
$(LIN64) $(CC) $(CFLAGS) -o $(OUTNAME) $(SRC)
2632

@@ -45,4 +51,4 @@ mac64: $(SRC)
4551
clean:
4652
rm $(OUTNAME).exe $(OUTNAME)-x64.exe $(OUTNAME)-x386.exe $(OUTNAME) $(OUTNAME)-x386 $(OUTNAME)-macx64 $(OUTNAME)-mac386
4753

48-
all: lin64 win32 win64 mac64
54+
all: lin64 win32 win64 mac64

Test.csv

Lines changed: 1000 additions & 0 deletions
Large diffs are not rendered by default.

Test2.csv

Lines changed: 1000 additions & 0 deletions
Large diffs are not rendered by default.

csv2sql

2.16 MB
Binary file not shown.

csv2sql-macx64

2.14 MB
Binary file not shown.

csv2sql-x386.exe

1.86 MB
Binary file not shown.

csv2sql-x64.exe

2.29 MB
Binary file not shown.

csv2sql.exe

2.27 MB
Binary file not shown.

csv2sql.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ func main() {
165165
//-------------------------------------------------------------------------
166166
// open and prepare the CSV input file
167167
//-------------------------------------------------------------------------
168+
// TODO: manage multiple input files (ie csv2sql -f * -t testtable[1..x]) ??
168169
if debugSwitch {
169170
fmt.Println("Opening the CSV file:", csvFileName)
170171
}
@@ -325,7 +326,7 @@ func main() {
325326
}
326327
fmt.Println("\nDONE\n\tCSV file processing complete, and the new SQL file format was written to: ", sqlOutFile)
327328
// finished the SQl file data writing - flush any IO buffers
328-
// NB above required as the data was being lost otherwise - maybe a bug in go version 1.2 only?
329+
// NB below flush required as the data was being lost otherwise - maybe a bug in go version 1.2 only?
329330
sqlFileBuffer.Flush()
330331
// reset the string buffer - so it is empty as it is no longer needed
331332
strbuffer.Reset()
@@ -342,6 +343,8 @@ func main() {
342343
// Function is used to clean up the CSV file header fields as they will be used for column table names
343344
// in our SQLIte database. Therefore we don't want any odd characters for our table column names
344345
//
346+
// TODO: consider using: strings.NewReplacer function instead?
347+
//
345348
func cleanHeader(headField string) string {
346349
// ok - remove any spaces and replace with _
347350
headField = strings.Replace(headField, " ", "_", -1)
@@ -369,4 +372,3 @@ func cleanHeader(headField string) string {
369372
headField = strings.Replace(headField, "'", "_", -1)
370373
return headField
371374
}
372-

0 commit comments

Comments
 (0)