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.Domain like CONCAT('%', ?, '%') or
12
a.UserName like CONCAT('%', ?, '%') or
13
a.LastUserName like CONCAT('%', ?, '%') or
14
a.OS like CONCAT('%', ?, '%') or
15
a.WinDir like CONCAT('%', ?, '%') or
16
a.Version like CONCAT('%', ?, '%') or
17
a.BiosName like CONCAT('%', ?, '%') or
18
a.BiosVer like CONCAT('%', ?, '%') or
19
a.BiosMFG like CONCAT('%', ?, '%') or
20
a.BiosFlash like CONCAT('%', ?, '%') or
21
a.ServiceVersion like CONCAT('%', ?, '%') or
22
a.DNSInfo like CONCAT('%', ?, '%') or
23
a.TotalMemory like CONCAT('%', ?, '%') or
24
a.LocalAddress like CONCAT('%', ?, '%') or
25
a.RouterAddress like CONCAT('%', ?, '%') or
26
a.UserAccounts like CONCAT('%', ?, '%') or
27
a.MAC like CONCAT('%', ?, '%') or
28
a.Shares like CONCAT('%', ?, '%') or
29
a.AssetTag like CONCAT('%', ?, '%') or
30
a.Comment like CONCAT('%', ?, '%') or
31
v.Name like CONCAT('%', ?, '%')
32
) and a.computerid in (Select ComputerID From UserSec Where UserID=?)
33
order by b.Name ASC, a.Name ASC
34
LIMIT ?,?";
35
SET @LIMIT = (page * pagesize) - pagesize;
36
SET @size = pagesize;
37
SET @s = search;
38
SET @U = userid;
39
EXECUTE STMT USING @s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@U,@LIMIT,@size;
40
END