test
This commit is contained in:
parent
3b110ad247
commit
ce150266bc
2
obj.go
2
obj.go
@ -86,6 +86,7 @@ func loadObjType() error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func loadObjSubType() error {
|
func loadObjSubType() error {
|
||||||
var obj []ObjSubType
|
var obj []ObjSubType
|
||||||
|
|
||||||
@ -124,6 +125,7 @@ func loadObjSubType() error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
func codeObjTypeId(intlId string) (int64, error) {
|
func codeObjTypeId(intlId string) (int64, error) {
|
||||||
var objTypeId int64
|
var objTypeId int64
|
||||||
|
|
||||||
|
23
sql.go
23
sql.go
@ -49,7 +49,7 @@ func initDB() {
|
|||||||
log.Println("initDB : Database cleaned up")
|
log.Println("initDB : Database cleaned up")
|
||||||
|
|
||||||
_, err = db.Exec(`CREATE TABLE code_obj_type (
|
_, err = db.Exec(`CREATE TABLE code_obj_type (
|
||||||
id SMALLINT UNSIGNED NOT NULL
|
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT
|
||||||
,intl_id VARCHAR(32) NOT NULL
|
,intl_id VARCHAR(32) NOT NULL
|
||||||
,name VARCHAR(80) NOT NULL
|
,name VARCHAR(80) NOT NULL
|
||||||
,PRIMARY KEY (id)
|
,PRIMARY KEY (id)
|
||||||
@ -59,7 +59,7 @@ func initDB() {
|
|||||||
log.Println("initDB : code_obj_type created ...")
|
log.Println("initDB : code_obj_type created ...")
|
||||||
|
|
||||||
_, err = db.Exec(`CREATE TABLE code_obj_sub_type (
|
_, err = db.Exec(`CREATE TABLE code_obj_sub_type (
|
||||||
id SMALLINT UNSIGNED NOT NULL
|
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT
|
||||||
,intl_id VARCHAR(32) NOT NULL
|
,intl_id VARCHAR(32) NOT NULL
|
||||||
,name VARCHAR(80) NOT NULL
|
,name VARCHAR(80) NOT NULL
|
||||||
,obj_type_id SMALLINT UNSIGNED NOT NULL
|
,obj_type_id SMALLINT UNSIGNED NOT NULL
|
||||||
@ -636,6 +636,25 @@ func insertObjType(intlId string, name string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
func insertObjSubType(intlId string, name string, objType string) error {
|
||||||
|
stmt, err := db.Prepare(`INSERT INTO code_obj_sub_type
|
||||||
|
SELECT (intl_id, name, obj_type_id)
|
||||||
|
VALUES (?, ?, ?);`)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer stmt.Close()
|
||||||
|
|
||||||
|
_, err = stmt.Exec(intlId, name)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func insertMsgItem(objId int64, itemId int64, quantity int64) error {
|
func insertMsgItem(objId int64, itemId int64, quantity int64) error {
|
||||||
stmt, err := db.Prepare(`INSERT INTO obj_msg_item (obj_id, item_id, quantity)
|
stmt, err := db.Prepare(`INSERT INTO obj_msg_item (obj_id, item_id, quantity)
|
||||||
VALUES (?, ?, ?);`)
|
VALUES (?, ?, ?);`)
|
||||||
|
Loading…
Reference in New Issue
Block a user