mirror of
https://github.com/ovh/the-bastion.git
synced 2025-02-27 09:04:13 +08:00
chore: more readable version of sql statements
Signed-off-by: Stéphane Lesimple <stephane.lesimple+bastion@ovhcloud.com>
This commit is contained in:
parent
d9d77f5e71
commit
3b37242317
1 changed files with 6 additions and 5 deletions
|
@ -294,18 +294,19 @@ sub _sql_log_insert_file {
|
|||
my $prepare;
|
||||
my @execute;
|
||||
if ($sqltype eq 'local') {
|
||||
$prepare =
|
||||
"INSERT INTO connections"
|
||||
. "(uniqid,timestamp,timestampusec,account,cmdtype,allowed,hostfrom,ipfrom,portfrom,bastionip,bastionport,hostto,ipto,portto,user,plugin,params,comment,ttyrecfile)"
|
||||
. "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
@execute = (
|
||||
$uniqid, $timestamp, $timestampusec, $account, $cmdtype, $allowed, $hostfrom, $ipfrom, $portfrom, $bastionip,
|
||||
$bastionport, $hostto, $ipto, $portto, $user, $plugin, $params, $comment, $ttyrecfile
|
||||
);
|
||||
$prepare =
|
||||
"INSERT INTO connections"
|
||||
. "(uniqid,timestamp,timestampusec,account,cmdtype,allowed,hostfrom,ipfrom,portfrom,bastionip,bastionport,hostto,ipto,portto,user,plugin,params,comment,ttyrecfile)"
|
||||
. 'VALUES ('
|
||||
. ('?,' x (@execute - 1)) . '?)';
|
||||
}
|
||||
elsif ($sqltype eq 'global') {
|
||||
$prepare = "INSERT INTO connections_summary (uniqid,timestamp,account,cmdtype,allowed,ipfrom,ipto,portto,user,plugin)" . "VALUES (?,?,?,?,?,?,?,?,?,?)";
|
||||
@execute = ($uniqid, $timestamp, $account, $cmdtype, $allowed, $ipfrom, $ipto, $portto, $user, $plugin);
|
||||
$prepare = "INSERT INTO connections_summary (uniqid,timestamp,account,cmdtype,allowed,ipfrom,ipto,portto,user,plugin)" . 'VALUES (' . ('?,' x (@execute - 1)) . '?)';
|
||||
}
|
||||
|
||||
# prepare insertion on db
|
||||
|
|
Loading…
Reference in a new issue