Source language: Translate to:

Alguien me puede explicar esto?

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Alguien me puede explicar esto?

Postby gusgusl » Thu Dec 29, 2016 7:03 pm

Tengo una base online MYSQL y tengo otra base local ,ambas son identicas, con los mismos campos
I have a MYSQL online base and I have another local base, both are identical, with the same fields
Necesito agregar registros a la base local y cada cierto tiempo hacer un update a la base online de los registros nuevos ingresados
I need to add records to the local database and from time to time make an update to the online database of new registrations entered

Otra pregunta, como trabaja NeoDBPpro cuando se usa conexion a una base MYSQL, que pasa si se pierde la conexion y justo se ingreso un registro:
Another question, how does NeoDBPpro work when using connection to a base MYSQL, what happens if the connection is lost and just a record is entered:

. se pierde ese registro por no tener conexion a la base
That record is lost because it has no connection to the base

. queda en estandby hasta que se restablezca la conexion con la base y se agrega el registro
Stays in standby until the connection to the base is restored and the registry is added
gusgusl
 
Posts: 254
Joined: Fri Mar 12, 2010 12:44 pm

Re: Alguien me puede explicar esto?

Postby Gaev » Fri Dec 30, 2016 7:44 am

gusgul:

I need to add records to the local database and from time to time make an update to the online database of new registrations entered

I don't know of any automated method of "sync'ing" two databases ... but you can achieve this yourself ... the best approach depends on a number of factors ...

1) is it just one Database Table that needs to be sync'ed ... or many ?

2) how many total records and how many would need to be sync'ed each time ?

3) is it just records added or also records that are updated ?

... some of the approaches would be ...

1) create a local Table of "logs" to record every addition (or update) on the local Table ... then use this Log to sync the remote Table

2) if not a huge Table, just read every local record and compare (exist/changed ?) with remote Table

3) if additions only, keep an ID of the last "sync'ed" record ... so you can loop through remaining "unsync'ed" records ... one record at a time

... of note, dbpRecordToVar and dbpVarToRecord will come in handy in adding/updating all fields in a single record
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Alguien me puede explicar esto?

Postby virger » Fri Dec 30, 2016 10:01 am

En realidad es algo como esto:

1) Nuevo Registro
FileWrite "Nuevos.Log" "Append" "IdRegistro" o bien
FileWrite "Nuevos.Log" "Append" "NumRegistro"

2) Update Registro
FileWrite "Actualiza.Log" "Append" "IdRegistro~Campo1~Campo2'~Campo..."

3) Borra Registro
FileWrite "Borrados.Log" "Append" "IdRegistro"

SE DESEA SINCRONIZAR/ACTUALIZAR BASE_ONLINE

NUEVOS
FileLen "Nuevos.Log" "Size"
Loop
FileRead "Nuevos.Log" "Id/NumRegistro"
Leer Base Local el 'RECORD'
(usando dbpRecordToVar (Local) y dbpVarToRecord (OnLine))
MYSQL "INCLUIR E BASE ONLINE EL 'RECORD'"
EndLoop

ACTUALIZADOS
FileLen "Actualiza.Log" "Size"
Loop Lineas
FileRead "Actualiza.Log" "Linea" "LosCampos"
StrParse "LosCampos" "~" "Campo"
SetVar "ElRegistro" "CAMPO1"
Loop CualesCampos a partir de 2
Leer de 'ElRegistro' el Campo# de Local En DATA
MYSQL_ONLINE "ACTUALIZAR 'ElRegistro' el Campo# con DATA
EndLoop CualesCampos
EndLoop Lineas

BORRADOS
FileLen "Borrados.Log" "Size"
Loop Borrados
MYSQL_ONLINE 'DELETE Registro#
EndLoop Borrados

AJUSTAR
PACK BASE_ONLINE
PACK BASE_LOCAL

BORRAR LOS FILES *.LOG

Ahora te toca a ti.
FELICES FIESTAS
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 518
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Alguien me puede explicar esto?

Postby Gaev » Fri Dec 30, 2016 10:11 am

gusgul:

If you do NOT want to expose your Database content (as with text files containing logs of added/updated records), you can save the "log information" in separate Database Tables within the same (hopefully secure) Database that holds the Main Table(s) ... e.g. Accounts and AccountsLog, Sales and SalesLog etc..
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Alguien me puede explicar esto?

Postby gusgusl » Fri Dec 30, 2016 11:00 am

Otra pregunta, como trabaja NeoDBPpro cuando se usa conexion a una base MYSQL, que pasa si se pierde la conexion y justo se ingreso un registro:
Another question, how does NeoDBPpro work when using connection to a base MYSQL, what happens if the connection is lost and just a record is entered:

. se pierde ese registro por no tener conexion a la base
That record is lost because it has no connection to the base

. queda en estandby hasta que se restablezca la conexion con la base y se agrega el registro
Stays in standby until the connection to the base is restored and the registry is added
gusgusl
 
Posts: 254
Joined: Fri Mar 12, 2010 12:44 pm


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest