Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 00b00a000c106ff4d1df6ddd6dcab32b519b8b49 @weigj committed Jan 18, 2011
Showing with 826 additions and 0 deletions.
  1. +24 −0 LICENSE
  2. +23 −0 Makefile
  3. +25 −0 README
  4. +5 −0 doc.go
  5. +721 −0 odbc.go
  6. +28 −0 util.go
24 LICENSE
@@ -0,0 +1,24 @@
+Copyright 2011 Wei guangjing. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,23 @@
+include $(GOROOT)/src/Make.inc
+
+TARG=odbc
+CGOFILES=\
+ odbc.go\
+
+GOFILES=\
+ util.go\
+
+ifeq ($(GOOS), windows)
+CGO_LDFLAGS=-lodbc32
+else
+CGO_LDFLAGS=-lodbc
+endif
+
+CLEANFILES+=
+CGO_OFILES+=
+
+include $(GOROOT)/src/Make.pkg
+
+%: install %.go util.o
+ $(GC) $*.go
+ $(LD) -o $@ $*.$O
25 README
@@ -0,0 +1,25 @@
+ODBC database driver for Go
+
+install:
+ make install
+ (note: windows need apply CL 3733046 <http://codereview.appspot.com/3733046/> for new cgo windows port.)
+
+simple usage:
+
+package main
+
+import (
+ "odbc"
+)
+
+func main() {
+ conn, _ := odbc.Connect("DSN=dsn;UID=user;PWD=password")
+ stmt, _ := conn.Prepare("select * from user where username = ?")
+ stmt.Execute("admin")
+ rows, _ := stmt.FetchAll()
+ for i, row := range rows {
+ println(i, row)
+ }
+ stmt.Close()
+ conn.Close()
+}
5 doc.go
@@ -0,0 +1,5 @@
+// Copyright (c) 2011, Wei guangjing <vcc.163@gmail.com>. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package odbc
Oops, something went wrong.

0 comments on commit 00b00a0

Please sign in to comment.