-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.go
50 lines (45 loc) · 1.26 KB
/
example.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"github.com/asccclass/sherrydb/mysql"
"fmt"
"os"
)
var dbconnect SherryDB.DBConnect
func main() {
// check DB Information
dbconnect.DBMS = os.Getenv("DBMS")
dbconnect.DbServer = os.Getenv("DBSERVER")
dbconnect.DbPort = os.Getenv("DBPORT")
dbconnect.DbName = os.Getenv("DBNAME")
dbconnect.DbLogin = os.Getenv("DBLOGIN")
dbconnect.DbPasswd = os.Getenv("DBPASSWORD")
dbconnect.DBMS = os.Getenv("DBMS")
dbconnect.DbServer = "192.168.12.223"
dbconnect.DbPort = "3306"
dbconnect.DbName = "learnpoints"
dbconnect.DbLogin = "ascal"
dbconnect.DbPasswd = "webteam@2018"
conn, err := SherryDB.NewSherryDB(dbconnect)
if err != nil {
fmt.Printf("%v", err)
return
}
var sysid string = ""
var course string = "(201919)資通安全管理法及維護計畫簡介說明會(第二場)"
var y int = 2019
if !conn.RowExists("select * from excela where Sysid=? and Year=? and CourseTitle=?", sysid, y, course) {
fmt.Println("No data.")
}
_, err = conn.DoreFetchHash("select * from excela")
if err != nil {
fmt.Printf("%v", err)
return
}
// fmt.Printf("%v\n", orgs)
/*
for _, d := range orgs {
fmt.Printf("%v\n", string(d))
}
*/
conn.Disconnect()
}