初次提交
This commit is contained in:
parent
0a970a949a
commit
90657d45d2
|
|
@ -0,0 +1 @@
|
||||||
|
/logs/*.log
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package ModulePath
|
||||||
|
|
||||||
|
import (
|
||||||
|
// "errors"
|
||||||
|
// "fmt"
|
||||||
|
"os"
|
||||||
|
// "os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
// "strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetModuleCurrentPath() (string, error) {
|
||||||
|
|
||||||
|
file, err := os.Executable()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
exPath := filepath.Dir(file)
|
||||||
|
return exPath, nil
|
||||||
|
|
||||||
|
/*file, err := exec.LookPath(os.Args[0])
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("lookpath err:", err.Error())
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
path, err := filepath.Abs(file)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
i := strings.LastIndex(path, "/")
|
||||||
|
if i < 0 {
|
||||||
|
i = strings.LastIndex(path, "\\")
|
||||||
|
}
|
||||||
|
if i < 0 {
|
||||||
|
return "", errors.New(`error: Can't find "/" or "\".`)
|
||||||
|
}
|
||||||
|
return string(path[0 : i+1]), nil*/
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
server = 119.3.242.17
|
||||||
|
port = 1433
|
||||||
|
user = sa
|
||||||
|
password = lh123456?
|
||||||
|
database = pp
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
type sp_2 struct {
|
||||||
|
ID int `json:"id"` //序号
|
||||||
|
|
||||||
|
Contract_id string `json:"contract_id"` //合同号
|
||||||
|
|
||||||
|
Supplier string `json:"supplier"` //供应商
|
||||||
|
Contract_name string `json:"contract_name"` //合同名称
|
||||||
|
|
||||||
|
Rdm string `json:"rdm"`
|
||||||
|
State string `json:"state"` //审批状态
|
||||||
|
|
||||||
|
Amount string `json:"amount"` //合同金额
|
||||||
|
Amount_1 string `json:"amount_1"` //审批金额
|
||||||
|
|
||||||
|
Warehouse_entry_number string `json:"warehouse_entry_number"`
|
||||||
|
Buyer string `json:"buyer"` //采购人员
|
||||||
|
|
||||||
|
State_1 string `json:"state_1"` //付款审批状态
|
||||||
|
Task_ids string `json:"task_ids"` //审批的任务id
|
||||||
|
|
||||||
|
If_modify bool `json:"if_modify"` //记录是否可修改
|
||||||
|
}
|
||||||
|
|
||||||
|
type sp_1 struct {
|
||||||
|
ID int `json:"id"` //序号
|
||||||
|
|
||||||
|
Contract_id string `json:"contract_id"` //合同号
|
||||||
|
|
||||||
|
Supplier string `json:"supplier"`
|
||||||
|
Applicant string `json:"applicant"` //申请人
|
||||||
|
Time string `json:"time"`
|
||||||
|
Contract_name string `json:"contract_name"` //合同名称
|
||||||
|
Contract_name_ex string `json:"contract_name_ex"` //正式合同
|
||||||
|
Rdm string `json:"rdm"`
|
||||||
|
Amount string `json:"amount"` //金额
|
||||||
|
State string `json:"state"` //审批状态
|
||||||
|
|
||||||
|
If_modify bool `json:"if_modify"` //记录是否可修改
|
||||||
|
}
|
||||||
|
|
||||||
|
type pp_plan struct {
|
||||||
|
Pre_id int `json:"pre_id"` //父id
|
||||||
|
ID int `json:"id"` //序号
|
||||||
|
RDM string `json:"rdm"` //rdm
|
||||||
|
Code string `json:"code"` //编号
|
||||||
|
|
||||||
|
Name string `json:"name"` //名称
|
||||||
|
Specs string `json:"specs"` //规格
|
||||||
|
Unit string `json:"unit"` //单位
|
||||||
|
Num string `json:"num"` //数量
|
||||||
|
Price string `json:"price"` //单价
|
||||||
|
|
||||||
|
Total_p string `json:"total_p"` //总计
|
||||||
|
Payment_type string `json:"pt"` //付款方式
|
||||||
|
Paid string `json:"paid"` //已付
|
||||||
|
Residual_p string `json:"rp"` //应付
|
||||||
|
|
||||||
|
Demand_date string `json:"demand_date"` //需求日期
|
||||||
|
Demand_date_update_cnt int `json:"dduc"` //需求日期更改次数
|
||||||
|
Purchasing_cycle string `json:"purchasing_cycle"` //采购周期
|
||||||
|
Order_date string `json:"order_date"` //下单日期
|
||||||
|
|
||||||
|
Over_due1 string `json:"over_due1"` //预计超期
|
||||||
|
Actual_delivery_date string `json:"add"` //实际交付日期
|
||||||
|
Residue string `json:"residue"` //剩余
|
||||||
|
Over_due2 string `json:"over_due2"` //超期
|
||||||
|
|
||||||
|
Buy_record string `json:"buy_record"` //采购记录
|
||||||
|
Arrival_quantity string `json:"aq"` //到货数量
|
||||||
|
Arrival_quantity_text string `json:"aqt"` //到货数量
|
||||||
|
|
||||||
|
State string `json:"state"` //状态
|
||||||
|
Warehouse_entry_number string `json:"wen"` //入库单号
|
||||||
|
Supplier string `json:"supplier"` //供应方
|
||||||
|
|
||||||
|
//Is_main int `json:"is_main"` //1-主任务 2-子
|
||||||
|
Flag string `json:"flag"`
|
||||||
|
//Has_child int `json:"has_child"` //是否有子任务
|
||||||
|
Child_task_id []int `json:"cti"` //子任务id
|
||||||
|
|
||||||
|
Factory string `json:"factory"` //生产厂家
|
||||||
|
Factory_code string `json:"factory_code"` //厂家编号
|
||||||
|
Qs string `json:"qs"` //质量标准
|
||||||
|
As string `json:"as"` //验收标准
|
||||||
|
|
||||||
|
Buyer string `json:"buyer"` //采购人员
|
||||||
|
|
||||||
|
If_modify bool `json:"if_modify"` //记录是否可修改
|
||||||
|
|
||||||
|
Contract_id string `json:"contract_id"` //合同号
|
||||||
|
Contract_state string `json:"contract_state"` //合同审批状态
|
||||||
|
Contract_amount string `json:"contract_amount"` //合同金额
|
||||||
|
|
||||||
|
State_1 string `json:"state_1"` //付款审批状态
|
||||||
|
|
||||||
|
Serial_num string `json:"serial_num"` //流水号
|
||||||
|
Contract_name string `json:"contract_name"` //合同名称
|
||||||
|
Pay_Contract_name string `json:"pay_contract_name"` //付款合同
|
||||||
|
|
||||||
|
Pay_Amount string `json:"pay_amount"` //付款金额
|
||||||
|
Batch_No string `json:"batch_no"` //批次号
|
||||||
|
Remark string `json:"remark"` //备注
|
||||||
|
}
|
||||||
|
|
||||||
|
type ma_plan struct {
|
||||||
|
ID int `json:"id"` //序号
|
||||||
|
Dispath_date string `json:"dispath_date"` //任务分配日期
|
||||||
|
Header string `json:"header"` //负责人
|
||||||
|
|
||||||
|
R_id_1 string `json:"r_id_1"` //需求R号
|
||||||
|
R_id_2 string `json:"r_id_2"` //申购R号
|
||||||
|
|
||||||
|
Material_id string `json:"m_id"`
|
||||||
|
Material_name string `json:"m_name"`
|
||||||
|
Material_describe string `json:"md"`
|
||||||
|
|
||||||
|
Unit string `json:"unit"` //单位
|
||||||
|
|
||||||
|
Number string `json:"num"` //数量
|
||||||
|
|
||||||
|
Unit_price string `json:"unit_price"` //单价
|
||||||
|
|
||||||
|
Amount_money string `json:"amount_money"` //金额
|
||||||
|
|
||||||
|
Tax_code string `json:"tax_code"` //税码
|
||||||
|
|
||||||
|
Supplier string `json:"supplier"` //供应方
|
||||||
|
|
||||||
|
Cycle string `json:"cycle"` //周期
|
||||||
|
|
||||||
|
Quality_standard string `json:"qs"` //质量标准
|
||||||
|
Acceptance_criteria string `json:"ac"` //验收标准
|
||||||
|
|
||||||
|
Information string `json:"information"` //随货资料
|
||||||
|
|
||||||
|
Purpose string `json:"purpose"` //用途
|
||||||
|
|
||||||
|
Order_r_id string `json:"order_r_id"` //订单号R号
|
||||||
|
Procure_id string `json:"procure_id"` //采购合同/订单号
|
||||||
|
Sap_id string `json:"sap_id"` //sap订单号
|
||||||
|
|
||||||
|
Production_date string `json:"Production_date"` //投产日期
|
||||||
|
Due_date string `json:"due_date"` //订单到期日期
|
||||||
|
|
||||||
|
Arrival_quantity string `json:"aq"` //到货数量
|
||||||
|
Undelivered_quantity string `json:"uq"` //未到货数量
|
||||||
|
|
||||||
|
SAP_Warehouse_entry_number string `json:"swen"` //SAP入库单号
|
||||||
|
SAP_Warehouse_entry_date string `json:"swed"` //SAP入库日期
|
||||||
|
|
||||||
|
Over_due string `json:"over_due"` //订单是否超期
|
||||||
|
|
||||||
|
Note string `json:"note"` //备注
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,350 @@
|
||||||
|
2024/08/27 08:03:24.996 [I] [server.go:2136] getMenu recv req begin 2024-08-27 08:03:24
|
||||||
|
2024/08/27 08:03:24.996 [I] [server.go:2136] get_prj recv req begin 2024-08-27 08:03:24
|
||||||
|
2024/08/27 08:03:24.996 [I] [server.go:2136] getMenu recv req end, use time: 0 ms
|
||||||
|
2024/08/27 08:03:24.996 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"afcf17b7-b7d0-4a7b-bcc8-fed67cc0504f","index":1,"count":50,"if_do":true}
|
||||||
|
2024/08/27 08:03:24.996 [I] [server.go:2136] {李俊杉 afcf17b7-b7d0-4a7b-bcc8-fed67cc0504f 1 50 true}
|
||||||
|
2024/08/27 08:03:24.996 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 08:03:24.996 [I] [server.go:2136] select count(ID) from [project_info] where [flag] = '1'
|
||||||
|
2024/08/27 08:03:24.997 [I] [server.go:2136] get_prj recv req begin 2024-08-27 08:03:24
|
||||||
|
2024/08/27 08:03:24.998 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"afcf17b7-b7d0-4a7b-bcc8-fed67cc0504f","index":1,"count":50}
|
||||||
|
2024/08/27 08:03:24.998 [I] [server.go:2136] {李俊杉 afcf17b7-b7d0-4a7b-bcc8-fed67cc0504f 1 50 false}
|
||||||
|
2024/08/27 08:03:24.998 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 08:03:24.999 [I] [server.go:2136] select count(ID) from [project_info] where [flag] != '1'
|
||||||
|
2024/08/27 08:03:25.001 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] = '1' order by ID desc) and [flag] = '1' order by [ID] desc
|
||||||
|
2024/08/27 08:03:25.001 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] != '1' order by ID desc) and [flag] != '1' order by [ID] desc
|
||||||
|
2024/08/27 08:03:25.006 [I] [server.go:2136] get_prj recv req end, use time: 9 ms
|
||||||
|
2024/08/27 08:03:25.007 [I] [server.go:2136] get_prj recv req end, use time: 9 ms
|
||||||
|
2024/08/27 10:13:46.191 [I] [server.go:2136] get_task recv req begin 2024-08-27 10:13:46
|
||||||
|
2024/08/27 10:13:46.191 [I] [server.go:2136] get_prj_by_id recv req begin 2024-08-27 10:13:46
|
||||||
|
2024/08/27 10:13:46.191 [I] [server.go:2136] {"opuser":"李娜","opuser_uuid":"8ea0c901-7ea7-4e66-b3cb-615a0d940121","prj_id":42}
|
||||||
|
2024/08/27 10:13:46.191 [I] [server.go:2136] query_cnt: 0
|
||||||
|
2024/08/27 10:13:46.191 [I] [server.go:2136] select [ID],[data] from [task] where [prj_id] = 42 and [pre_id]=0 order by [ID] asc
|
||||||
|
2024/08/27 10:13:46.211 [I] [server.go:2136] get_task recv req end, use time: 20 ms
|
||||||
|
2024/08/27 10:13:46.216 [I] [server.go:2136] get_prj_by_id recv req end, use time: 25 ms
|
||||||
|
2024/08/27 10:13:46.232 [I] [server.go:2136] get_ms_data recv req begin 2024-08-27 10:13:46
|
||||||
|
2024/08/27 10:13:46.232 [I] [server.go:2136] select [ID],[data] from [task] where [prj_id] = 42 and [if_milestone]='1' order by [ID] desc
|
||||||
|
2024/08/27 10:13:46.234 [I] [server.go:2136] get_ms_data recv req end, use time: 1 ms
|
||||||
|
2024/08/27 10:13:54.180 [I] [server.go:2136] get_task1_by_task_id recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.180 [I] [server.go:2136] {"opuser":"李娜","opuser_uuid":"8ea0c901-7ea7-4e66-b3cb-615a0d940121","index":1,"count":50,"task_id":13}
|
||||||
|
2024/08/27 10:13:54.180 [I] [server.go:2136] select [ID],[data],[data_ex] from [task] where [ID] = 13 order by [ID] asc
|
||||||
|
2024/08/27 10:13:54.182 [I] [server.go:2136] get_task1_by_task_id recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.182 [I] [main.go:4291] select [data] FROM [task] where ID=13
|
||||||
|
2024/08/27 10:13:54.182 [I] [server.go:2136] get_comment recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.182 [I] [main.go:1413] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
,[note],[file_data]
|
||||||
|
FROM [task_comment] where task_id=13 order by [time] desc
|
||||||
|
2024/08/27 10:13:54.195 [I] [server.go:2136] get_task1_by_task_id recv req end, use time: 15 ms
|
||||||
|
2024/08/27 10:13:54.196 [I] [server.go:2136] get_comment recv req end, use time: 13 ms
|
||||||
|
2024/08/27 10:13:54.196 [I] [server.go:2136] get_task1_by_task_id recv req end, use time: 13 ms
|
||||||
|
2024/08/27 10:13:54.200 [I] [server.go:2136] get_task1_by_task_id recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.200 [I] [main.go:4331] select [data] FROM [task] where ID=13
|
||||||
|
2024/08/27 10:13:54.201 [I] [server.go:2136] get_task recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.201 [I] [server.go:2136] {"opuser":"李娜","opuser_uuid":"8ea0c901-7ea7-4e66-b3cb-615a0d940121","prj_id":42,"task_id":13,"index":1,"count":10000}
|
||||||
|
2024/08/27 10:13:54.201 [I] [server.go:2136] query_cnt: 10000
|
||||||
|
2024/08/27 10:13:54.201 [I] [server.go:2136] select [ID],[data] from [task] where [prj_id] = 42 and [pre_id]=0 and [ID]!=13 order by [ID] asc
|
||||||
|
2024/08/27 10:13:54.202 [I] [server.go:2136] get_task1_by_task_id recv req end, use time: 2 ms
|
||||||
|
2024/08/27 10:13:54.203 [I] [server.go:2136] get_task recv req end, use time: 2 ms
|
||||||
|
2024/08/27 10:13:54.210 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.210 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.210 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=2 order by [time] desc
|
||||||
|
2024/08/27 10:13:54.210 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=1 order by [time] desc
|
||||||
|
2024/08/27 10:13:54.210 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.210 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=3 order by [time] desc
|
||||||
|
2024/08/27 10:13:54.213 [E] [main.go:965] get_task_files_info err:{42S22}
|
||||||
|
SQL Stmt: SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=2 order by [time] desc
|
||||||
|
Bind Values:
|
||||||
|
[Microsoft][ODBC SQL Server Driver][SQL Server]列名 'num' 无效。
|
||||||
|
2024/08/27 10:13:54.213 [I] [server.go:2136] get_task_files recv req end, use time: 3 ms
|
||||||
|
2024/08/27 10:13:54.213 [E] [main.go:965] get_task_files_info err:{42S22}
|
||||||
|
SQL Stmt: SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=1 order by [time] desc
|
||||||
|
Bind Values:
|
||||||
|
[Microsoft][ODBC SQL Server Driver][SQL Server]列名 'num' 无效。
|
||||||
|
2024/08/27 10:13:54.213 [I] [server.go:2136] get_task_files recv req end, use time: 3 ms
|
||||||
|
2024/08/27 10:13:54.213 [E] [main.go:965] get_task_files_info err:{42S22}
|
||||||
|
SQL Stmt: SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=3 order by [time] desc
|
||||||
|
Bind Values:
|
||||||
|
[Microsoft][ODBC SQL Server Driver][SQL Server]列名 'num' 无效。
|
||||||
|
2024/08/27 10:13:54.213 [I] [server.go:2136] get_task_files recv req end, use time: 3 ms
|
||||||
|
2024/08/27 10:13:54.219 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.219 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=6 order by [time] desc
|
||||||
|
2024/08/27 10:13:54.220 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.220 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=4 order by [time] desc
|
||||||
|
2024/08/27 10:13:54.220 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.220 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=5 order by [time] desc
|
||||||
|
2024/08/27 10:13:54.221 [E] [main.go:965] get_task_files_info err:{42S22}
|
||||||
|
SQL Stmt: SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=5 order by [time] desc
|
||||||
|
Bind Values:
|
||||||
|
[Microsoft][ODBC SQL Server Driver][SQL Server]列名 'num' 无效。
|
||||||
|
2024/08/27 10:13:54.221 [I] [server.go:2136] get_task_files recv req end, use time: 0 ms
|
||||||
|
2024/08/27 10:13:54.221 [E] [main.go:965] get_task_files_info err:{42S22}
|
||||||
|
SQL Stmt: SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=6 order by [time] desc
|
||||||
|
Bind Values:
|
||||||
|
[Microsoft][ODBC SQL Server Driver][SQL Server]列名 'num' 无效。
|
||||||
|
2024/08/27 10:13:54.221 [I] [server.go:2136] get_task_files recv req end, use time: 1 ms
|
||||||
|
2024/08/27 10:13:54.222 [E] [main.go:965] get_task_files_info err:{42S22}
|
||||||
|
SQL Stmt: SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=4 order by [time] desc
|
||||||
|
Bind Values:
|
||||||
|
[Microsoft][ODBC SQL Server Driver][SQL Server]列名 'num' 无效。
|
||||||
|
2024/08/27 10:13:54.222 [I] [server.go:2136] get_task_files recv req end, use time: 1 ms
|
||||||
|
2024/08/27 10:13:54.223 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.223 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=7 order by [time] desc
|
||||||
|
2024/08/27 10:13:54.225 [E] [main.go:965] get_task_files_info err:{42S22}
|
||||||
|
SQL Stmt: SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=13 and num=7 order by [time] desc
|
||||||
|
Bind Values:
|
||||||
|
[Microsoft][ODBC SQL Server Driver][SQL Server]列名 'num' 无效。
|
||||||
|
2024/08/27 10:13:54.225 [I] [server.go:2136] get_task_files recv req end, use time: 2 ms
|
||||||
|
2024/08/27 10:13:54.229 [I] [server.go:2136] get_task_aw_by_name recv req begin 2024-08-27 10:13:54
|
||||||
|
2024/08/27 10:13:54.229 [I] [main.go:4049] select [data] FROM [task] where ID=13
|
||||||
|
2024/08/27 10:13:54.231 [I] [server.go:2136] get_task_aw_by_name recv req end, use time: 1 ms
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] get_prj recv req begin 2024-08-27 10:14:29
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] {"opuser":"李娜","opuser_uuid":"8ea0c901-7ea7-4e66-b3cb-615a0d940121","index":1,"count":50}
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] {李娜 8ea0c901-7ea7-4e66-b3cb-615a0d940121 1 50 false}
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] select count(ID) from [project_info] where [flag] != '1'
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] get_prj recv req begin 2024-08-27 10:14:29
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] {"opuser":"李娜","opuser_uuid":"8ea0c901-7ea7-4e66-b3cb-615a0d940121","index":1,"count":50,"if_do":true}
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] {李娜 8ea0c901-7ea7-4e66-b3cb-615a0d940121 1 50 true}
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 10:14:29.264 [I] [server.go:2136] select count(ID) from [project_info] where [flag] = '1'
|
||||||
|
2024/08/27 10:14:29.267 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] != '1' order by ID desc) and [flag] != '1' order by [ID] desc
|
||||||
|
2024/08/27 10:14:29.267 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] = '1' order by ID desc) and [flag] = '1' order by [ID] desc
|
||||||
|
2024/08/27 10:14:29.273 [I] [server.go:2136] get_prj recv req end, use time: 8 ms
|
||||||
|
2024/08/27 10:14:29.273 [I] [server.go:2136] get_prj recv req end, use time: 9 ms
|
||||||
|
2024/08/27 13:20:44.343 [I] [main.go:377] connect success!
|
||||||
|
2024/08/27 13:21:13.452 [I] [server.go:2136] get_prj recv req begin 2024-08-27 13:21:13
|
||||||
|
2024/08/27 13:21:13.452 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","index":1,"count":50}
|
||||||
|
2024/08/27 13:21:13.452 [I] [server.go:2136] {李俊杉 8249ef9d-c8b4-429b-9ea4-bcebdecd000f 1 50 false}
|
||||||
|
2024/08/27 13:21:13.452 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 13:21:13.452 [I] [server.go:2136] select count(ID) from [project_info] where [flag] != '1'
|
||||||
|
2024/08/27 13:21:13.452 [I] [server.go:2136] getMenu recv req begin 2024-08-27 13:21:13
|
||||||
|
2024/08/27 13:21:13.452 [I] [server.go:2136] getMenu recv req end, use time: 0 ms
|
||||||
|
2024/08/27 13:21:13.454 [I] [server.go:2136] get_prj recv req begin 2024-08-27 13:21:13
|
||||||
|
2024/08/27 13:21:13.454 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","index":1,"count":50,"if_do":true}
|
||||||
|
2024/08/27 13:21:13.454 [I] [server.go:2136] {李俊杉 8249ef9d-c8b4-429b-9ea4-bcebdecd000f 1 50 true}
|
||||||
|
2024/08/27 13:21:13.454 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 13:21:13.454 [I] [server.go:2136] select count(ID) from [project_info] where [flag] = '1'
|
||||||
|
2024/08/27 13:21:13.456 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] != '1' order by ID desc) and [flag] != '1' order by [ID] desc
|
||||||
|
2024/08/27 13:21:13.460 [I] [server.go:2136] get_prj recv req end, use time: 7 ms
|
||||||
|
2024/08/27 13:21:13.499 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] = '1' order by ID desc) and [flag] = '1' order by [ID] desc
|
||||||
|
2024/08/27 13:21:13.504 [I] [server.go:2136] get_prj recv req end, use time: 50 ms
|
||||||
|
2024/08/27 13:21:18.019 [I] [server.go:2136] get_ms_data recv req begin 2024-08-27 13:21:18
|
||||||
|
2024/08/27 13:21:18.019 [I] [server.go:2136] select [ID],[data] from [task] where [prj_id] = 42 and [if_milestone]='1' order by [ID] desc
|
||||||
|
2024/08/27 13:21:18.020 [I] [server.go:2136] get_task recv req begin 2024-08-27 13:21:18
|
||||||
|
2024/08/27 13:21:18.020 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","prj_id":42}
|
||||||
|
2024/08/27 13:21:18.020 [I] [server.go:2136] query_cnt: 0
|
||||||
|
2024/08/27 13:21:18.020 [I] [server.go:2136] select [ID],[data] from [task] where [prj_id] = 42 and [pre_id]=0 order by [ID] asc
|
||||||
|
2024/08/27 13:21:18.021 [I] [server.go:2136] get_ms_data recv req end, use time: 1 ms
|
||||||
|
2024/08/27 13:21:18.021 [I] [server.go:2136] get_prj_by_id recv req begin 2024-08-27 13:21:18
|
||||||
|
2024/08/27 13:21:18.022 [I] [server.go:2136] get_prj_by_id recv req end, use time: 0 ms
|
||||||
|
2024/08/27 13:21:18.035 [I] [server.go:2136] get_task recv req end, use time: 15 ms
|
||||||
|
2024/08/27 13:21:23.530 [I] [server.go:2136] get_prj recv req begin 2024-08-27 13:21:23
|
||||||
|
2024/08/27 13:21:23.530 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f"}
|
||||||
|
2024/08/27 13:21:23.530 [I] [server.go:2136] {李俊杉 8249ef9d-c8b4-429b-9ea4-bcebdecd000f 0 0 false}
|
||||||
|
2024/08/27 13:21:23.530 [I] [server.go:2136] query_cnt: 0
|
||||||
|
2024/08/27 13:21:23.530 [I] [server.go:2136] select count(ID) from [project_info] where [flag] != '1'
|
||||||
|
2024/08/27 13:21:23.541 [I] [server.go:2136] get_prj_by_user recv req begin 2024-08-27 13:21:23
|
||||||
|
2024/08/27 13:21:23.541 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","index":1,"count":50}
|
||||||
|
2024/08/27 13:21:23.541 [I] [server.go:2136] {李俊杉 8249ef9d-c8b4-429b-9ea4-bcebdecd000f 1 50 false}
|
||||||
|
2024/08/27 13:21:23.541 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 13:21:23.541 [I] [server.go:2136] select count(ID) from [project_info] where [flag] != '1' and [head] = '李俊杉'
|
||||||
|
2024/08/27 13:21:23.542 [I] [server.go:2136] select top 0 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] != '1' order by ID desc) and [flag] != '1' order by [ID] desc
|
||||||
|
2024/08/27 13:21:23.543 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] != '1' and [head] = '李俊杉' order by ID desc) and [flag] != '1' and [head] = '李俊杉' order by [ID] desc
|
||||||
|
2024/08/27 13:21:23.544 [I] [server.go:2136] get_prj recv req end, use time: 13 ms
|
||||||
|
2024/08/27 13:21:23.546 [I] [server.go:2136] get_prj_by_user recv req end, use time: 5 ms
|
||||||
|
2024/08/27 13:21:24.936 [I] [server.go:2136] get_task_by_performer recv req begin 2024-08-27 13:21:24
|
||||||
|
2024/08/27 13:21:24.936 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","index":1,"count":50,"task_id":"","prj_name":"","task_name":""}
|
||||||
|
2024/08/27 13:21:24.936 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 13:21:24.936 [I] [server.go:2136] select [ID],[data] from [task] where [performer] = '李俊杉' order by [ID] asc
|
||||||
|
2024/08/27 13:21:24.938 [I] [server.go:2136] get_task_by_performer recv req end, use time: 1 ms
|
||||||
|
2024/08/27 13:21:24.962 [I] [server.go:2136] get_task_by_cur_p recv req begin 2024-08-27 13:21:24
|
||||||
|
2024/08/27 13:21:24.963 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","index":1,"count":50,"task_id":"","prj_name":"","task_name":""}
|
||||||
|
2024/08/27 13:21:24.963 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 13:21:24.963 [I] [server.go:2136] select [ID],[data] from [task] where [current_p] = '李俊杉' and [state]='2' order by [ID] asc
|
||||||
|
2024/08/27 13:21:24.964 [I] [server.go:2136] get_task_by_cur_p recv req end, use time: 1 ms
|
||||||
|
2024/08/27 13:21:25.569 [I] [server.go:2136] get_prj_by_user recv req begin 2024-08-27 13:21:25
|
||||||
|
2024/08/27 13:21:25.569 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","index":1,"count":50}
|
||||||
|
2024/08/27 13:21:25.569 [I] [server.go:2136] {李俊杉 8249ef9d-c8b4-429b-9ea4-bcebdecd000f 1 50 false}
|
||||||
|
2024/08/27 13:21:25.569 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 13:21:25.569 [I] [server.go:2136] select count(ID) from [project_info] where [flag] != '1' and [head] = '李俊杉'
|
||||||
|
2024/08/27 13:21:25.569 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] != '1' and [head] = '李俊杉' order by ID desc) and [flag] != '1' and [head] = '李俊杉' order by [ID] desc
|
||||||
|
2024/08/27 13:21:25.570 [I] [server.go:2136] get_prj_by_user recv req end, use time: 0 ms
|
||||||
|
2024/08/27 13:21:30.794 [I] [server.go:2136] get_prj recv req begin 2024-08-27 13:21:30
|
||||||
|
2024/08/27 13:21:30.794 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","index":1,"count":50}
|
||||||
|
2024/08/27 13:21:30.794 [I] [server.go:2136] {李俊杉 8249ef9d-c8b4-429b-9ea4-bcebdecd000f 1 50 false}
|
||||||
|
2024/08/27 13:21:30.794 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 13:21:30.794 [I] [server.go:2136] select count(ID) from [project_info] where [flag] != '1'
|
||||||
|
2024/08/27 13:21:30.800 [I] [server.go:2136] get_prj recv req begin 2024-08-27 13:21:30
|
||||||
|
2024/08/27 13:21:30.800 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","index":1,"count":50,"if_do":true}
|
||||||
|
2024/08/27 13:21:30.800 [I] [server.go:2136] {李俊杉 8249ef9d-c8b4-429b-9ea4-bcebdecd000f 1 50 true}
|
||||||
|
2024/08/27 13:21:30.800 [I] [server.go:2136] query_cnt: 50
|
||||||
|
2024/08/27 13:21:30.800 [I] [server.go:2136] select count(ID) from [project_info] where [flag] = '1'
|
||||||
|
2024/08/27 13:21:30.801 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] != '1' order by ID desc) and [flag] != '1' order by [ID] desc
|
||||||
|
2024/08/27 13:21:30.802 [I] [server.go:2136] select top 50 [ID],[data] from [project_info] where ID not in (select top 0 ID from [project_info] where [flag] = '1' order by ID desc) and [flag] = '1' order by [ID] desc
|
||||||
|
2024/08/27 13:21:30.811 [I] [server.go:2136] get_prj recv req end, use time: 10 ms
|
||||||
|
2024/08/27 13:21:30.812 [I] [server.go:2136] get_prj recv req end, use time: 18 ms
|
||||||
|
2024/08/27 13:21:32.600 [I] [server.go:2136] get_ms_data recv req begin 2024-08-27 13:21:32
|
||||||
|
2024/08/27 13:21:32.600 [I] [server.go:2136] select [ID],[data] from [task] where [prj_id] = 42 and [if_milestone]='1' order by [ID] desc
|
||||||
|
2024/08/27 13:21:32.600 [I] [server.go:2136] get_ms_data recv req end, use time: 0 ms
|
||||||
|
2024/08/27 13:21:32.601 [I] [server.go:2136] get_task recv req begin 2024-08-27 13:21:32
|
||||||
|
2024/08/27 13:21:32.601 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","prj_id":42}
|
||||||
|
2024/08/27 13:21:32.601 [I] [server.go:2136] query_cnt: 0
|
||||||
|
2024/08/27 13:21:32.601 [I] [server.go:2136] select [ID],[data] from [task] where [prj_id] = 42 and [pre_id]=0 order by [ID] asc
|
||||||
|
2024/08/27 13:21:32.602 [I] [server.go:2136] get_prj_by_id recv req begin 2024-08-27 13:21:32
|
||||||
|
2024/08/27 13:21:32.602 [I] [server.go:2136] get_task recv req end, use time: 1 ms
|
||||||
|
2024/08/27 13:21:32.603 [I] [server.go:2136] get_prj_by_id recv req end, use time: 1 ms
|
||||||
|
2024/08/27 13:21:36.564 [I] [server.go:2136] get_task1_by_task_id recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.564 [I] [main.go:4317] select [data] FROM [task] where ID=32
|
||||||
|
2024/08/27 13:21:36.565 [I] [main.go:4320] select [data] FROM [task] where ID=25
|
||||||
|
2024/08/27 13:21:36.565 [I] [server.go:2136] get_task9_by_task_id recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.565 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","index":1,"count":50,"task_id":32}
|
||||||
|
2024/08/27 13:21:36.565 [I] [server.go:2136] select [ID],[data],[data_ex] from [task] where [ID] = 32 order by [ID] asc
|
||||||
|
2024/08/27 13:21:36.566 [I] [server.go:2136] get_task1_by_task_id recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.566 [I] [main.go:4357] select [data] FROM [task] where ID=32
|
||||||
|
2024/08/27 13:21:36.566 [I] [server.go:2136] get_task1_by_task_id recv req end, use time: 1 ms
|
||||||
|
2024/08/27 13:21:36.567 [I] [server.go:2136] get_comment recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.567 [I] [main.go:1413] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
,[note],[file_data]
|
||||||
|
FROM [task_comment] where task_id=32 order by [time] desc
|
||||||
|
2024/08/27 13:21:36.568 [I] [server.go:2136] get_task recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.568 [I] [server.go:2136] {"opuser":"李俊杉","opuser_uuid":"8249ef9d-c8b4-429b-9ea4-bcebdecd000f","prj_id":42,"task_id":32,"index":1,"count":10000}
|
||||||
|
2024/08/27 13:21:36.568 [I] [server.go:2136] query_cnt: 10000
|
||||||
|
2024/08/27 13:21:36.568 [I] [server.go:2136] select [ID],[data] from [task] where [prj_id] = 42 and [pre_id]=0 and [ID]!=32 order by [ID] asc
|
||||||
|
2024/08/27 13:21:36.572 [I] [server.go:2136] get_task recv req end, use time: 3 ms
|
||||||
|
2024/08/27 13:21:36.578 [I] [server.go:2136] get_comment recv req end, use time: 10 ms
|
||||||
|
2024/08/27 13:21:36.578 [I] [server.go:2136] get_task1_by_task_id recv req end, use time: 12 ms
|
||||||
|
2024/08/27 13:21:36.581 [I] [server.go:2136] get_task9_by_task_id recv req end, use time: 16 ms
|
||||||
|
2024/08/27 13:21:36.596 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.596 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=32 and num=1 order by [time] desc
|
||||||
|
2024/08/27 13:21:36.600 [I] [server.go:2136] get_task_files recv req end, use time: 4 ms
|
||||||
|
2024/08/27 13:21:36.613 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.613 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=32 and num=2 order by [time] desc
|
||||||
|
2024/08/27 13:21:36.615 [I] [server.go:2136] get_task_files recv req end, use time: 1 ms
|
||||||
|
2024/08/27 13:21:36.615 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.615 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=32 and num=6 order by [time] desc
|
||||||
|
2024/08/27 13:21:36.616 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.616 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=32 and num=3 order by [time] desc
|
||||||
|
2024/08/27 13:21:36.616 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.616 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=32 and num=4 order by [time] desc
|
||||||
|
2024/08/27 13:21:36.618 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.618 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=32 and num=5 order by [time] desc
|
||||||
|
2024/08/27 13:21:36.619 [I] [server.go:2136] get_task_files recv req end, use time: 3 ms
|
||||||
|
2024/08/27 13:21:36.618 [I] [server.go:2136] get_task_files recv req end, use time: 2 ms
|
||||||
|
2024/08/27 13:21:36.619 [I] [server.go:2136] get_task_files recv req end, use time: 3 ms
|
||||||
|
2024/08/27 13:21:36.620 [I] [server.go:2136] get_task_files recv req end, use time: 1 ms
|
||||||
|
2024/08/27 13:21:36.651 [I] [server.go:2136] get_task_files recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.651 [I] [main.go:965] SELECT [ID]
|
||||||
|
,[task_id]
|
||||||
|
,[file_name]
|
||||||
|
,[time]
|
||||||
|
,[user_name]
|
||||||
|
FROM [task_file] where task_id=32 and num=7 order by [time] desc
|
||||||
|
2024/08/27 13:21:36.653 [I] [server.go:2136] get_task_files recv req end, use time: 1 ms
|
||||||
|
2024/08/27 13:21:36.654 [I] [server.go:2136] get_task_aw_by_name recv req begin 2024-08-27 13:21:36
|
||||||
|
2024/08/27 13:21:36.654 [I] [main.go:4049] select [data] FROM [task] where ID=32
|
||||||
|
2024/08/27 13:21:36.656 [I] [server.go:2136] get_task_aw_by_name recv req end, use time: 2 ms
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
供应商名称,申请人,RDM,金额
|
||||||
|
测试,测试,17200,30000
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
供应商名称,申请人,RDM,金额
|
||||||
|
测试,测试,17200,30000
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
供应商名称,供应商编码,付款方式,六合编号,名称,规格,单位,单价,更新日期,采购周期,报价有效期,生产厂家,厂家编号,质量标准,验收标准
|
||||||
|
阿里,1,1,2-C17200,铍青铜管C17200,YG48×5,kg,335,45292,25,180,,,,
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
FLAG,RDM,编号,数量,需求日期,采购人员,下单日期
|
||||||
|
3,21945755,2-C17200,3,2024/2/28,测试,2024/2/28
|
||||||
|
1,21945755,,,2024/2/28,测试,2024/2/28
|
||||||
|
2,21945755,2-C17200,4,2024/2/28,测试,2024/2/28
|
||||||
|
3,21945755,2-C17200,6,2024/2/28,测试,2024/2/28
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
六合编号
|
||||||
|
LHE7413B
|
||||||
|
2323
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
module pp
|
||||||
|
|
||||||
|
go 1.16
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/LukeMauldin/lodbc v0.0.0-20130219161755-59316a7de9d4
|
||||||
|
github.com/OwnLocal/goes v1.0.0 // indirect
|
||||||
|
github.com/alexbrainman/odbc v0.0.0-20210605012845-39f8520b0d5f // indirect
|
||||||
|
github.com/astaxie/beego v1.12.3
|
||||||
|
github.com/denisenkom/go-mssqldb v0.11.0 // indirect
|
||||||
|
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||||
|
github.com/mattn/go-adodb v0.0.1
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
||||||
|
github.com/satori/go.uuid v1.2.0
|
||||||
|
github.com/shopspring/decimal v1.3.1 // indirect
|
||||||
|
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 // indirect
|
||||||
|
github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373 // indirect
|
||||||
|
github.com/tealeg/xlsx v1.0.5
|
||||||
|
github.com/weigj/go-odbc v0.0.0-20120414035027-f09eefba7e19 // indirect
|
||||||
|
gitlab.com/stone.code/odbc3-go v0.0.0-20140130212748-f9bdfa0350f2 // indirect
|
||||||
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,206 @@
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||||
|
github.com/LukeMauldin/lodbc v0.0.0-20130219161755-59316a7de9d4 h1:MNptLl+J1e/11fmvv5sC47Kc6pJh336HGhEa4ga81IQ=
|
||||||
|
github.com/LukeMauldin/lodbc v0.0.0-20130219161755-59316a7de9d4/go.mod h1:wVRoKWzJl1ZecJg0GW+iCvOyWUHSE87uCCxWaF9WMzw=
|
||||||
|
github.com/OwnLocal/goes v1.0.0/go.mod h1:8rIFjBGTue3lCU0wplczcUgt9Gxgrkkrw7etMIcn8TM=
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/alexbrainman/odbc v0.0.0-20210605012845-39f8520b0d5f h1:qJp6jWdG+PBNCDtIwRpspahMaZ3hlfde/25ExBORKso=
|
||||||
|
github.com/alexbrainman/odbc v0.0.0-20210605012845-39f8520b0d5f/go.mod h1:c5eyz5amZqTKvY3ipqerFO/74a/8CYmXOahSr40c+Ww=
|
||||||
|
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
||||||
|
github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
|
||||||
|
github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ=
|
||||||
|
github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA=
|
||||||
|
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
|
||||||
|
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||||
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
|
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
|
||||||
|
github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
|
||||||
|
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
||||||
|
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||||
|
github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
|
||||||
|
github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
|
||||||
|
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
||||||
|
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/denisenkom/go-mssqldb v0.11.0 h1:9rHa233rhdOyrz2GcP9NM+gi2psgJZ4GWDpL/7ND8HI=
|
||||||
|
github.com/denisenkom/go-mssqldb v0.11.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
||||||
|
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||||
|
github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
|
||||||
|
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
|
||||||
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
|
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
|
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||||
|
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
|
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||||
|
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
|
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
||||||
|
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||||
|
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||||
|
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||||
|
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
|
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||||
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||||
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
|
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
|
||||||
|
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
|
github.com/mattn/go-adodb v0.0.1 h1:g/pk3V8m/WFX2IQRI58wAC24OQUFFXEiNsvs7dQ1WKg=
|
||||||
|
github.com/mattn/go-adodb v0.0.1/go.mod h1:jaSTRde4bohMuQgYQPxW3xRTPtX/cZKyxPrFVseJULo=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||||
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
|
github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
|
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||||
|
github.com/prometheus/client_golang v1.7.0 h1:wCi7urQOGBsYcQROHqpUUX4ct84xp40t9R9JX0FuA/U=
|
||||||
|
github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
||||||
|
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||||
|
github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
|
||||||
|
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||||
|
github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
|
||||||
|
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||||
|
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||||
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
|
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
|
||||||
|
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
|
||||||
|
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
|
||||||
|
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||||
|
github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
|
||||||
|
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
|
||||||
|
github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
|
||||||
|
github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg=
|
||||||
|
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
|
||||||
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
|
github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||||
|
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||||
|
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
|
||||||
|
github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
|
||||||
|
github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
|
||||||
|
github.com/weigj/go-odbc v0.0.0-20120414035027-f09eefba7e19 h1:0n3XLY0QrWER887wlRh9pzd0dmfsYak/WYwXYMEwVso=
|
||||||
|
github.com/weigj/go-odbc v0.0.0-20120414035027-f09eefba7e19/go.mod h1:I2IXPqsCTidAXyoiDDMxw9dTlFyFvpv25SiZl2Xhbnw=
|
||||||
|
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
|
||||||
|
github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
|
||||||
|
gitlab.com/stone.code/odbc3-go v0.0.0-20140130212748-f9bdfa0350f2 h1:euSt1+U+70sxHwOIiKaUthbzkuSWYDwDBO2FzK+6qec=
|
||||||
|
gitlab.com/stone.code/odbc3-go v0.0.0-20140130212748-f9bdfa0350f2/go.mod h1:susDFwJTAkX5t89LhGIcv/+3ZXIPZCkpAg0s5QkoPw4=
|
||||||
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
|
||||||
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309 h1:A0lJIi+hcTR6aajJH4YqKWwohY4aW9RO7oRMcdv+HKI=
|
||||||
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||||
|
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||||
|
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||||
|
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
|
@ -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,32 @@
|
||||||
|
ODBC database driver for Go
|
||||||
|
|
||||||
|
Install:
|
||||||
|
cd $GOPATH/src
|
||||||
|
git clone git://github.com/weigj/go-odbc.git odbc
|
||||||
|
cd odbc
|
||||||
|
go install
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
|
||||||
|
Tested on:
|
||||||
|
SQL Server 2005 and Windows 7
|
||||||
|
SQL Server 2005 and Ubuntu 10.4 (UnixODBC+FreeTDS)
|
||||||
|
Oracle 10g and Windows 7
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
Driver for database/sql
|
||||||
|
|
||||||
|
Install:
|
||||||
|
go install
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
_ "odbc/driver"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
db, err := sql.Open("odbc", "DSN=test;")
|
||||||
|
defer db.Close()
|
||||||
|
|
||||||
|
stmt, err := db.Prepare("select name from table")
|
||||||
|
defer stmt.Close()
|
||||||
|
|
||||||
|
rows, err := stmt.Query()
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
|
for rows.Next() {
|
||||||
|
var name string
|
||||||
|
|
||||||
|
_ = rows.Scan(&name)
|
||||||
|
fmt.Println(name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,159 @@
|
||||||
|
// Copyright (c) 2012, 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 driver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
"database/sql/driver"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"deescloud/odbc"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
d := &Driver{}
|
||||||
|
sql.Register("odbc", d)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Driver struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Driver) Open(dsn string) (driver.Conn, error) {
|
||||||
|
c, err := odbc.Connect(dsn)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
conn := &conn{c: c}
|
||||||
|
return conn, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Driver) Close() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type conn struct {
|
||||||
|
c *odbc.Connection
|
||||||
|
t *tx
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *conn) Prepare(query string) (driver.Stmt, error) {
|
||||||
|
st, err := c.c.Prepare(query)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
stmt := &stmt{st: st}
|
||||||
|
return stmt, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *conn) Begin() (driver.Tx, error) {
|
||||||
|
if err := c.c.AutoCommit(false); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &tx{c: c}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *conn) Close() error {
|
||||||
|
if c.c != nil {
|
||||||
|
return c.c.Close()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type tx struct {
|
||||||
|
c *conn
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *tx) Commit() error {
|
||||||
|
err := t.c.c.Commit()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *tx) Rollback() error {
|
||||||
|
err := t.c.c.Rollback()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
type stmt struct {
|
||||||
|
st *odbc.Statement
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stmt) Exec(args []driver.Value) (driver.Result, error) {
|
||||||
|
if err := s.st.Execute2(args); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
rowsAffected, err := s.st.RowsAffected()
|
||||||
|
r := &result{rowsAffected: int64(rowsAffected)}
|
||||||
|
return r, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stmt) NumInput() int {
|
||||||
|
return s.st.NumParams()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stmt) Query(args []driver.Value) (driver.Rows, error) {
|
||||||
|
//println(args)
|
||||||
|
if err := s.st.Execute2(args); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
rows := &rows{s: s}
|
||||||
|
|
||||||
|
return rows, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stmt) Close() error {
|
||||||
|
s.st.Close()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type result struct {
|
||||||
|
rowsAffected int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *result) LastInsertId() (int64, error) {
|
||||||
|
return 0, errors.New("not supported")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *result) RowsAffected() (int64, error) {
|
||||||
|
return r.rowsAffected, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type rows struct {
|
||||||
|
s *stmt
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *rows) Columns() []string {
|
||||||
|
c, err := r.s.st.NumFields()
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
columns := make([]string, c)
|
||||||
|
for i, _ := range columns {
|
||||||
|
f, err := r.s.st.FieldMetadata(i + 1)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
columns[i] = f.Name
|
||||||
|
}
|
||||||
|
return columns
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *rows) Close() error {
|
||||||
|
return r.s.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *rows) Next(dest []driver.Value) error {
|
||||||
|
eof, err := r.s.st.FetchOne2(dest)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if eof {
|
||||||
|
return io.EOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export CGO_LDFLAGS=-lodbc
|
||||||
|
go install
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
set CGO_LDFLAGS=-lodbc32
|
||||||
|
go install
|
||||||
|
|
@ -0,0 +1,765 @@
|
||||||
|
// 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
|
||||||
|
|
||||||
|
/*
|
||||||
|
#cgo darwin LDFLAGS: -lodbc
|
||||||
|
#cgo freebsd LDFLAGS: -lodbc
|
||||||
|
#cgo linux LDFLAGS: -lodbc
|
||||||
|
#cgo windows LDFLAGS: -lodbc32
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#include <windef.h>
|
||||||
|
#else
|
||||||
|
typedef void* HANDLE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sql.h>
|
||||||
|
#include <sqlext.h>
|
||||||
|
#include <sqltypes.h>
|
||||||
|
|
||||||
|
SQLRETURN _SQLColAttribute (
|
||||||
|
SQLHSTMT StatementHandle,
|
||||||
|
SQLUSMALLINT ColumnNumber,
|
||||||
|
SQLUSMALLINT FieldIdentifier,
|
||||||
|
SQLPOINTER CharacterAttributePtr,
|
||||||
|
SQLSMALLINT BufferLength,
|
||||||
|
SQLSMALLINT * StringLengthPtr,
|
||||||
|
void * NumericAttributePtr) {
|
||||||
|
return SQLColAttribute(StatementHandle,
|
||||||
|
ColumnNumber,
|
||||||
|
FieldIdentifier,
|
||||||
|
CharacterAttributePtr,
|
||||||
|
BufferLength,
|
||||||
|
StringLengthPtr,
|
||||||
|
NumericAttributePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import (
|
||||||
|
"database/sql/driver"
|
||||||
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
"time"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
BUFFER_SIZE = 10 * 1024
|
||||||
|
INFO_BUFFER_LEN = 256
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
Genv C.SQLHANDLE
|
||||||
|
)
|
||||||
|
|
||||||
|
type Connection struct {
|
||||||
|
Dbc C.SQLHANDLE
|
||||||
|
connected bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type Statement struct {
|
||||||
|
executed bool
|
||||||
|
prepared bool
|
||||||
|
scrollable bool
|
||||||
|
|
||||||
|
handle C.SQLHANDLE
|
||||||
|
}
|
||||||
|
|
||||||
|
type ODBCError struct {
|
||||||
|
SQLState string
|
||||||
|
NativeError int
|
||||||
|
ErrorMessage string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *ODBCError) Error() string {
|
||||||
|
return e.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *ODBCError) String() string {
|
||||||
|
if e != nil {
|
||||||
|
return e.SQLState + " " + e.ErrorMessage
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func initEnv() (err *ODBCError) {
|
||||||
|
ret := C.SQLAllocHandle(C.SQL_HANDLE_ENV, nil, &Genv)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_ENV, Genv)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ret = C.SQLSetEnvAttr(C.SQLHENV(Genv), C.SQL_ATTR_ODBC_VERSION, C.SQLPOINTER(unsafe.Pointer(uintptr(C.SQL_OV_ODBC3))), C.SQLINTEGER(0))
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_ENV, Genv)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Connect(dsn string, params ...interface{}) (conn *Connection, err *ODBCError) {
|
||||||
|
var h C.SQLHANDLE
|
||||||
|
ret := C.SQLAllocHandle(C.SQL_HANDLE_DBC, Genv, &h)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, h)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var stringLength2 C.SQLSMALLINT
|
||||||
|
outBuf := make([]byte, BUFFER_SIZE*2)
|
||||||
|
outConnectionString := (*C.SQLWCHAR)(unsafe.Pointer(&outBuf[0]))
|
||||||
|
|
||||||
|
ret = C.SQLDriverConnectW(C.SQLHDBC(h),
|
||||||
|
C.SQLHWND(unsafe.Pointer(uintptr(0))),
|
||||||
|
(*C.SQLWCHAR)(unsafe.Pointer(StringToUTF16Ptr(dsn))),
|
||||||
|
C.SQL_NTS,
|
||||||
|
outConnectionString,
|
||||||
|
BUFFER_SIZE,
|
||||||
|
&stringLength2,
|
||||||
|
C.SQL_DRIVER_NOPROMPT)
|
||||||
|
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, h)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &Connection{Dbc: h, connected: true}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) ExecDirect(sql string) (stmt *Statement, err *ODBCError) {
|
||||||
|
if stmt, err = conn.newStmt(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
wsql := StringToUTF16Ptr(sql)
|
||||||
|
ret := C.SQLExecDirectW(C.SQLHSTMT(stmt.handle), (*C.SQLWCHAR)(unsafe.Pointer(wsql)), C.SQL_NTS)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
stmt.Close()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
stmt.executed = true
|
||||||
|
return stmt, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) newStmt() (*Statement, *ODBCError) {
|
||||||
|
stmt := &Statement{}
|
||||||
|
|
||||||
|
ret := C.SQLAllocHandle(C.SQL_HANDLE_STMT, conn.Dbc, &stmt.handle)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return stmt, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) Prepare(sql string, params ...interface{}) (*Statement, *ODBCError) {
|
||||||
|
wsql := StringToUTF16Ptr(sql)
|
||||||
|
stmt, err := conn.newStmt()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
ret := C.SQLPrepareW(C.SQLHSTMT(stmt.handle), (*C.SQLWCHAR)(unsafe.Pointer(wsql)), C.SQLINTEGER(len(sql)))
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
stmt.Close()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
stmt.prepared = true
|
||||||
|
return stmt, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) Commit() (err *ODBCError) {
|
||||||
|
ret := C.SQLEndTran(C.SQL_HANDLE_DBC, conn.Dbc, C.SQL_COMMIT)
|
||||||
|
if !Success(ret) {
|
||||||
|
err = FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) AutoCommit(b bool) (err *ODBCError) {
|
||||||
|
var n C.int
|
||||||
|
if b {
|
||||||
|
n = C.SQL_AUTOCOMMIT_ON
|
||||||
|
} else {
|
||||||
|
n = C.SQL_AUTOCOMMIT_OFF
|
||||||
|
}
|
||||||
|
ret := C.SQLSetConnectAttr(C.SQLHDBC(conn.Dbc), C.SQL_ATTR_AUTOCOMMIT, C.SQLPOINTER(unsafe.Pointer(uintptr(n))), C.SQL_IS_UINTEGER)
|
||||||
|
if !Success(ret) {
|
||||||
|
err = FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) BeginTransaction() (err *ODBCError) {
|
||||||
|
ret := C.SQLSetConnectAttr(C.SQLHDBC(conn.Dbc), C.SQL_ATTR_AUTOCOMMIT, C.SQLPOINTER(unsafe.Pointer(uintptr(C.SQL_AUTOCOMMIT_OFF))), C.SQL_IS_UINTEGER)
|
||||||
|
if !Success(ret) {
|
||||||
|
err = FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) Rollback() (err *ODBCError) {
|
||||||
|
ret := C.SQLEndTran(C.SQL_HANDLE_DBC, conn.Dbc, C.SQL_ROLLBACK)
|
||||||
|
if !Success(ret) {
|
||||||
|
err = FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) ServerInfo() (string, string, string, *ODBCError) {
|
||||||
|
var info_len C.SQLSMALLINT
|
||||||
|
p := make([]byte, INFO_BUFFER_LEN)
|
||||||
|
ret := C.SQLGetInfo(C.SQLHDBC(conn.Dbc), C.SQL_DATABASE_NAME, C.SQLPOINTER(unsafe.Pointer(&p[0])), INFO_BUFFER_LEN, &info_len)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
return "", "", "", err
|
||||||
|
}
|
||||||
|
db := string(p[0:info_len])
|
||||||
|
ret = C.SQLGetInfo(C.SQLHDBC(conn.Dbc), C.SQL_DBMS_VER, C.SQLPOINTER(unsafe.Pointer(&p[0])), INFO_BUFFER_LEN, &info_len)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
return db, "", "", err
|
||||||
|
}
|
||||||
|
ver := string(p[0:info_len])
|
||||||
|
ret = C.SQLGetInfo(C.SQLHDBC(conn.Dbc), C.SQL_SERVER_NAME, C.SQLPOINTER(unsafe.Pointer(&p[0])), INFO_BUFFER_LEN, &info_len)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
return db, ver, "", err
|
||||||
|
}
|
||||||
|
server := string(p[0:info_len])
|
||||||
|
return db, ver, server, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) ClientInfo() (string, string, string, *ODBCError) {
|
||||||
|
var info_len C.SQLSMALLINT
|
||||||
|
p := make([]byte, INFO_BUFFER_LEN)
|
||||||
|
ret := C.SQLGetInfo(C.SQLHDBC(conn.Dbc), C.SQL_DRIVER_NAME, C.SQLPOINTER(unsafe.Pointer(&p[0])), INFO_BUFFER_LEN, &info_len)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
return "", "", "", err
|
||||||
|
}
|
||||||
|
drv_name := string(p[0:info_len])
|
||||||
|
ret = C.SQLGetInfo(C.SQLHDBC(conn.Dbc), C.SQL_DRIVER_ODBC_VER, C.SQLPOINTER(unsafe.Pointer(&p[0])), INFO_BUFFER_LEN, &info_len)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
return "", "", "", err
|
||||||
|
}
|
||||||
|
drv_odbc_ver := string(p[0:info_len])
|
||||||
|
ret = C.SQLGetInfo(C.SQLHDBC(conn.Dbc), C.SQL_DRIVER_VER, C.SQLPOINTER(unsafe.Pointer(&p[0])), INFO_BUFFER_LEN, &info_len)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
return "", "", "", err
|
||||||
|
}
|
||||||
|
drv_ver := string(p[0:info_len])
|
||||||
|
return drv_name, drv_odbc_ver, drv_ver, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Connection) Close() *ODBCError {
|
||||||
|
if conn.connected {
|
||||||
|
ret := C.SQLDisconnect(C.SQLHDBC(conn.Dbc))
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ret = C.SQLFreeHandle(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
conn.connected = false
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/* func (stmt *Statement) RowsAffected() (int, *ODBCError)
|
||||||
|
|
||||||
|
修改成func (stmt *Statement) RowsAffected() (int, error)
|
||||||
|
|
||||||
|
*/
|
||||||
|
func (stmt *Statement) RowsAffected() (int, error) {
|
||||||
|
var nor C.SQLLEN
|
||||||
|
ret := C.SQLRowCount(C.SQLHSTMT(stmt.handle), &nor)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
return int(nor), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) Cancel() *ODBCError {
|
||||||
|
ret := C.SQLCancel(C.SQLHSTMT(stmt.handle))
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) NumParams() int {
|
||||||
|
var cParams C.SQLSMALLINT
|
||||||
|
ret := C.SQLNumParams(C.SQLHSTMT(stmt.handle), &cParams)
|
||||||
|
if !Success(ret) {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
return int(cParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) Execute(params ...interface{}) *ODBCError {
|
||||||
|
if params != nil {
|
||||||
|
var cParams C.SQLSMALLINT
|
||||||
|
ret := C.SQLNumParams(C.SQLHSTMT(stmt.handle), &cParams)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for i := 0; i < int(cParams); i++ {
|
||||||
|
stmt.BindParam(i+1, params[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret := C.SQLExecute(C.SQLHSTMT(stmt.handle))
|
||||||
|
if ret == C.SQL_NEED_DATA {
|
||||||
|
// TODO
|
||||||
|
// send_data(stmt)
|
||||||
|
} else if ret == C.SQL_NO_DATA {
|
||||||
|
// Execute NO DATA
|
||||||
|
} else if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
stmt.executed = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) Execute2(params []driver.Value) *ODBCError {
|
||||||
|
if params != nil {
|
||||||
|
var cParams C.SQLSMALLINT
|
||||||
|
ret := C.SQLNumParams(C.SQLHSTMT(stmt.handle), &cParams)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for i := 0; i < int(cParams); i++ {
|
||||||
|
stmt.BindParam(i+1, params[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret := C.SQLExecute(C.SQLHSTMT(stmt.handle))
|
||||||
|
if ret == C.SQL_NEED_DATA {
|
||||||
|
// TODO
|
||||||
|
// send_data(stmt)
|
||||||
|
} else if ret == C.SQL_NO_DATA {
|
||||||
|
// Execute NO DATA
|
||||||
|
} else if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
stmt.executed = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) Fetch() (bool, *ODBCError) {
|
||||||
|
ret := C.SQLFetch(C.SQLHSTMT(stmt.handle))
|
||||||
|
if ret == C.SQL_NO_DATA {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Row struct {
|
||||||
|
Data []interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get(Columnindex)
|
||||||
|
// TODO Get(ColumnName)
|
||||||
|
func (r *Row) Get(a interface{}) interface{} {
|
||||||
|
value := reflect.ValueOf(a)
|
||||||
|
switch f := value; f.Kind() {
|
||||||
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||||
|
return r.Data[f.Int()]
|
||||||
|
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||||
|
return r.Data[f.Uint()]
|
||||||
|
// case *reflect.StringValue:
|
||||||
|
// i := r.Meta[f.Get()]
|
||||||
|
// return r.Data[i]
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Row) GetInt(a interface{}) (ret int64) {
|
||||||
|
v := r.Get(a)
|
||||||
|
value := reflect.ValueOf(v)
|
||||||
|
switch f := value; f.Kind() {
|
||||||
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||||
|
ret = int64(f.Int())
|
||||||
|
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||||
|
ret = int64(f.Uint())
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Row) GetFloat(a interface{}) (ret float64) {
|
||||||
|
v := r.Get(a)
|
||||||
|
value := reflect.ValueOf(v)
|
||||||
|
switch f := value; f.Kind() {
|
||||||
|
case reflect.Float32, reflect.Float64:
|
||||||
|
ret = float64(f.Float())
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Row) GetString(a interface{}) (ret string) {
|
||||||
|
v := r.Get(a)
|
||||||
|
value := reflect.ValueOf(v)
|
||||||
|
switch f := value; f.Kind() {
|
||||||
|
case reflect.String:
|
||||||
|
ret = f.String()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Row) Length() int {
|
||||||
|
return len(r.Data)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) FetchAll() (rows []*Row, err *ODBCError) {
|
||||||
|
for {
|
||||||
|
row, err := stmt.FetchOne()
|
||||||
|
if err != nil || row == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
rows = append(rows, row)
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) FetchOne() (*Row, *ODBCError) {
|
||||||
|
ok, err := stmt.Fetch()
|
||||||
|
if !ok {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
n, _ := stmt.NumFields()
|
||||||
|
row := new(Row)
|
||||||
|
row.Data = make([]interface{}, n)
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
v, _, _, _ := stmt.GetField(i)
|
||||||
|
row.Data[i] = v
|
||||||
|
}
|
||||||
|
return row, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) FetchOne2(row []driver.Value) (eof bool, err *ODBCError) {
|
||||||
|
ok, err := stmt.Fetch()
|
||||||
|
if !ok && err == nil {
|
||||||
|
return !ok, nil
|
||||||
|
} else if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
n, _ := stmt.NumFields()
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
v, _, _, _ := stmt.GetField(i)
|
||||||
|
row[i] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
//fmt.Println("row:", row)
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) GetField(field_index int) (v interface{}, ftype int, flen int, err *ODBCError) {
|
||||||
|
var field_type C.int
|
||||||
|
var field_len C.SQLLEN
|
||||||
|
var ll C.SQLSMALLINT
|
||||||
|
ret := C._SQLColAttribute(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_DESC_CONCISE_TYPE, C.SQLPOINTER(unsafe.Pointer(uintptr(0))), C.SQLSMALLINT(0), &ll, unsafe.Pointer(&field_type))
|
||||||
|
if !Success(ret) {
|
||||||
|
// TODO return err
|
||||||
|
}
|
||||||
|
ret = C._SQLColAttribute(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_DESC_LENGTH, C.SQLPOINTER(unsafe.Pointer(uintptr(0))), C.SQLSMALLINT(0), &ll, unsafe.Pointer(&field_len))
|
||||||
|
if !Success(ret) {
|
||||||
|
// TODO return err
|
||||||
|
}
|
||||||
|
var fl C.SQLLEN = C.SQLLEN(field_len)
|
||||||
|
switch int(field_type) {
|
||||||
|
case C.SQL_BIT:
|
||||||
|
var value C.BYTE
|
||||||
|
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_BIT, C.SQLPOINTER(unsafe.Pointer(&value)), 0, &fl)
|
||||||
|
if fl == -1 {
|
||||||
|
v = byte(0)
|
||||||
|
} else {
|
||||||
|
v = byte(value)
|
||||||
|
}
|
||||||
|
case C.SQL_INTEGER, C.SQL_SMALLINT, C.SQL_TINYINT:
|
||||||
|
var value C.long
|
||||||
|
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_LONG, C.SQLPOINTER(unsafe.Pointer(&value)), 0, &fl)
|
||||||
|
if fl == -1 {
|
||||||
|
v = byte(0)
|
||||||
|
} else {
|
||||||
|
v = int(value)
|
||||||
|
}
|
||||||
|
case C.SQL_BIGINT:
|
||||||
|
var value C.longlong
|
||||||
|
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_SBIGINT, C.SQLPOINTER(unsafe.Pointer(&value)), 0, &fl)
|
||||||
|
if fl == -1 {
|
||||||
|
v = int64(0)
|
||||||
|
} else {
|
||||||
|
v = int64(value)
|
||||||
|
}
|
||||||
|
case C.SQL_FLOAT, C.SQL_REAL, C.SQL_DOUBLE:
|
||||||
|
var value C.double
|
||||||
|
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_DOUBLE, C.SQLPOINTER(unsafe.Pointer(&value)), 0, &fl)
|
||||||
|
if fl == -1 {
|
||||||
|
v = float64(0)
|
||||||
|
} else {
|
||||||
|
v = float64(value)
|
||||||
|
}
|
||||||
|
case C.SQL_CHAR, C.SQL_VARCHAR, C.SQL_LONGVARCHAR, C.SQL_WCHAR, C.SQL_WVARCHAR, C.SQL_WLONGVARCHAR:
|
||||||
|
value := make([]uint16, int(field_len)+8)
|
||||||
|
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_WCHAR, C.SQLPOINTER(unsafe.Pointer(&value[0])), field_len+4, &fl)
|
||||||
|
s := UTF16ToString(value)
|
||||||
|
v = s
|
||||||
|
case C.SQL_TYPE_TIMESTAMP, C.SQL_TYPE_DATE, C.SQL_TYPE_TIME, C.SQL_DATETIME:
|
||||||
|
var value C.TIMESTAMP_STRUCT
|
||||||
|
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_TYPE_TIMESTAMP, C.SQLPOINTER(unsafe.Pointer(&value)), C.SQLLEN(unsafe.Sizeof(value)), &fl)
|
||||||
|
if fl == -1 {
|
||||||
|
v = nil
|
||||||
|
} else {
|
||||||
|
v = time.Date(int(value.year), time.Month(value.month), int(value.day), int(value.hour), int(value.minute), int(value.second), int(value.fraction), time.UTC)
|
||||||
|
}
|
||||||
|
case C.SQL_BINARY, C.SQL_VARBINARY, C.SQL_LONGVARBINARY:
|
||||||
|
var vv int
|
||||||
|
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_BINARY, C.SQLPOINTER(unsafe.Pointer(&vv)), 0, &fl)
|
||||||
|
if fl == -1 {
|
||||||
|
v = nil
|
||||||
|
} else {
|
||||||
|
value := make([]byte, fl)
|
||||||
|
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_BINARY, C.SQLPOINTER(unsafe.Pointer(&value[0])), C.SQLLEN(fl), &fl)
|
||||||
|
v = value
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
value := make([]byte, field_len)
|
||||||
|
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_BINARY, C.SQLPOINTER(unsafe.Pointer(&value[0])), field_len, &fl)
|
||||||
|
v = value
|
||||||
|
}
|
||||||
|
if !Success(ret) {
|
||||||
|
err = FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
}
|
||||||
|
return v, int(field_type), int(fl), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) NumFields() (int, *ODBCError) {
|
||||||
|
var NOC C.SQLSMALLINT
|
||||||
|
ret := C.SQLNumResultCols(C.SQLHSTMT(stmt.handle), &NOC)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
return int(NOC), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) GetParamType(index int) (int, int, int, int, *ODBCError) {
|
||||||
|
var data_type, dec_ptr, null_ptr C.SQLSMALLINT
|
||||||
|
var size_ptr C.SQLULEN
|
||||||
|
ret := C.SQLDescribeParam(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(index), &data_type, &size_ptr, &dec_ptr, &null_ptr)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return -1, -1, -1, -1, err
|
||||||
|
}
|
||||||
|
return int(data_type), int(size_ptr), int(dec_ptr), int(null_ptr), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) BindParam(index int, param interface{}) *ODBCError {
|
||||||
|
var ValueType C.SQLSMALLINT
|
||||||
|
var ParameterType C.SQLSMALLINT
|
||||||
|
var ColumnSize C.SQLULEN
|
||||||
|
var DecimalDigits C.SQLSMALLINT
|
||||||
|
var ParameterValuePtr C.SQLPOINTER
|
||||||
|
var BufferLength C.SQLLEN
|
||||||
|
var StrLen_or_IndPt C.SQLLEN
|
||||||
|
v := reflect.ValueOf(param)
|
||||||
|
if param == nil {
|
||||||
|
ft, _, _, _, err := stmt.GetParamType(index)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ParameterType = C.SQLSMALLINT(ft)
|
||||||
|
if ParameterType == C.SQL_UNKNOWN_TYPE {
|
||||||
|
ParameterType = C.SQL_VARCHAR
|
||||||
|
}
|
||||||
|
ValueType = C.SQL_C_DEFAULT
|
||||||
|
StrLen_or_IndPt = C.SQL_NULL_DATA
|
||||||
|
ColumnSize = 1
|
||||||
|
} else {
|
||||||
|
switch v.Kind() {
|
||||||
|
case reflect.Bool:
|
||||||
|
ParameterType = C.SQL_BIT
|
||||||
|
ValueType = C.SQL_C_BIT
|
||||||
|
var b [1]byte
|
||||||
|
if v.Bool() {
|
||||||
|
b[0] = 1
|
||||||
|
} else {
|
||||||
|
b[0] = 0
|
||||||
|
}
|
||||||
|
ParameterValuePtr = C.SQLPOINTER(unsafe.Pointer(&b[0]))
|
||||||
|
BufferLength = 1
|
||||||
|
StrLen_or_IndPt = 0
|
||||||
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||||
|
switch v.Type().Kind() {
|
||||||
|
case reflect.Int:
|
||||||
|
case reflect.Int8, reflect.Int16, reflect.Int32:
|
||||||
|
ParameterType = C.SQL_INTEGER
|
||||||
|
ValueType = C.SQL_C_LONG
|
||||||
|
var l C.long = C.long(v.Int())
|
||||||
|
ParameterValuePtr = C.SQLPOINTER(unsafe.Pointer(&l))
|
||||||
|
BufferLength = 4
|
||||||
|
StrLen_or_IndPt = 0
|
||||||
|
case reflect.Int64:
|
||||||
|
ParameterType = C.SQL_BIGINT
|
||||||
|
ValueType = C.SQL_C_SBIGINT
|
||||||
|
var ll C.longlong = C.longlong(v.Int())
|
||||||
|
ParameterValuePtr = C.SQLPOINTER(unsafe.Pointer(&ll))
|
||||||
|
BufferLength = 8
|
||||||
|
StrLen_or_IndPt = 0
|
||||||
|
}
|
||||||
|
case reflect.Float32, reflect.Float64:
|
||||||
|
ParameterType = C.SQL_DOUBLE
|
||||||
|
ValueType = C.SQL_C_DOUBLE
|
||||||
|
var d C.double = C.double(v.Float())
|
||||||
|
ParameterValuePtr = C.SQLPOINTER(unsafe.Pointer(&d))
|
||||||
|
BufferLength = 8
|
||||||
|
StrLen_or_IndPt = 0
|
||||||
|
case reflect.Complex64, reflect.Complex128:
|
||||||
|
case reflect.String:
|
||||||
|
var slen C.SQLUINTEGER = C.SQLUINTEGER(len(v.String()))
|
||||||
|
ParameterType = C.SQL_VARCHAR
|
||||||
|
ValueType = C.SQL_C_CHAR
|
||||||
|
s := []byte(v.String())
|
||||||
|
ParameterValuePtr = C.SQLPOINTER(unsafe.Pointer(&s[0]))
|
||||||
|
ColumnSize = C.SQLULEN(slen)
|
||||||
|
BufferLength = C.SQLLEN(slen + 1)
|
||||||
|
StrLen_or_IndPt = C.SQLLEN(slen)
|
||||||
|
default:
|
||||||
|
fmt.Println("Not support type", v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret := C.SQLBindParameter(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(index), C.SQL_PARAM_INPUT, ValueType, ParameterType, ColumnSize, DecimalDigits, ParameterValuePtr, BufferLength, &StrLen_or_IndPt)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) NextResult() bool {
|
||||||
|
ret := C.SQLMoreResults(C.SQLHSTMT(stmt.handle))
|
||||||
|
if ret == C.SQL_NO_DATA {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) NumRows() (int, *ODBCError) {
|
||||||
|
var NOR C.SQLLEN
|
||||||
|
ret := C.SQLRowCount(C.SQLHSTMT(stmt.handle), &NOR)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
return int(NOR), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) HasRows() bool {
|
||||||
|
n, _ := stmt.NumRows()
|
||||||
|
return n > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type Field struct {
|
||||||
|
Name string
|
||||||
|
Type int
|
||||||
|
Size int
|
||||||
|
DecimalDigits int
|
||||||
|
Nullable int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) FieldMetadata(col int) (*Field, *ODBCError) {
|
||||||
|
var BufferLength C.SQLSMALLINT = INFO_BUFFER_LEN
|
||||||
|
var NameLength C.SQLSMALLINT
|
||||||
|
var DataType C.SQLSMALLINT
|
||||||
|
var ColumnSize C.SQLULEN
|
||||||
|
var DecimalDigits C.SQLSMALLINT
|
||||||
|
var Nullable C.SQLSMALLINT
|
||||||
|
ColumnName := make([]byte, INFO_BUFFER_LEN)
|
||||||
|
ret := C.SQLDescribeCol(C.SQLHSTMT(stmt.handle),
|
||||||
|
C.SQLUSMALLINT(col),
|
||||||
|
(*C.SQLCHAR)(unsafe.Pointer(&ColumnName[0])),
|
||||||
|
BufferLength,
|
||||||
|
&NameLength,
|
||||||
|
&DataType,
|
||||||
|
&ColumnSize,
|
||||||
|
&DecimalDigits,
|
||||||
|
&Nullable)
|
||||||
|
if !Success(ret) {
|
||||||
|
err := FormatError(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
field := &Field{string(ColumnName[0:NameLength]), int(DataType), int(ColumnSize), int(DecimalDigits), int(Nullable)}
|
||||||
|
return field, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) free() {
|
||||||
|
if stmt.handle != nil {
|
||||||
|
C.SQLFreeHandle(C.SQL_HANDLE_STMT, stmt.handle)
|
||||||
|
stmt.handle = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (stmt *Statement) Close() {
|
||||||
|
stmt.free()
|
||||||
|
}
|
||||||
|
|
||||||
|
func Success(ret C.SQLRETURN) bool {
|
||||||
|
return int(ret) == C.SQL_SUCCESS || int(ret) == C.SQL_SUCCESS_WITH_INFO
|
||||||
|
}
|
||||||
|
|
||||||
|
func FormatError(ht C.SQLSMALLINT, h C.SQLHANDLE) (err *ODBCError) {
|
||||||
|
sqlState := make([]uint16, 6)
|
||||||
|
var nativeError C.SQLINTEGER
|
||||||
|
messageText := make([]uint16, C.SQL_MAX_MESSAGE_LENGTH)
|
||||||
|
var textLength C.SQLSMALLINT
|
||||||
|
err = &ODBCError{}
|
||||||
|
i := 0
|
||||||
|
for {
|
||||||
|
i++
|
||||||
|
ret := C.SQLGetDiagRecW(C.SQLSMALLINT(ht),
|
||||||
|
h,
|
||||||
|
C.SQLSMALLINT(i),
|
||||||
|
(*C.SQLWCHAR)(unsafe.Pointer(&sqlState[0])),
|
||||||
|
&nativeError,
|
||||||
|
(*C.SQLWCHAR)(unsafe.Pointer(&messageText[0])),
|
||||||
|
C.SQL_MAX_MESSAGE_LENGTH,
|
||||||
|
&textLength)
|
||||||
|
if ret == C.SQL_INVALID_HANDLE || ret == C.SQL_NO_DATA {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if i == 1 { // first error message save the SQLSTATE.
|
||||||
|
err.SQLState = UTF16ToString(sqlState)
|
||||||
|
err.NativeError = int(nativeError)
|
||||||
|
}
|
||||||
|
err.ErrorMessage += UTF16ToString(messageText)
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if err := initEnv(); err != nil {
|
||||||
|
panic("odbc init env error!" + err.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package odbc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unicode/utf16"
|
||||||
|
)
|
||||||
|
|
||||||
|
// StringToUTF16 returns the UTF-16 encoding of the UTF-8 string s,
|
||||||
|
// with a terminating NUL added.
|
||||||
|
func StringToUTF16(s string) []uint16 { return utf16.Encode([]rune(s + "\x00")) }
|
||||||
|
|
||||||
|
// UTF16ToString returns the UTF-8 encoding of the UTF-16 sequence s,
|
||||||
|
// with a terminating NUL removed.
|
||||||
|
func UTF16ToString(s []uint16) string {
|
||||||
|
for i, v := range s {
|
||||||
|
if v == 0 {
|
||||||
|
s = s[0:i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string(utf16.Decode(s))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringToUTF16Ptr returns pointer to the UTF-16 encoding of
|
||||||
|
// the UTF-8 string s, with a terminating NUL added.
|
||||||
|
func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] }
|
||||||
|
|
@ -0,0 +1,495 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
type mul_sp_2_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Plan []sp_2 `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type update_sp_2_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Plan sp_2 `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_sp_2_resp struct {
|
||||||
|
Data []sp_2 `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_sp_2_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Index int `json:"index"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
|
||||||
|
Contract_id int `json:"contract_id"` //合同号
|
||||||
|
Supplier string `json:"supplier"` //供应商
|
||||||
|
Contract_name string `json:"contract_name"` //合同名称
|
||||||
|
Rdm string `json:"rdm"`
|
||||||
|
Buyer string `json:"buyer"` //采购人员
|
||||||
|
|
||||||
|
If_done bool `json:"if_done"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type mul_sp_1_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Plan []sp_1 `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type update_sp_1_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Plan sp_1 `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_sp_1_resp struct {
|
||||||
|
Data []sp_1 `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_sp_1_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Index int `json:"index"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
|
||||||
|
ID int `json:"id"` //序号
|
||||||
|
|
||||||
|
Supplier string `json:"supplier"`
|
||||||
|
Applicant string `json:"applicant"` //申请人
|
||||||
|
Time string `json:"time"`
|
||||||
|
Contract_name string `json:"contract_name"` //合同名称
|
||||||
|
Rdm string `json:"rdm"`
|
||||||
|
Amount string `json:"amount"` //金额
|
||||||
|
|
||||||
|
If_done bool `json:"if_done"`
|
||||||
|
State string `json:"state"` //审批状态
|
||||||
|
}
|
||||||
|
|
||||||
|
type import_sp_1_Req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Plan []sp_1 `json:"plan"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type update_payment_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
|
||||||
|
Data payment_info `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_payment_by_id_resp struct {
|
||||||
|
Data payment_info `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_payment_resp struct {
|
||||||
|
Data []payment_info `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type payment_info struct {
|
||||||
|
Pre_id int `json:"pre_id"` //父id
|
||||||
|
ID int `json:"id"`
|
||||||
|
|
||||||
|
Supplier string `json:"supplier"` //供应商
|
||||||
|
|
||||||
|
Code string `json:"code"` //编号
|
||||||
|
Name string `json:"name"` //名称
|
||||||
|
Spec string `json:"spec"` //规格
|
||||||
|
Unit string `json:"unit"` //单位
|
||||||
|
Num string `json:"num"` //数量
|
||||||
|
Price string `json:"price"` //单价
|
||||||
|
|
||||||
|
Payment_type string `json:"pt"` //付款方式
|
||||||
|
|
||||||
|
Total_p string `json:"total_p"` //总计
|
||||||
|
|
||||||
|
Paid string `json:"paid"` //已付
|
||||||
|
|
||||||
|
Residual_p string `json:"rp"` //应付
|
||||||
|
|
||||||
|
Payment_data []payment_month `json:"payment_data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type payment_month struct {
|
||||||
|
Month string `json:"payment_month"`
|
||||||
|
Payment string `json:"payment"`
|
||||||
|
Payment_user string `json:"payment_user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_payment_by_id_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
|
||||||
|
ID int `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_payment_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
|
||||||
|
Index int `json:"index"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
//ID string `json:"id"`
|
||||||
|
|
||||||
|
Code string `json:"code"` //编号
|
||||||
|
Name string `json:"name"` //名称
|
||||||
|
Supplier string `json:"supplier"` //供应商
|
||||||
|
}
|
||||||
|
|
||||||
|
type approve_ok_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
|
||||||
|
ID int `json:"id"`
|
||||||
|
|
||||||
|
Data []approve_m_detail `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type del_approve_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
|
||||||
|
Data []approve_m_info `json:"ids"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type import_approve_m_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Data []approve_m_detail `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type approve_m_detail struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
|
||||||
|
Supplier string `json:"supplier"` //供应商
|
||||||
|
Supplier_code string `json:"supplier_code"` //供应商
|
||||||
|
Payment_type string `json:"pt"` //付款方式
|
||||||
|
|
||||||
|
Code string `json:"code"` //编号
|
||||||
|
Name string `json:"name"` //名称
|
||||||
|
Spec string `json:"spec"` //规格
|
||||||
|
Unit string `json:"unit"` //单位
|
||||||
|
Price string `json:"price"` //单价
|
||||||
|
Update_date string `json:"update_date"` //更新日期
|
||||||
|
|
||||||
|
Procurement_cycle string `json:"pc"` //采购周期
|
||||||
|
|
||||||
|
Validity_period_of_quotation string `json:"vpoq"` //报价有效期
|
||||||
|
|
||||||
|
Effective_time string `json:"effective_time"` //报价有效时间=更新时间-today+报价有效期
|
||||||
|
|
||||||
|
Op_type string `json:"op_type"`
|
||||||
|
Price_span string `json:"price_span"`
|
||||||
|
|
||||||
|
Last_price string `json:"last_price"`
|
||||||
|
|
||||||
|
Factory string `json:"factory"` //生产厂家
|
||||||
|
Factory_code string `json:"factory_code"` //厂家编号
|
||||||
|
Qs string `json:"qs"` //质量标准
|
||||||
|
As string `json:"as"` //验收标准
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_approve_m_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Index int `json:"index"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
Applicant string `json:"applicant"` //申请人
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_approve_m_resp struct {
|
||||||
|
Data []approve_m_info `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type approve_m_info struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
Applicant string `json:"applicant"`
|
||||||
|
Time string `json:"time"`
|
||||||
|
Record_cnt int `json:"record_cnt"`
|
||||||
|
Update_cnt int `json:"update_cnt"`
|
||||||
|
Add_cnt int `json:"add_cnt"`
|
||||||
|
State string `json:"state"`
|
||||||
|
Data string `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_material_resp struct {
|
||||||
|
Data []material_info `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type material_info struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
|
||||||
|
Supplier string `json:"supplier"` //供应商
|
||||||
|
Supplier_code string `json:"supplier_code"` //供应商
|
||||||
|
Payment_type string `json:"pt"` //付款方式
|
||||||
|
|
||||||
|
Code string `json:"code"` //编号
|
||||||
|
Name string `json:"name"` //名称
|
||||||
|
Spec string `json:"spec"` //规格
|
||||||
|
Unit string `json:"unit"` //单位
|
||||||
|
Price string `json:"price"` //单价
|
||||||
|
Update_date string `json:"update_date"` //更新日期
|
||||||
|
|
||||||
|
Procurement_cycle string `json:"pc"` //采购周期
|
||||||
|
|
||||||
|
Validity_period_of_quotation string `json:"vpoq"` //报价有效期
|
||||||
|
|
||||||
|
Effective_time string `json:"effective_time"` //报价有效时间=更新时间-today+报价有效期
|
||||||
|
|
||||||
|
Price_2 string `json:"price_2"` //单价
|
||||||
|
Update_date_2 string `json:"update_date_2"` //更新日期
|
||||||
|
|
||||||
|
Price_3 string `json:"price_3"` //单价
|
||||||
|
Update_date_3 string `json:"update_date_3"` //更新日期
|
||||||
|
|
||||||
|
Price_4 string `json:"price_4"` //单价
|
||||||
|
Update_date_4 string `json:"update_date_4"` //更新日期
|
||||||
|
|
||||||
|
Price_5 string `json:"price_5"` //单价
|
||||||
|
Update_date_5 string `json:"update_date_5"` //更新日期
|
||||||
|
|
||||||
|
Price_arr []price_update_info `json:"price_arr"`
|
||||||
|
|
||||||
|
Factory string `json:"factory"` //生产厂家
|
||||||
|
Factory_code string `json:"factory_code"` //厂家编号
|
||||||
|
Qs string `json:"qs"` //质量标准
|
||||||
|
As string `json:"as"` //验收标准
|
||||||
|
|
||||||
|
Del_time string `json:"del_time"`
|
||||||
|
Del_user string `json:"del_user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type price_update_info struct {
|
||||||
|
Price_ string `json:"price_"` //单价
|
||||||
|
Update_date_ string `json:"update_date_"` //更新日期
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_material_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Index int `json:"index"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
//ID string `json:"id"`
|
||||||
|
|
||||||
|
Code string `json:"code"` //编号
|
||||||
|
Name string `json:"name"` //名称
|
||||||
|
Supplier string `json:"supplier"` //供应商
|
||||||
|
Bt string `json:"bt"` //开始时间
|
||||||
|
Et string `json:"et"` //结束时间
|
||||||
|
|
||||||
|
If_del bool `json:"if_del"` //是否已删除
|
||||||
|
}
|
||||||
|
|
||||||
|
type post_rs_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
ID int `json:"id"`
|
||||||
|
State string `json:"rs"`
|
||||||
|
Oper_type int `json:"oper_type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_rs_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
State string `json:"state"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type cal_completion_date_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Bt string `json:"bt"`
|
||||||
|
Days string `json:"days"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type remove_material_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
ID []int `json:"ids"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type remove_ma_plan_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
ID int `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_ma_username_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_p_name_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
P_id string `json:"p_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_p_id_options_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
P_like_id string `json:"p_like_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type mul_update_pp_plan_num_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Plan []pp_plan `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type update_ma_plan_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Plan pp_plan `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_single_plan_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
ID []int `json:"id"`
|
||||||
|
If_done bool `json:"if_done"` //已处理
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_single_plan_resp struct {
|
||||||
|
Data []pp_plan `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_ma_plan_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Index int `json:"index"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
RDM string `json:"rdm"`
|
||||||
|
Bt string `json:"bt"`
|
||||||
|
Et string `json:"et"`
|
||||||
|
Code string `json:"code"` //编号
|
||||||
|
Name string `json:"name"` //名称
|
||||||
|
Supplier string `json:"supplier"` //供应方
|
||||||
|
|
||||||
|
If_done bool `json:"if_done"` //已处理
|
||||||
|
|
||||||
|
State string `json:"state"`
|
||||||
|
|
||||||
|
Buyer string `json:"buyer"` //采购人
|
||||||
|
Codes []string `json:"codes"` //编号
|
||||||
|
}
|
||||||
|
|
||||||
|
type import_ma_plan_Req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Plan []pp_plan `json:"plan"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type del_process_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Ids []process_info `json:"ids"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type update_process_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Data process_info `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type import_process_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Data []process_info `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_process_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
P_id string `json:"p_id"`
|
||||||
|
Process_name string `json:"process_name"`
|
||||||
|
Index int `json:"index"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type import_p_Req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Data []p_sap `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type del_p_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Ids []p_sap `json:"ids"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type post_p_req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Id int `json:"id"`
|
||||||
|
P_id string `json:"p_id"`
|
||||||
|
P_name string `json:"p_name"`
|
||||||
|
OperType int `json:"oper_type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_p_Req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
P_id string `json:"p_id"`
|
||||||
|
P_name string `json:"p_name"`
|
||||||
|
Index int `json:"index"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type download_template_file_Req struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type getUserNamesReq struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PostUserReq struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Id int `json:"id"`
|
||||||
|
Username string `json:"username"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
Role string `json:"role"`
|
||||||
|
Department string `json:"department"`
|
||||||
|
OperType int `json:"oper_type"`
|
||||||
|
State string `json:"state"`
|
||||||
|
|
||||||
|
If_buyer int `json:"if_buyer"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type getUsersReq struct {
|
||||||
|
OpUser string `json:"opuser"`
|
||||||
|
OpUserUuid string `json:"opuser_uuid"`
|
||||||
|
Id string `json:"id"`
|
||||||
|
Index int `json:"index"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetMenuReq struct {
|
||||||
|
UserName string `json:"username"`
|
||||||
|
Uuid string `json:"uuid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LoginOutReq struct {
|
||||||
|
Username string `json:"username"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RefreshUserReq struct {
|
||||||
|
Uuid string `json:"uuid"`
|
||||||
|
Username string `json:"username"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LoginReq struct {
|
||||||
|
Username string `json:"username"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
type get_rs_resp struct {
|
||||||
|
Data []Repair_state `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Repair_state struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
Rs string `json:"rs"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type cal_completion_date_resp struct {
|
||||||
|
Completion_date string `json:"completion_date"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_ma_username_resp struct {
|
||||||
|
Data []string `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_p_name_resp struct {
|
||||||
|
P_name string `json:"p_name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_p_id_options_resp struct {
|
||||||
|
Data []string `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_ma_plan_resp struct {
|
||||||
|
Data []pp_plan `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_process_resp struct {
|
||||||
|
Data []process_info `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type process_info struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
P_id string `json:"p_id"`
|
||||||
|
Process_name string `json:"process_name"`
|
||||||
|
Process_t string `json:"process_t"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type upload_resp struct {
|
||||||
|
Ret int `json:"ret"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type get_pf_Resp struct {
|
||||||
|
Data []plan_file `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type plan_file struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
P_id string `json:"p_id"`
|
||||||
|
P_name string `json:"p_name"`
|
||||||
|
Plan_name string `json:"plan_name"`
|
||||||
|
|
||||||
|
Plan_process_file string `json:"plan_process_file"`
|
||||||
|
Filing_time string `json:"filing_time"`
|
||||||
|
Filing_user string `json:"filing_user"`
|
||||||
|
Project_file string `json:"project_file"`
|
||||||
|
P_filing_time string `json:"p_filing_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type import_p_resp PostUserResp
|
||||||
|
|
||||||
|
type del_p_resp PostUserResp
|
||||||
|
|
||||||
|
type post_p_resp PostUserResp
|
||||||
|
|
||||||
|
type get_p_Resp struct {
|
||||||
|
Data []p_sap `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type p_sap struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
P_id string `json:"p_id"`
|
||||||
|
P_name string `json:"p_name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type download_file_Resp struct {
|
||||||
|
FileId string `json:"fileId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type getUserNamesResp struct {
|
||||||
|
Names []usernams `json:"names"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type usernams struct {
|
||||||
|
Value string `json:"value"`
|
||||||
|
Label string `json:"label"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PostUserResp struct {
|
||||||
|
Ret int `json:"r"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetMenuResp struct {
|
||||||
|
MenuData []GetMenuRespData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Svg struct {
|
||||||
|
First string `json:"first"`
|
||||||
|
Second string `json:"second"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetMenuRespData struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Class string `json:"classname"`
|
||||||
|
SvgData Svg `json:"svg"`
|
||||||
|
Index string `json:"index"`
|
||||||
|
Key string `json:"key"`
|
||||||
|
Items []menuItem `json:"items"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type menuItem struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Index string `json:"index"`
|
||||||
|
Key string `json:"key"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LoginResp struct {
|
||||||
|
Ret int `json:"r"`
|
||||||
|
Uuid string `json:"uuid"`
|
||||||
|
RoleId int `json:"roleid"`
|
||||||
|
Url string `json:"url"`
|
||||||
|
DId int `json:"did"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetUsersResp struct {
|
||||||
|
Data []useInfo `json:"data"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type useInfo struct {
|
||||||
|
Userid int `json:"userid"`
|
||||||
|
Username string `json:"username"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
RoleName string `json:"rolename"`
|
||||||
|
RoleId int `json:"roleid"`
|
||||||
|
Department string `json:"department"`
|
||||||
|
DepartmentId int `json:"departmentid"`
|
||||||
|
State string `json:"state"`
|
||||||
|
|
||||||
|
If_buyer int `json:"if_buyer"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CommonResp struct {
|
||||||
|
Ret int `json:"r"`
|
||||||
|
Context string `json:"context"`
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,33 @@
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
2436003019405186
|
||||||
|
|
||||||
|
今日工作计划:
|
||||||
|
一、项目及任务工作
|
||||||
|
1. PRJ2203软件及数据平台建设项目WEB
|
||||||
|
1.1 清理云平台异常数据。
|
||||||
|
1.2 电池统计算法优化,今天完成。
|
||||||
|
1.3 温度版面样式修改和主界面保持一致,中文版今天完成。
|
||||||
|
2.项目管理软件*
|
||||||
|
2.1 三级目录立项建议书界面审批功能编写,明天完成。
|
||||||
|
2.2 过程记录保存业务业务梳理,完成时间6月28日。
|
||||||
|
3.采购软件
|
||||||
|
3.1 质量标准/验收标准采用上传附件,今天完成。
|
||||||
|
4.生产软件
|
||||||
|
4.1 导入乱码定位修改,今天完成。
|
||||||
|
5.其他
|
||||||
|
公司网站更新MWD。
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
陀螺:
|
||||||
|
如果是5511,就用LHE2031B
|
||||||
|
如果是3111C 就用LHE2031A
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
最深进尺 9,300米 深地一号
|
||||||
|
最长水平进尺 5,060米 长庆油田华H90-3井
|
||||||
|
最大排量
|
||||||
|
最大密度
|
||||||
|
最大压力
|
||||||
|
最高温度 220℃ 千探1井
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
订单日期,编码,部门,计划/项目号,产品编号,产品名称,数量,需求日期,RDM,交付人,承诺到料,生产班组,派产数量,计划派产日期,承诺完成日期,实际完成日期,超期,生产状态,编程状态,工序,工时,准备时间,编程时间,生产人员,派产数量,计划派产日期,计划完成日期,实际完成日期,超期天数
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"database/sql"
|
||||||
|
|
||||||
|
"github.com/astaxie/beego/logs"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_cache_data map[string]plan_file
|
||||||
|
file_cache_time string
|
||||||
|
|
||||||
|
file_ch chan int
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
file_cache_data = make(map[string]plan_file)
|
||||||
|
file_cache_time = "2023-01-01 00:00:00"
|
||||||
|
|
||||||
|
file_ch = make(chan int, 100)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func sync_file_cache() {
|
||||||
|
|
||||||
|
var sqlstr string
|
||||||
|
var rdRow *sql.Rows
|
||||||
|
var err error
|
||||||
|
|
||||||
|
sqlstr = fmt.Sprintf("select [ID],[p_id],[p_name],[plan_name],[process_file],[filing_time],[project_file],[p_filing_time],[op_time] from [plan_file] order by ID asc")
|
||||||
|
fmt.Println(sqlstr)
|
||||||
|
|
||||||
|
rdRow, err = sqlConn.Query(sqlstr)
|
||||||
|
if err != nil {
|
||||||
|
logs.Error(fmt.Sprintf("sync_file_cache Query err:%v", err.Error()))
|
||||||
|
goto exit
|
||||||
|
}
|
||||||
|
|
||||||
|
for rdRow.Next() {
|
||||||
|
var d plan_file
|
||||||
|
var op_t string
|
||||||
|
if err := rdRow.Scan(&d.ID, &d.P_id, &d.P_name, &d.Plan_name, &d.Plan_process_file, &d.Filing_time, &d.Project_file, &d.P_filing_time, &op_t); err == nil {
|
||||||
|
file_cache_data[d.P_id+d.Plan_name] = d
|
||||||
|
|
||||||
|
if op_t > file_cache_time {
|
||||||
|
file_cache_time = op_t
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logs.Error("sync_file_cache scan Error", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rdRow.Close()
|
||||||
|
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-file_ch:
|
||||||
|
sqlstr = fmt.Sprintf("select [ID],[p_id],[p_name],[plan_name],[process_file],[filing_time],[project_file],[p_filing_time],[op_time] from [plan_file] where [op_time]>'%s' order by ID asc", file_cache_time)
|
||||||
|
fmt.Println(sqlstr)
|
||||||
|
|
||||||
|
rdRow, err = sqlConn.Query(sqlstr)
|
||||||
|
if err != nil {
|
||||||
|
logs.Error(fmt.Sprintf("sync_file_cache Query err:%v", err.Error()))
|
||||||
|
} else {
|
||||||
|
for rdRow.Next() {
|
||||||
|
var d plan_file
|
||||||
|
var op_t string
|
||||||
|
if err := rdRow.Scan(&d.ID, &d.P_id, &d.P_name, &d.Plan_name, &d.Plan_process_file, &d.Filing_time, &d.Project_file, &d.P_filing_time, &op_t); err == nil {
|
||||||
|
file_cache_data[d.P_id+d.Plan_name] = d
|
||||||
|
|
||||||
|
if op_t > file_cache_time {
|
||||||
|
file_cache_time = op_t
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logs.Error("sync_file_cache scan Error", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rdRow.Close()
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DeesUserStat struct {
|
||||||
|
Uuid string `json:"uuid"`
|
||||||
|
Username string `json:"username"`
|
||||||
|
State int `json:"state"`
|
||||||
|
RefreshTime time.Time `json:"refreshTime"`
|
||||||
|
ExpireTime time.Time `json:"expireTime"`
|
||||||
|
UserRole int `json:"userrole"`
|
||||||
|
|
||||||
|
lck sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DeesUserStat) Lock() {
|
||||||
|
d.lck.Lock()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DeesUserStat) Unlock() {
|
||||||
|
d.lck.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DeesUserStat) RLock() {
|
||||||
|
d.lck.RLock()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DeesUserStat) RUnlock() {
|
||||||
|
d.lck.RUnlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
deesUserStatMap map[string]*DeesUserStat
|
||||||
|
|
||||||
|
deesUserStatMaplck sync.RWMutex
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
deesUserStatMap = make(map[string]*DeesUserStat)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue