我正在尝试执行与import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
import inet.node.ethernet.Eth100M;
import inet.node.inet.Router;
import inet.node.inet.StandardHost;
import inet.node.inet.WirelessHost;
import inet.node.wireless.AccessPoint;
import inet.physicallayer.contract.packetlevel.IPathLoss;
import inet.physicallayer.contract.packetlevel.IPropagation;
import inet.physicallayer.ieee80211.packetlevel.Ieee80211ScalarRadioMedium;
import inet.visualizer.contract.IIntegratedVisualizer;
network WLANClientAPServerWLSNoLoss
{
@display("bgb=2000,500;bgg=100,2,grey95;bgs=1,m");
submodules:
visualizer: <default("IntegratedCanvasVisualizer")> like IIntegratedVisualizer if hasVisualizer() {
parameters:
@display("p=100,50");
}
configurator: IPv4NetworkConfigurator {
parameters:
assignDisjunctSubnetAddresses = false;
@display("p=100,150");
}
radioMedium: Ieee80211ScalarRadioMedium {
parameters:
@display("p=100,250");
}
wirelessHost1: WirelessHost {
parameters:
@display("p=250,250");
}
accessPoint: AccessPoint {
parameters:
@display("p=500,250");
}
server: WirelessHost {
parameters:
@display("p=1500,250");
}
connections:
}
INI File
[General]
fname-append-host = false
network = WLANClientAPServerWLSNoLoss
sim-time-limit = 25s
**.param-record-as-scalar = true
*.physicalEnvironment.ground.typename = "FlatGround"
**.constraintAreaMinX = 0m
**.constraintAreaMinY = 0m
**.constraintAreaMaxX = 1500m
**.constraintAreaMaxY = 500m
**.constraintAreaMinZ = 0m
**.constraintAreaMaxZ = 0m
**.mobility.typename = "StationaryMobility"
*.wirelessHost1.initialX=0m
*.wirelessHost1.mobility.initialY=0m
*.accessPoint.mobility.initialX = 250m
*.accessPoint.mobility.initialY = 0m
*.server.initialX=1250m
*.server.initialY=0m
*.radioMedium.pathLoss.typename = "FreeSpacePathLoss"
*.wirelessHost1.pathloss.typename="FreeSpacePathLoss"
*.server.pathloss.typename="FreeSPacePathLoss"
**.visualizer.mediumVisualizer.displaySignals = true
**.addDefaultRoutes = false
**.wirelessHost1.numUdpApps = 1
**.wirelessHost1.udpApp[0].typename = "UDPBasicApp"
**.wirelessHost1.udpApp[0].localPort=1000
**.wirelessHost1.udpApp[0].destAddresses="server"
**.wirelessHost1.udpApp[0].destPort=3000
**.wirelessHost1.udpApp[0].messageLength=100000B
**.wirelessHost1.udpApp[0].sendInterval=1s
**.wirelessHost1.udpApp[0].sentPk.statistic-recording = true
**.server.numUdpApps = 1
**.server.udpApp[*].typename="UDPEchoApp"
**.server.udpApp[*].localPort = 3000
**.server.udpApp[*].echoedPk.statistic-recording = true
**.wlan[*].bitrate = 1Mbps
**.initialZ = 0
中的SQL
类似的事情:
DQL
我得到了似乎可行的方法,但我对此表示严重怀疑。你怎么看?
SELECT * FROM TBL
WHERE (something = foo AND something2 = foo2)
OR (something3 = foo3 AND something4 = foo4)
答案 0 :(得分:0)
您可以使用$em->createQuery
方法
$query = $em->createQuery('SELECT t FROM Tbl t WHERE (t.something = :foo AND t.something2 = :foo2) OR (t.something3 = :foo3 AND t.something4 = :foo4)');
$query->setParameter(...);
$result = $query->getResult();
答案 1 :(得分:0)
您的疑问是正确的,您可能会在当前代码中遇到操作员优先的问题,要编写具有分组条件的等效查询,可以编写如下内容
->where(
$qb->expr()->orX(
$qb->expr()->andX(
$qb->expr()->eq('something', ':foo'),
$qb->expr()->eq('something2', ':foo2')
),
$qb->expr()->andX(
$qb->expr()->eq('something3', ':foo3'),
$qb->expr()->eq('something4', ':foo4')
)
)
)
->setParameter('foo', $fooValue)
->setParameter('foo2', $fooValue2)
->setParameter('foo3', $fooValue3)
->setParameter('foo4', $fooValue4)
->getQuery()
->getArrayResult();
Doctrine Query Builder nested orX and andX conditions with join