package client_test import ( "testing" "time" "git.wecise.com/wecise/odb-go/odbc" "github.com/stretchr/testify/assert" //"git.wecise.com/wecise/odbserver/odb/upsertupsert" ) func TestMultiStatements(t *testing.T) { var err error client := odbc.ODBC() defer func() { client.Close() }() _, err = client.Query(`insert into /test/bucketpromdb (id, prom) values (?, ?)`, "bucketpromdb:wecise11", []map[string]interface{}{{"__name__": "key1", "__value__": 2, "__timestamp__": "2024-08-27 11:24:17", "disk": "/opt/matrix", "CPU": "CPU1"}}).Do() if !assert.Nil(t, err, err) { return } _, err = client.Query(` insert into /cache/nalerts_status (acknowledged, admin, adminphone, agent, alarmkey, alarmtype, alertgroup, alertkey, alertsubtype, alerttype, area, bname, bsm_classname, bsm_identity, bsm_subidentity, businessimpact, bussinesscategory, causetype, ccpc, ccpcbank, chineseflag, ciid, cmdbenrichstatus, cname, cnsummary, contact, contactman, contactphone, corrscore, customer, deviceios, devicelocation, devicemodel, devicepurpose, devicetype, domaingroup, domainsubgroup, duration, emailstatus, entity, eventclass, eventid, eventstatus, eventtime, eventtype, evtproccode, expiretime, explain, extendedattr, firstoccurrence, flag, flash, grade, id, identifier, idname, impactflag, instance, internallast, itmdisplayitem, lastoccurrence, localnodealias, localobjrelate, localpriobj, localrootobj, localsecobj, localtertobj, location, logticket, lpar, machineid, maintainstatus, maintenance, manager, market, msg_id, n_maintenance_status, name, netype, nmoscausetype, nmosdomainname, nmosentityid, nmoseventmap, nmosmanagedstatus, nmosobjinst, nmosserial, node, nodealias, nodename, nodetype, objectfullname, oldrow, omni_class, omni_serial, orgcode, originalseverity, ownergid, owneruid, phone, physicalcabinet, physicalcard, physicallocation, physicalport, physicalslot, plateng, platform, policylevel, policyname, poll, probesubsecondid, processreq, recordtime, region, remotenodealias, remoteobjrelate, remotepriobj, remoterootobj, remotesecobj, remotetertobj, resolve, rowserial, servername, serverserial, service, servicenowerrorcode, servicenowstate, servicenowsysid, severity, siteid, situationfullname, smsflag, statechange, status, submodel, subsystem, summary, suppressescl, syscode, sysplex, tags, tally, tasklist, ticketstatus, tiggerflag, tsrmflag, ttnumber, ttstate, ttuser, type, upgradeflag, url, x733corrnotif, x733eventtype, x733probablecause, x733specificprob) values (0, '', '', 'Snmp Probe', '', '', 'snmp', 'snmpport_1000', '', '', '', '', '', '', '', 0, '', 0, 0, '', 0, '', 0, '', '', '', '', '', 0, '', '', '', '', '', '', 'snmp', '', 0, 0, '', '', '', 0, '', 0, '', 0, '', '', 1694318500000, 0, 0, 0, '16700997574987680230', 'xxxnode:1.1.1.1', '', 0, '', -6795364578871, '', 1694322269050, '', 0, '', '', '', '', '', 0, '', '', 0, 0, 'Snmp', '', '', 0, '16700997574987680230', '', 0, '', 0, '', 0, 0, '', 'node:1.1.1.1', '', '', '', '', 0, '', 0, '', 0, 0, 0, '', '', '', '', 0, 0, '', '', '', '', 0, 0, 0, 0, '', '', 0, '', '', '', '', '', 0, '', 11223, '', 0, 0, '', 1, '', '', 1, -6795364578871, 120, '', '', 'snmp test event', 0, '', '', null, 28000, 0, '', 0, 0, '', 0, '', 1, 0, '', '', 0, 0, '') ; insert into /cache/nalerts_status (acknowledged, admin, adminphone, agent, alarmkey, alarmtype, alertgroup, alertkey, alertsubtype, alerttype, area, bname, bsm_classname, bsm_identity, bsm_subidentity, businessimpact, bussinesscategory, causetype, ccpc, ccpcbank, chineseflag, ciid, cmdbenrichstatus, cname, cnsummary, contact, contactman, contactphone, corrscore, customer, deviceios, devicelocation, devicemodel, devicepurpose, devicetype, domaingroup, domainsubgroup, duration, emailstatus, entity, eventclass, eventid, eventstatus, eventtime, eventtype, evtproccode, expiretime, explain, extendedattr, firstoccurrence, flag, flash, grade, id, identifier, idname, impactflag, instance, internallast, itmdisplayitem, lastoccurrence, localnodealias, localobjrelate, localpriobj, localrootobj, localsecobj, localtertobj, location, logticket, lpar, machineid, maintainstatus, maintenance, manager, market, msg_id, n_maintenance_status, name, netype, nmoscausetype, nmosdomainname, nmosentityid, nmoseventmap, nmosmanagedstatus, nmosobjinst, nmosserial, node, nodealias, nodename, nodetype, objectfullname, oldrow, omni_class, omni_serial, orgcode, originalseverity, ownergid, owneruid, phone, physicalcabinet, physicalcard, physicallocation, physicalport, physicalslot, plateng, platform, policylevel, policyname, poll, probesubsecondid, processreq, recordtime, region, remotenodealias, remoteobjrelate, remotepriobj, remoterootobj, remotesecobj, remotetertobj, resolve, rowserial, servername, serverserial, service, servicenowerrorcode, servicenowstate, servicenowsysid, severity, siteid, situationfullname, smsflag, statechange, status, submodel, subsystem, summary, suppressescl, syscode, sysplex, tags, tally, tasklist, ticketstatus, tiggerflag, tsrmflag, ttnumber, ttstate, ttuser, type, upgradeflag, url, x733corrnotif, x733eventtype, x733probablecause, x733specificprob) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ; `, 0, "", "", "Snmp Probe", "", "", "snmp", "snmpport_1000", "", "", "", "", "", "", "", 0, "", 0, 0, "", 0, "", 0, "", "", "", "", "", 0, "", "", "", "", "", "", "snmp", "", 0, 0, "", "", "", 0, "", 0, "", 0, "", "", 1694318500000, 0, 0, 0, "16700997574987680230", "xxxnode:1.1.1.1", "", 0, "", -6795364578871, "", 1694322269050, "", 0, "", "", "", "", "", 0, "", "", 0, 0, "Snmp", "", "", 0, "16700997574987680230", "", 0, "", 0, "", 0, 0, "", "node:1.1.1.1", "", "", "", "", 0, "", 0, "", 0, 0, 0, "", "", "", "", 0, 0, "", "", "", "", 0, 0, 0, 0, "", "", 0, "", "", "", "", "", 0, "", 11223, "", 0, 0, "", 1, "", "", 1, -6795364578871, 120, "", "", "snmp test event", 0, "", "", nil, 28000, 0, "", 0, 0, "", 0, "", 1, 0, "", "", 0, 0, "", ).Do() if !assert.Nil(t, err, "prepare 不支持多条语句") { return } _, err = client.Query(` insert into /cache/nalerts_status (acknowledged, admin, adminphone, agent, alarmkey, alarmtype, alertgroup, alertkey, alertsubtype, alerttype, area, bname, bsm_classname, bsm_identity, bsm_subidentity, businessimpact, bussinesscategory, causetype, ccpc, ccpcbank, chineseflag, ciid, cmdbenrichstatus, cname, cnsummary, contact, contactman, contactphone, corrscore, customer, deviceios, devicelocation, devicemodel, devicepurpose, devicetype, domaingroup, domainsubgroup, duration, emailstatus, entity, eventclass, eventid, eventstatus, eventtime, eventtype, evtproccode, expiretime, explain, extendedattr, firstoccurrence, flag, flash, grade, id, identifier, idname, impactflag, instance, internallast, itmdisplayitem, lastoccurrence, localnodealias, localobjrelate, localpriobj, localrootobj, localsecobj, localtertobj, location, logticket, lpar, machineid, maintainstatus, maintenance, manager, market, msg_id, n_maintenance_status, name, netype, nmoscausetype, nmosdomainname, nmosentityid, nmoseventmap, nmosmanagedstatus, nmosobjinst, nmosserial, node, nodealias, nodename, nodetype, objectfullname, oldrow, omni_class, omni_serial, orgcode, originalseverity, ownergid, owneruid, phone, physicalcabinet, physicalcard, physicallocation, physicalport, physicalslot, plateng, platform, policylevel, policyname, poll, probesubsecondid, processreq, recordtime, region, remotenodealias, remoteobjrelate, remotepriobj, remoterootobj, remotesecobj, remotetertobj, resolve, rowserial, servername, serverserial, service, servicenowerrorcode, servicenowstate, servicenowsysid, severity, siteid, situationfullname, smsflag, statechange, status, submodel, subsystem, summary, suppressescl, syscode, sysplex, tags, tally, tasklist, ticketstatus, tiggerflag, tsrmflag, ttnumber, ttstate, ttuser, type, upgradeflag, url, x733corrnotif, x733eventtype, x733probablecause, x733specificprob) values (0, '', '', 'Snmp Probe', '', '', 'snmp', 'snmpport_1000', '', '', '', '', '', '', '', 0, '', 0, 0, '', 0, '', 0, '', '', '', '', '', 0, '', '', '', '', '', '', 'snmp', '', 0, 0, '', '', '', 0, '', 0, '', 0, '', '', 1694318500000, 0, 0, 0, '16700997574987680230', 'xxxnode:1.1.1.1', '', 0, '', -6795364578871, '', 1694322269050, '', 0, '', '', '', '', '', 0, '', '', 0, 0, 'Snmp', '', '', 0, '16700997574987680230', '', 0, '', 0, '', 0, 0, '', 'node:1.1.1.1', '', '', '', '', 0, '', 0, '', 0, 0, 0, '', '', '', '', 0, 0, '', '', '', '', 0, 0, 0, 0, '', '', 0, '', '', '', '', '', 0, '', 11223, '', 0, 0, '', 1, '', '', 1, -6795364578871, 120, '', '', 'snmp test event', 0, '', '', null, 28000, 0, '', 0, 0, '', 0, '', 1, 0, '', '', 0, 0, '') ; insert into /cache/nalerts_status (acknowledged, admin, adminphone, agent, alarmkey, alarmtype, alertgroup, alertkey, alertsubtype, alerttype, area, bname, bsm_classname, bsm_identity, bsm_subidentity, businessimpact, bussinesscategory, causetype, ccpc, ccpcbank, chineseflag, ciid, cmdbenrichstatus, cname, cnsummary, contact, contactman, contactphone, corrscore, customer, deviceios, devicelocation, devicemodel, devicepurpose, devicetype, domaingroup, domainsubgroup, duration, emailstatus, entity, eventclass, eventid, eventstatus, eventtime, eventtype, evtproccode, expiretime, explain, extendedattr, firstoccurrence, flag, flash, grade, id, identifier, idname, impactflag, instance, internallast, itmdisplayitem, lastoccurrence, localnodealias, localobjrelate, localpriobj, localrootobj, localsecobj, localtertobj, location, logticket, lpar, machineid, maintainstatus, maintenance, manager, market, msg_id, n_maintenance_status, name, netype, nmoscausetype, nmosdomainname, nmosentityid, nmoseventmap, nmosmanagedstatus, nmosobjinst, nmosserial, node, nodealias, nodename, nodetype, objectfullname, oldrow, omni_class, omni_serial, orgcode, originalseverity, ownergid, owneruid, phone, physicalcabinet, physicalcard, physicallocation, physicalport, physicalslot, plateng, platform, policylevel, policyname, poll, probesubsecondid, processreq, recordtime, region, remotenodealias, remoteobjrelate, remotepriobj, remoterootobj, remotesecobj, remotetertobj, resolve, rowserial, servername, serverserial, service, servicenowerrorcode, servicenowstate, servicenowsysid, severity, siteid, situationfullname, smsflag, statechange, status, submodel, subsystem, summary, suppressescl, syscode, sysplex, tags, tally, tasklist, ticketstatus, tiggerflag, tsrmflag, ttnumber, ttstate, ttuser, type, upgradeflag, url, x733corrnotif, x733eventtype, x733probablecause, x733specificprob) values (0, '', '', 'Snmp Probe', '', '', 'snmp', 'snmpport_1000', '', '', '', '', '', '', '', 0, '', 0, 0, '', 0, '', 0, '', '', '', '', '', 0, '', '', '', '', '', '', 'snmp', '', 0, 0, '', '', '', 0, '', 0, '', 0, '', '', 1694318500000, 0, 0, 0, '16700997574987680230', 'xxxnode:1.1.1.1', '', 0, '', -6795364578871, '', 1694322269050, '', 0, '', '', '', '', '', 0, '', '', 0, 0, 'Snmp', '', '', 0, '16700997574987680230', '', 0, '', 0, '', 0, 0, '', 'node:1.1.1.1', '', '', '', '', 0, '', 0, '', 0, 0, 0, '', '', '', '', 0, 0, '', '', '', '', 0, 0, 0, 0, '', '', 0, '', '', '', '', '', 0, '', 11223, '', 0, 0, '', 1, '', '', 1, -6795364578871, 120, '', '', 'snmp test event', 0, '', '', null, 28000, 0, '', 0, 0, '', 0, '', 1, 0, '', '', 0, 0, '') ; `).Do() if !assert.Nil(t, err, err) { return } _, err = client.Query(` insert into /cache/nalerts_status (acknowledged, admin, adminphone, agent, alarmkey, alarmtype, alertgroup, alertkey, alertsubtype, alerttype, area, bname, bsm_classname, bsm_identity, bsm_subidentity, businessimpact, bussinesscategory, causetype, ccpc, ccpcbank, chineseflag, ciid, cmdbenrichstatus, cname, cnsummary, contact, contactman, contactphone, corrscore, customer, deviceios, devicelocation, devicemodel, devicepurpose, devicetype, domaingroup, domainsubgroup, duration, emailstatus, entity, eventclass, eventid, eventstatus, eventtime, eventtype, evtproccode, expiretime, explain, extendedattr, firstoccurrence, flag, flash, grade, id, identifier, idname, impactflag, instance, internallast, itmdisplayitem, lastoccurrence, localnodealias, localobjrelate, localpriobj, localrootobj, localsecobj, localtertobj, location, logticket, lpar, machineid, maintainstatus, maintenance, manager, market, msg_id, n_maintenance_status, name, netype, nmoscausetype, nmosdomainname, nmosentityid, nmoseventmap, nmosmanagedstatus, nmosobjinst, nmosserial, node, nodealias, nodename, nodetype, objectfullname, oldrow, omni_class, omni_serial, orgcode, originalseverity, ownergid, owneruid, phone, physicalcabinet, physicalcard, physicallocation, physicalport, physicalslot, plateng, platform, policylevel, policyname, poll, probesubsecondid, processreq, recordtime, region, remotenodealias, remoteobjrelate, remotepriobj, remoterootobj, remotesecobj, remotetertobj, resolve, rowserial, servername, serverserial, service, servicenowerrorcode, servicenowstate, servicenowsysid, severity, siteid, situationfullname, smsflag, statechange, status, submodel, subsystem, summary, suppressescl, syscode, sysplex, tags, tally, tasklist, ticketstatus, tiggerflag, tsrmflag, ttnumber, ttstate, ttuser, type, upgradeflag, url, x733corrnotif, x733eventtype, x733probablecause, x733specificprob) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ; `, 0, "", "", "Snmp Probe", "", "", "snmp", "snmpport_1000", "", "", "", "", "", "", "", 0, "", 0, 0, "", 0, "", 0, "", "", "", "", "", 0, "", "", "", "", "", "", "snmp", "", 0, 0, "", "", "", 0, "", 0, "", 0, "", "", 1694318500000, 0, 0, 0, "16700997574987680230", "xxxnode:1.1.1.1", "", 0, "", -6795364578871, "", 1694322269050, "", 0, "", "", "", "", "", 0, "", "", 0, 0, "Snmp", "", "", 0, "16700997574987680230", "", 0, "", 0, "", 0, 0, "", "node:1.1.1.1", "", "", "", "", 0, "", 0, "", 0, 0, 0, "", "", "", "", 0, 0, "", "", "", "", 0, 0, 0, 0, "", "", 0, "", "", "", "", "", 0, "", 11223, "", 0, 0, "", 1, "", "", 1, -6795364578871, 120, "", "", "snmp test event", 0, "", "", nil, 28000, 0, "", 0, 0, "", 0, "", 1, 0, "", "", 0, 0, "", ).Do() if !assert.Nil(t, err, err) { return } time.Sleep(1 * time.Second) }