1
BEGIN
2
PREPARE STMT FROM
3
"Select a.DeviceID, b.Name, a.IPAddress, a.Name, a.Description, a.OpenPorts, a.Identity, a.NetBIOS, a.MAC, a.OS, a.IPAddress, a.SNMPComm, a.ComputerID from networkdevices a LEFT OUTER JOIN Locations b ON b.locationid = a.locationid where
4
(
5
a.DeviceID like concat('%',?,'%') or
6
b.Name like concat('%',?,'%') or
7
a.Name like concat('%',?,'%') or
8
a.Description like concat('%',?,'%') or
9
a.OpenPorts like concat('%',?,'%') or
10
a.Identity like concat('%',?,'%') or
11
a.MAC like concat('%',?,'%') or
12
a.OS like concat('%',?,'%') or
13
a.IPAddress like concat('%',?,'%') or
14
a.SNMPComm like concat('%',?,'%') or
15
a.NetBIOS like concat('%',?,'%')
16
) and b.clientid in (Select clientid From UserSec Where UserID=?)
17
order by a.Name ASC, b.Name ASC
18
Limit ?,?";
19
SET @LIMIT = (page * pagesize) - pagesize;
20
SET @s = search;
21
SET @size = pagesize;
22
SET @U = userid;
23
EXECUTE STMT USING @s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@U,@LIMIT,@size;
24
END