1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| ' Ouverture du fichier trafic_hotspot.txt où sont écrites les lignes de trafic
Set StreamFichierTrafic = fso.OpenTextFile(RepertoireTempLocal + "\xxxxxxx.txt")
' Parcours du fichier
While (Not StreamFichierTrafic.AtEndOfStream)
tuple = StreamFichierTrafic.ReadLine
nbLignes = nbLignes + 1
' on sépare le tuple pour récupérer les champs délimités par ";"
stringSplitted = Strings.Split(tuple, ";")
'première ligne de vérification
If (nbLignes = 1) Then
' la première ligne a le format suivant : DEBUT;date_traitement;NbLignesTrafic
If (StrComp(stringSplitted(0), "DEBUT") = 0) Then
dateTraitement = Format$(stringSplitted(1), "dd/mm/yyyy") + " " + Format(Time, "hh:mm:ss")
NbLignesAttendu = stringSplitted(2)
' on insère la date du traitement dans la table xxxxx avec l'état A = en cours
ConnexionBD.Execute ("INSERT INTO xxxxx VALUES('duTexte','" + dateTraitement + "','A','" + FichierLogs + "')")
Else
'la première ligne de vérification n'est pas valide
Injection_Trafic_BD = "Erreur"
End If
ElseIf (nbLignes > 1) Then
dateInsertion = Format$(stringSplitted(1), "dd/mm/yyyy")
Call Ecriture_Log(stringSplitted(0) + " " + dateInsertion + " " + stringSplitted(2))
' + " " + Format(Time, "hh:mm:ss")
ConnexionBD.Execute ("INSERT INTO Table_xx VALUES ('" + stringSplitted(0) + "','" + dateInsertion + "','" + stringSplitted(2) + "')")
End If
Wend |
Partager