| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use oEdtk; | ||
| 6 | use oEdtk::Main; | ||
| 7 | use oEdtk::Config qw(config_read); | ||
| 8 | use oEdtk::DBAdmin qw(db_connect csv_import); | ||
| 9 | my $header = 'ED_SEQLOT,ED_LOTNAME,ED_DTPRINT,ED_DTPOST,ED_NBFACES,ED_NBPLIS,ED_DTPOST2'; | ||
| 10 | |||
| 11 | if ( @ARGV < 1 or $ARGV[0] =~ /-h/i ) { | ||
| 12 | warn "Usage: $0 <acq_file>\n"; | ||
| 13 | warn "\n\tThis will import csv acq file into acq table.\n"; | ||
| 14 | warn "\tcsv import file should have this structure :\n $header\n"; | ||
| 15 | exit 1; | ||
| 16 | } | ||
| 17 | |||
| 18 | my $cfg = config_read('EDTK_DB'); | ||
| 19 | my $dbh = db_connect( $cfg, 'EDTK_DBI_DSN', { AutoCommit => 1, RaiseError => 1 } ); | ||
| 20 | |||
| 21 | csv_import( | ||
| 22 | $dbh, | ||
| 23 | "EDTK_ACQ", | ||
| 24 | $ARGV[0], | ||
| 25 | { | ||
| 26 | mode => 'merge', | ||
| 27 | header => $header | ||
| 28 | } | ||
| 29 | ); | ||
| 30 | |||
| 31 | 1; |