levylabpitt / LV-Data

Collection of LabVIEW VIs to read and write lab data.
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

PGSQL garbage collection #85

Closed ciozi137 closed 2 years ago

ciozi137 commented 2 years ago

Running new Multichannel Lockin creates too many connections to PGSQL database. Why? Because get all Array is empty??

ciozi137 commented 2 years ago

image ?????

ciozi137 commented 2 years ago

The problem happens if either path is empty or "" and data is empty variant:

image Results in SQL code like: INSERT INTO (time,) VALUES('2022-03-09 14:41:08.147181'::timestamp,); Valid INSERT: INSERT INTO llab_040(time,d003) VALUES('2022-03-09 14:50:20.725718'::timestamp,0);

Fix:

  1. Do not create INSERT statement when path is empty and data is empty
  2. Execute SQL needs to have better logic:

image

  1. If Execute Command produces an error (at probe 8) due to bad SQL statement, the subsequent close statement will not work (because of incoming error)

AND

  1. The loop appears to run more than 2x (possibly 3x)
ciozi137 commented 2 years ago

Fix 1: image

Fix 2: image

ciozi137 commented 2 years ago

Apply same fixes to Push Backup to DB.vi

ciozi137 commented 2 years ago

Change Format SQL INSERT.vi fix:

image