K6h dZddlZddlZddlmZddlmZGddeZGddeZGd d eZ Gd d eZ Gd deZ GddZ dS)u  This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.  If not, see . Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see N)ABC) NamedTuplecbeZdZUeed<eed<eed<d dejdefdZ defd Z d Z d Z d S)Table table_namefieldscreate_table_queryconn buffer_sizecX||_||_g|_|dSN)r r buffer create_table)selfr r s P/opt/imunify360/venv/lib/python3.11/site-packages/imav/patchman/fs_scanner/db.py__init__zTable.__init__!s0 &#%  rowct|t|jksJ|j|t|j|jkr|dSdS)z$ Insert with buffer N)lenrrappendr flush)rrs rbuffered_insertzTable.buffered_insert'sl3xx3t{++++++ 3 t{  t/ / / JJLLLLL 0 /rc6d|j}|j5|jd|jd|dddgt |jzd|jdddn #1swxYwYg|_dS)z Flush buffer z, z INSERT INTO z (z ) VALUES (?)N)joinrr executemanyrrr)rrs rrz Table.flush0s4;'' Y   I ! !>' " "  Ig   OG,, 1 I;! ! ! #7 I;# # # -t/FG rc(d|jDdS)z& Flush tables buffers c6g|]}|Sr-)r).0_s r zDB.flush..s )))q)))rN)rQr"s rrzDB.flushs  *)DL))))))rc8|jdSr)r rFr"s rrFzDB.closes rNr#) r$r%r&rDrJr'r,rrrFr-rrrBrBls~ H H H# H H H H*** rrB) __doc__rMr*abcrtypingrrr/r4r9r?rBr-rrr[sL* #7#7#7#7#7C#7#7#7L:        #####:###     5   r