1
BEGIN
2
PREPARE STMT FROM
3
"Select a.ComputerID, b.Name, a.Name as CompName, a.Domain, a.UserName, a.LastUserName, a.OS, a.WinDir, a.Version, a.Biosname, a.BiosVer, a.BiosMFG, a.BiosFlash, a.TotalMemory, a.LocalAddress, a.RouterAddress, a.AssetTag, a.Comment,v.Name, a.MAC, a.ServiceVersion, a.DNSInfo, a.Shares
4
from computers a join clients b on a.clientid = b.clientid
5
left Join virusscanners v on a.VirusScanner=v.vscanid
6
where
7
(
8
a.ComputerID like CONCAT('%', ?, '%') or
9
b.Name like CONCAT('%', ?, '%') or
10
a.Name like CONCAT('%', ?, '%') or
11
a.UserName like CONCAT('%', ?, '%') or
12
a.ServiceVersion like CONCAT('%', ?, '%') or
13
a.MAC like CONCAT('%', ?, '%') or
14
a.LocalAddress like CONCAT('%', ?, '%') or
15
a.RouterAddress like CONCAT('%', ?, '%')
16
) and a.computerid in (Select ComputerID From UserSec Where UserID=?)
17
order by b.Name ASC, a.Name ASC
18
LIMIT ?,?";
19
SET @LIMIT = (page * pagesize) - pagesize;
20
SET @size = pagesize;
21
SET @s = search;
22
SET @U = userid;
23
EXECUTE STMT USING @s,@s,@s,@s,@s,@s,@s,@s,@U,@LIMIT,@size;
24
END