Skip to content

Commit 00b00a0

Browse files
committed
first commit
0 parents  commit 00b00a0

File tree

6 files changed

+826
-0
lines changed

6 files changed

+826
-0
lines changed

LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright 2011 Wei guangjing. 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
5+
are met:
6+
7+
1. Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer
12+
in the documentation and/or other materials provided with the
13+
distribution.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
include $(GOROOT)/src/Make.inc
2+
3+
TARG=odbc
4+
CGOFILES=\
5+
odbc.go\
6+
7+
GOFILES=\
8+
util.go\
9+
10+
ifeq ($(GOOS), windows)
11+
CGO_LDFLAGS=-lodbc32
12+
else
13+
CGO_LDFLAGS=-lodbc
14+
endif
15+
16+
CLEANFILES+=
17+
CGO_OFILES+=
18+
19+
include $(GOROOT)/src/Make.pkg
20+
21+
%: install %.go util.o
22+
$(GC) $*.go
23+
$(LD) -o $@ $*.$O

README

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ODBC database driver for Go
2+
3+
install:
4+
make install
5+
(note: windows need apply CL 3733046 <http://codereview.appspot.com/3733046/> for new cgo windows port.)
6+
7+
simple usage:
8+
9+
package main
10+
11+
import (
12+
"odbc"
13+
)
14+
15+
func main() {
16+
conn, _ := odbc.Connect("DSN=dsn;UID=user;PWD=password")
17+
stmt, _ := conn.Prepare("select * from user where username = ?")
18+
stmt.Execute("admin")
19+
rows, _ := stmt.FetchAll()
20+
for i, row := range rows {
21+
println(i, row)
22+
}
23+
stmt.Close()
24+
conn.Close()
25+
}

doc.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright (c) 2011, Wei guangjing <[email protected]>. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package odbc

0 commit comments

Comments
 (0)