line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2004 Anders Ardö |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify |
4
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
5
|
|
|
|
|
|
|
# the Free Software Foundation; either version 1, or (at your option) |
6
|
|
|
|
|
|
|
# any later version. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
9
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11
|
|
|
|
|
|
|
# GNU General Public License for more details. |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
14
|
|
|
|
|
|
|
# along with this program; if not, write to the Free Software |
15
|
|
|
|
|
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
# NO WARRANTY |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
# BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
21
|
|
|
|
|
|
|
# FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
22
|
|
|
|
|
|
|
# OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
23
|
|
|
|
|
|
|
# PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
24
|
|
|
|
|
|
|
# OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
25
|
|
|
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
26
|
|
|
|
|
|
|
# TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
27
|
|
|
|
|
|
|
# PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
28
|
|
|
|
|
|
|
# REPAIR OR CORRECTION. |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
31
|
|
|
|
|
|
|
# WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
32
|
|
|
|
|
|
|
# REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
33
|
|
|
|
|
|
|
# INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
34
|
|
|
|
|
|
|
# OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
35
|
|
|
|
|
|
|
# TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
36
|
|
|
|
|
|
|
# YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
37
|
|
|
|
|
|
|
# PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
38
|
|
|
|
|
|
|
# POSSIBILITY OF SUCH DAMAGES. |
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# $Id: LogSQL.pm 2 2005-06-22 14:24:52Z anders $ |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
package Combine::LogSQL; |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
2
|
|
1369
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
65
|
|
46
|
2
|
|
|
2
|
|
10
|
use Combine::Config; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
344
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
49
|
1
|
|
|
1
|
0
|
13
|
my ($class, $id) = @_; |
50
|
1
|
|
|
|
|
6
|
my $sv = Combine::Config::Get('MySQLhandle'); |
51
|
0
|
|
|
|
|
|
my $self = { |
52
|
|
|
|
|
|
|
dbcon => $sv, |
53
|
|
|
|
|
|
|
ID => $id, |
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Prepare handles for all SQL statements and save them in %{$self} |
57
|
0
|
|
|
|
|
|
$self->{Say} = $sv->prepare(qq{INSERT DELAYED INTO log SET pid=$$, id='$id', message=?;}); |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
bless $self, $class; |
60
|
0
|
|
|
|
|
|
return $self; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub prefix { |
64
|
0
|
|
|
0
|
0
|
|
my ($self, $message) =@_; |
65
|
0
|
|
|
|
|
|
$self->{'prefix'} = $message . '; '; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub say { |
69
|
0
|
|
|
0
|
0
|
|
my ($self, $message) =@_; |
70
|
0
|
|
|
|
|
|
$self->{Say}->execute($self->{'prefix'} . $message); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |