FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
Translates records from a local HFSQL table to a remote one.
Translates records from a local HFSQL table to a remote one.
Débuté par Enrique A., 02 sep. 2014 22:02 - 2 réponses
Connectez-vous…
Enrique A.
#1
Posté le 02 septembre 2014 - 22:02
Hi people. I would like to optimize a process (WX19) which translates records from a local HFSQL table to a remote one, both identical in structure. Data can be as large as 500,000 records.
The connection between both tables is stablished using the internet.
The local table has an active filter (Control=0) in order to have the records that need to be exported or migrated to the remote table
Once each local record is migrated to the remote table the local table is marked as exported setting the field Control=1
Thanks in advance.
Sample code to optimize:
HDeactivateFilter(Facturas_Totales)
HFilter(Facturas_Totales,Control,0)
HReadFirst(Facturas_Totales)
WHILE NOT HOut(Facturas_Totales)
HCopyRecord(Facturas_Totales_R,Facturas_Totales)
HAdd(Facturas_Totales_R)
Facturas_Totales.Control=1
HModify(Facturas_Totales)
HReadNext(Facturas_Totales)
END
HDeactivateFilter(Facturas_Totales)?
Signaler
0
0
Novica Njagojevic
#2
Posté le 03 septembre 2014 - 01:15
Here is the way i duplicate the database or load the database from hf to sqlite and copy
it to smartphone. You could also copy one database hf to another hf or mysql just
change the provider.
suppose you have allready defined connection and opened it.
sFiles is string = "list of filenames extracted from analyse or harcoded delimited by " + TAB + "tabs"
ctnewdb is Connection
ctnewdb..Provider =hNativeAccessSQLite
ctnewdb..Access =hOReadWrite
ctnewdb..Server = "newdatabasename.db" // new database hf sql or whatever
ctnewdb..User = ""
ctnewdb..Password = ""
ctnewdb..Database = ""
HSetTrigger(False)
IF HOpenConnection(ctnewdb) THEN
ELSE
RETURN
END
dsFajl is Data Source
FOR EACH STRING sName OF sFiles SEPARATED BY TAB
SQLTransaction(sqlStart,ctnewdb)
IF HExecuteSQLQuery(dsFajl, hQueryDefault, "SELECT * FROM " + sName) THEN
ELSE
Info(HErrorInfo(hErrFullDetails))
END
IF HChangeConnection(sName,ctnewdb) THEN
IF HCreationIfNotFound(sName) THEN
ELSE
Info(HErrorInfo(hErrFullDetails))
END
END
FOR EACH dsFajl
HReset(sName)
HCopyRecord(sName,dsFajl,hCopyAutoId+hDefaultVal)
IF HAdd(sName) THEN
ELSE
IF HErrorDuplicates() THEN
Info(HErrorInfo(hErrFullDetails))
ELSE
END
END
END
SQLTransaction(sqlCommit,ctnewdb)
HCancelDeclaration(dsFajl)
END
HConnectionClose(ctnewdb)
HSetTrigger(True)
Signaler
0
0
Enrique A.
#3
Posté le 03 septembre 2014 - 18:29
Hi Novica
Thank you for your help.
I will analize the code.
Regards,
Enrique
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte