In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Ayuda, me consume toda la memoria

Foro público de Xailer en español
Responder
Juan Jose
Mensajes: 72
Registrado: Lun Jun 09, 2008 3:43 pm

Ayuda, me consume toda la memoria

Mensaje por Juan Jose »

Hola a todos
Tengo un formularia para poder importar de una dbf a mysql pero me consume
toda la memoria cuando llega alrededor de 2000 registros, y el programa da
un error de windows
Alguien saber como poder hacerlo de forma mas optimizada ò para que no
consuma toda, he probado a cerrar las tablñas y abrilas despues de cada
update pero so surte efecto
Gracias
METHOD BtnImportarClick( oSender ) CLASS FrmImportar
Local nContrato := 0
Local nPersonal := 0
Local nPersonalOmitido := 0
Local nContratoOmitido := 0
Local ECivil
Local Nacionalidad
Local Sexo
Local cVar
oSender:lEnabled := .F.
WITH OBJECT ::oSQLTablePersonal
:oDataSource:= AppData:oServer
:cTableName := "PERSONAL"
:nMaxRecords:= 0
:nLockType := adLockOptimistic
:lOpen := .T.
END WITH
WITH OBJECT ::oSQLTableContrato
:oDataSource:= AppData:oServer
:cTableName := "CONTRATOS"
:nMaxRecords:= 0
:nLockType := adLockOptimistic
:lOpen := .T.
END WITH
WITH OBJECT ::oDbfDataSet1
:GoTop()
While !:Eof()
If !(::oSQLTableContrato:Locate("ORDEN=" +
AllTrim(:aFields[2]:Value)))
::oSQLTableContrato:AddNew()
::oSQLTableContrato:NIF := AllTrim(:aFields[8]:Value)
::oSQLTableContrato:ORDEN := AllTrim(:aFields[2]:Value)
::oSQLTableContrato:TIPOCONTRATO := AllTrim(:aFields[27]:Value)
::oSQLTableContrato:FECHAALTA :=
CtoD(AllTrim(:aFields[4]:Value))
::oSQLTableContrato:FECHABAJA :=
CtoD(AllTrim(:aFields[46]:Value))
::oSQLTableContrato:CAUSA := AllTrim(:aFields[42]:Value)
::oSQLTableContrato:CODIGOCONTRA := AllTrim(:aFields[22]:Value)
::oSQLTableContrato:CATEGORIA := AllTrim(:aFields[29]:Value)
::oSQLTableContrato:CODCATEGORIA := AllTrim(:aFields[28]:Value)
::oSQLTableContrato:VENCPRUEBA :=
CtoD(AllTrim(:aFields[24]:Value))
::oSQLTableContrato:LETRACONTRA := AllTrim(:aFields[26]:Value)
//
::oSQLTableContrato:CENTRO := AllTrim(:aFields[35]:Value)
::oSQLTableContrato:CODCENTRO := AllTrim(:aFields[36]:Value)
::oSQLTableContrato:COEPAGAS := AllTrim(:aFields[34]:Value)
::oSQLTableContrato:BAREMO := AllTrim(:aFields[32]:Value)
::oSQLTableContrato:EMPRESA := AllTrim(:aFields[45]:Value)
::oSQLTableContrato:DELEGACION := AllTrim(:aFields[1]:Value)
::oSQLTableContrato:CUENTACOTIZA := AllTrim(:aFields[44]:Value)
::oSQLTableContrato:CODBAJA := AllTrim(:aFields[41]:Value)
::oSQLTableContrato:JDA := AllTrim(:aFields[33]:Value)
::oSQLTableContrato:GRCOTIZA := AllTrim(:aFields[31]:Value)
::oSQLTableContrato:GRANTIGUEDA := AllTrim(:aFields[30]:Value)
::oSQLTableContrato:DURACIONBAJA := AllTrim(:aFields[43]:Value)
::oSQLTableContrato:FECHAVENCON :=
CtoD(AllTrim(:aFields[23]:Value))
::oSQLTableContrato:UpDate()
nContrato++
::oNoContrato:Value := nContrato
Else
nContratoOmitido++
::oNoContratoOmitido:Value := nContratoOmitido
EndIf
//---------------------------------------------------------
If !(::oSQLTablePersonal:Locate("NIF='" +
AllTrim(:aFields[8]:Value) +"'"))
::oSQLTablePersonal:AddNew()
::oSQLTablePersonal:NIF := AllTrim(:aFields[8]:Value)
::oSQLTablePersonal:AFILIACION := AllTrim(:aFields[7]:Value)
//
::oSQLTablePersonal:APELLIDOS :=
AllTrim(SubStr(:aFields[3]:Value, 1 , AT
("$",:aFields[3]:Value) -1 )) + " " + AllTrim(SubStr(:aFields[3]:Value, AT
("$",:aFields[3]:Value)+1,
(AT(",",:aFields[3]:Value)-AT("$",:aFields[3]:Value) -
1) ))
::oSQLTablePersonal:NOMBRE :=
AllTrim(SubStr(:aFields[3]:Value, AT(",",:aFields
[3]:Value)+1, Len(:aFields[3]:Value) ))
::oSQLTablePersonal:VIA := AllTrim(:aFields[16]:Value)
//
::oSQLTablePersonal:DOMICILIO := AllTrim(:aFields[17]:Value)
;
+", "+
AllTrim(:aFields[18]:Value) // Domicilio
::oSQLTablePersonal:Codigo_Postal:= AllTrim(:aFields[19]:Value)
//
::oSQLTablePersonal:POBLACION := AllTrim(:aFields[20]:Value)
//
::oSQLTablePersonal:PROVINCIA := AllTrim(:aFields[21]:Value)
//
::oSQLTablePersonal:Fecha_Nacimiento :=
CtoD(AllTrim(:aFields[9]:Value)) //
::oSQLTablePersonal:POBLACION_N := AllTrim(:aFields[10]:Value)
//
::oSQLTablePersonal:PROVINCIA_N := AllTrim(:aFields[14]:Value)
//
::oSQLTablePersonal:NOMBRE_P := AllTrim(:aFields[5]:Value)
//
::oSQLTablePersonal:NOMBRE_M := AllTrim(:aFields[6]:Value)
//
::oSQLTablePersonal:TELEFONO_1 := AllTrim(:aFields[15]:Value)
//
Do Case
Case AllTrim(:aFields[13]:Value) = "V"
::oSQLTablePersonal:SEXO := "Varon"
Case AllTrim(:aFields[13]:Value) = "M"
::oSQLTablePersonal:SEXO := "Mujer"
EndCase
::oSQLTablePersonal:Numero_Hijos :=
AllTrim(:aFields[37]:Value) //
Do Case
Case AllTrim(:aFields[11]:Value) = "C"
::oSQLTablePersonal:Estado_C := "Casado/a"
Case AllTrim(:aFields[11]:Value) = "S"
::oSQLTablePersonal:Estado_C := "Soltero/a"
Case AllTrim(:aFields[11]:Value) = "D"
::oSQLTablePersonal:Estado_C := "Divorciado/a"
Case AllTrim(:aFields[11]:Value) = "X"
::oSQLTablePersonal:Estado_C := "P. Hecho"
Case AllTrim(:aFields[11]:Value) = "V"
::oSQLTablePersonal:Estado_C := "Viudo/a"
EndCase
Do Case
Case AllTrim(:aFields[12]:Value) = "ESP"
::oSQLTablePersonal:Nacionalidad := "España"
Case AllTrim(:aFields[12]:Value) = "ITA"
::oSQLTablePersonal:Nacionalidad := "Italia"
Case AllTrim(:aFields[12]:Value) = "MAR"
::oSQLTablePersonal:Nacionalidad := "Marruecos"
EndCase
::oSQLTablePersonal:FechaEA :=
CtoD(AllTrim(:aFields[25]:Value)) //
::oSQLTablePersonal:Numero_Banco := AllTrim(:aFields[47]:Value)
//
::oSQLTablePersonal:Numero_Oficina:= AllTrim(:aFields[39]:Value)
//
::oSQLTablePersonal:Cuenta_Banco := AllTrim(:aFields[38]:Value)
//
::oSQLTablePersonal:DC := AllTrim(:aFields[40]:Value)
//
::oSQLTablePersonal:UpDate()
nPersonal++
::oNoPersonal:Value := nPersonal
Else
nPersonalOmitido++
::oNoPersonalOmitido:Value := nPersonalOmitido
EndIf
::oProgressBar:nValue := :Recno()
:Skip(1)
EndDo
END
RETURN Nil
Avatar de Usuario
jasm
Mensajes: 447
Registrado: Mar Jul 08, 2008 8:12 pm

Ayuda, me consume toda la memoria

Mensaje por jasm »

Juan Jose,
En vez de usar los métodos del dataset de MySQL, contruye y enví­a
mediante el método :Execute() la intrucción INSERT.
Saludos
Alf+.
Juan Jose escribió:
> Hola a todos
>
> Tengo un formularia para poder importar de una dbf a mysql pero me consume
> toda la memoria cuando llega alrededor de 2000 registros, y el programa da
> un error de windows
> Alguien saber como poder hacerlo de forma mas optimizada í² para que no
> consuma toda, he probado a cerrar las tablñas y abrilas despues de cada
> update pero so surte efecto
>
>
> Gracias
>
> METHOD BtnImportarClick( oSender ) CLASS FrmImportar
>
> Local nContrato := 0
> Local nPersonal := 0
> Local nPersonalOmitido := 0
> Local nContratoOmitido := 0
> Local ECivil
> Local Nacionalidad
> Local Sexo
> Local cVar
>
> oSender:lEnabled := .F.
>
> WITH OBJECT ::oSQLTablePersonal
> :oDataSource:= AppData:oServer
> :cTableName := "PERSONAL"
> :nMaxRecords:= 0
> :nLockType := adLockOptimistic
> :lOpen := .T.
> END WITH
>
> WITH OBJECT ::oSQLTableContrato
> :oDataSource:= AppData:oServer
> :cTableName := "CONTRATOS"
> :nMaxRecords:= 0
> :nLockType := adLockOptimistic
> :lOpen := .T.
> END WITH
>
> WITH OBJECT ::oDbfDataSet1
> :GoTop()
> While !:Eof()
> If !(::oSQLTableContrato:Locate("ORDEN=" +
> AllTrim(:aFields[2]:Value)))
> ::oSQLTableContrato:AddNew()
> ::oSQLTableContrato:NIF := AllTrim(:aFields[8]:Value)
> ::oSQLTableContrato:ORDEN := AllTrim(:aFields[2]:Value)
> ::oSQLTableContrato:TIPOCONTRATO := AllTrim(:aFields[27]:Value)
> ::oSQLTableContrato:FECHAALTA :=
> CtoD(AllTrim(:aFields[4]:Value))
> ::oSQLTableContrato:FECHABAJA :=
> CtoD(AllTrim(:aFields[46]:Value))
> ::oSQLTableContrato:CAUSA := AllTrim(:aFields[42]:Value)
> ::oSQLTableContrato:CODIGOCONTRA := AllTrim(:aFields[22]:Value)
> ::oSQLTableContrato:CATEGORIA := AllTrim(:aFields[29]:Value)
> ::oSQLTableContrato:CODCATEGORIA := AllTrim(:aFields[28]:Value)
> ::oSQLTableContrato:VENCPRUEBA :=
> CtoD(AllTrim(:aFields[24]:Value))
> ::oSQLTableContrato:LETRACONTRA := AllTrim(:aFields[26]:Value)
> //
> ::oSQLTableContrato:CENTRO := AllTrim(:aFields[35]:Value)
> ::oSQLTableContrato:CODCENTRO := AllTrim(:aFields[36]:Value)
> ::oSQLTableContrato:COEPAGAS := AllTrim(:aFields[34]:Value)
> ::oSQLTableContrato:BAREMO := AllTrim(:aFields[32]:Value)
> ::oSQLTableContrato:EMPRESA := AllTrim(:aFields[45]:Value)
> ::oSQLTableContrato:DELEGACION := AllTrim(:aFields[1]:Value)
> ::oSQLTableContrato:CUENTACOTIZA := AllTrim(:aFields[44]:Value)
> ::oSQLTableContrato:CODBAJA := AllTrim(:aFields[41]:Value)
> ::oSQLTableContrato:JDA := AllTrim(:aFields[33]:Value)
> ::oSQLTableContrato:GRCOTIZA := AllTrim(:aFields[31]:Value)
> ::oSQLTableContrato:GRANTIGUEDA := AllTrim(:aFields[30]:Value)
> ::oSQLTableContrato:DURACIONBAJA := AllTrim(:aFields[43]:Value)
> ::oSQLTableContrato:FECHAVENCON :=
> CtoD(AllTrim(:aFields[23]:Value))
> ::oSQLTableContrato:UpDate()
> nContrato++
> ::oNoContrato:Value := nContrato
> Else
> nContratoOmitido++
> ::oNoContratoOmitido:Value := nContratoOmitido
> EndIf
> //---------------------------------------------------------
> If !(::oSQLTablePersonal:Locate("NIF='" +
> AllTrim(:aFields[8]:Value) +"'"))
> ::oSQLTablePersonal:AddNew()
> ::oSQLTablePersonal:NIF := AllTrim(:aFields[8]:Value)
> ::oSQLTablePersonal:AFILIACION := AllTrim(:aFields[7]:Value)
> //
> ::oSQLTablePersonal:APELLIDOS :=
> AllTrim(SubStr(:aFields[3]:Value, 1 , AT
> ("$",:aFields[3]:Value) -1 )) + " " + AllTrim(SubStr(:aFields[3]:Value, AT
> ("$",:aFields[3]:Value)+1,
> (AT(",",:aFields[3]:Value)-AT("$",:aFields[3]:Value) -
> 1) ))
> ::oSQLTablePersonal:NOMBRE :=
> AllTrim(SubStr(:aFields[3]:Value, AT(",",:aFields
> [3]:Value)+1, Len(:aFields[3]:Value) ))
> ::oSQLTablePersonal:VIA := AllTrim(:aFields[16]:Value)
> //
> ::oSQLTablePersonal:DOMICILIO := AllTrim(:aFields[17]:Value)
> ;
> +", "+
> AllTrim(:aFields[18]:Value) // Domicilio
> ::oSQLTablePersonal:Codigo_Postal:= AllTrim(:aFields[19]:Value)
> //
> ::oSQLTablePersonal:POBLACION := AllTrim(:aFields[20]:Value)
> //
> ::oSQLTablePersonal:PROVINCIA := AllTrim(:aFields[21]:Value)
> //
> ::oSQLTablePersonal:Fecha_Nacimiento :=
> CtoD(AllTrim(:aFields[9]:Value)) //
> ::oSQLTablePersonal:POBLACION_N := AllTrim(:aFields[10]:Value)
> //
> ::oSQLTablePersonal:PROVINCIA_N := AllTrim(:aFields[14]:Value)
> //
> ::oSQLTablePersonal:NOMBRE_P := AllTrim(:aFields[5]:Value)
> //
> ::oSQLTablePersonal:NOMBRE_M := AllTrim(:aFields[6]:Value)
> //
> ::oSQLTablePersonal:TELEFONO_1 := AllTrim(:aFields[15]:Value)
> //
> Do Case
> Case AllTrim(:aFields[13]:Value) = "V"
> ::oSQLTablePersonal:SEXO := "Varon"
> Case AllTrim(:aFields[13]:Value) = "M"
> ::oSQLTablePersonal:SEXO := "Mujer"
> EndCase
> ::oSQLTablePersonal:Numero_Hijos :=
> AllTrim(:aFields[37]:Value) //
> Do Case
> Case AllTrim(:aFields[11]:Value) = "C"
> ::oSQLTablePersonal:Estado_C := "Casado/a"
> Case AllTrim(:aFields[11]:Value) = "S"
> ::oSQLTablePersonal:Estado_C := "Soltero/a"
> Case AllTrim(:aFields[11]:Value) = "D"
> ::oSQLTablePersonal:Estado_C := "Divorciado/a"
> Case AllTrim(:aFields[11]:Value) = "X"
> ::oSQLTablePersonal:Estado_C := "P. Hecho"
> Case AllTrim(:aFields[11]:Value) = "V"
> ::oSQLTablePersonal:Estado_C := "Viudo/a"
> EndCase
> Do Case
> Case AllTrim(:aFields[12]:Value) = "ESP"
> ::oSQLTablePersonal:Nacionalidad := "España"
> Case AllTrim(:aFields[12]:Value) = "ITA"
> ::oSQLTablePersonal:Nacionalidad := "Italia"
> Case AllTrim(:aFields[12]:Value) = "MAR"
> ::oSQLTablePersonal:Nacionalidad := "Marruecos"
> EndCase
> ::oSQLTablePersonal:FechaEA :=
> CtoD(AllTrim(:aFields[25]:Value)) //
> ::oSQLTablePersonal:Numero_Banco := AllTrim(:aFields[47]:Value)
> //
> ::oSQLTablePersonal:Numero_Oficina:= AllTrim(:aFields[39]:Value)
> //
> ::oSQLTablePersonal:Cuenta_Banco := AllTrim(:aFields[38]:Value)
> //
> ::oSQLTablePersonal:DC := AllTrim(:aFields[40]:Value)
> //
> ::oSQLTablePersonal:UpDate()
> nPersonal++
> ::oNoPersonal:Value := nPersonal
> Else
> nPersonalOmitido++
> ::oNoPersonalOmitido:Value := nPersonalOmitido
> EndIf
> ::oProgressBar:nValue := :Recno()
> :Skip(1)
> EndDo
> END
>
> RETURN Nil
>
>
Juan Jose
Mensajes: 72
Registrado: Lun Jun 09, 2008 3:43 pm

Ayuda, me consume toda la memoria

Mensaje por Juan Jose »

Hola Jose Alfonso
He probado como me has sugerido, Funciona bien pero sigo teniendo el mismo
problema
consume toda la memoria hasta que sale el error de windows
cSelect := "INSERT INTO PERSONAL(ID, NIF, AFILIACION, APELLIDOS,
NOMBRE, VIA, DOMICILIO, Codigo_Postal, POBLACION, PROVINCIA,
Fecha_Nacimiento, POBLACION_N, PROVINCIA_N, NOMBRE_P, NOMBRE_M, TELEFONO_1,
SEXO, Numero_Hijos, Estado_C, Nacionalidad, FechaEA, Numero_Banco,
Numero_Oficina, Cuenta_Banco, DC) VALUES('0','"+
AllTrim(:aFields[8]:Value)+"', '" + AllTrim(:aFields[7]:Value)+"', '"+
AllTrim(SubStr(:aFields[3]:Value, 1 , AT("$",:aFields[3]:Value) -1 ))+"',
'"+ AllTrim(SubStr(:aFields[3]:Value, AT(",",:aFields[3]:Value)+1,
Len(:aFields[3]:Value) ))+"', '"+AllTrim(:aFields[16]:Value)+"',
'"+AllTrim(:aFields[17]:Value)+", "+ AllTrim(:aFields[18]:Value) +"',
'"+AllTrim(:aFields[19]:Value)+"', '"+ AllTrim(:aFields[20]:Value)+"', '"+
AllTrim(:aFields[21]:Value)+"', '"+
DtoSql(CtoD(InvierteFecha(:aFields[9]:Value)))+"', '"+ cPoblacion_N+"', '"+
AllTrim(:aFields[14]:Value)+"', '"+ AllTrim(:aFields[5]:Value)+"', '"+
AllTrim(:aFields[6]:Value)+"', '"+ AllTrim(:aFields[15]:Value)+"', '"+
cSexo+"', '"+ AllTrim(:aFields[37]:Value)+"', '"+ cECivil+"', '"+
cNacionalida+"', '"+ DtoSql(CtoD(InvierteFecha(:aFields[25]:Value)))+"',
'"+ AllTrim(:aFields[47]:Value)+"', '"+AllTrim(:aFields[39]:Value)+"',
'"+AllTrim(:aFields[38]:Value)+"', '"+AllTrim(:aFields[40]:Value) +"')"
AppData:oServer:Execute(cSelect)
Juan Jose
Mensajes: 72
Registrado: Lun Jun 09, 2008 3:43 pm

Ayuda, me consume toda la memoria

Mensaje por Juan Jose »

El error que suelta es de harbour Unrecoverable error 9009: hb_xrealloc
can't reallocate memory
En hb_xrealloc
Alguien sabe algo
Gracias.
"Juan Jose" <correo@jjlopezg.jazztel.es> escribió en el mensaje
news:48626482$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Hola Jose Alfonso
>
> He probado como me has sugerido, Funciona bien pero sigo teniendo el mismo
> problema
> consume toda la memoria hasta que sale el error de windows
>
> cSelect := "INSERT INTO PERSONAL(ID, NIF, AFILIACION, APELLIDOS,
> NOMBRE, VIA, DOMICILIO, Codigo_Postal, POBLACION, PROVINCIA,
> Fecha_Nacimiento, POBLACION_N, PROVINCIA_N, NOMBRE_P, NOMBRE_M,
> TELEFONO_1,
> SEXO, Numero_Hijos, Estado_C, Nacionalidad, FechaEA, Numero_Banco,
> Numero_Oficina, Cuenta_Banco, DC) VALUES('0','"+
> AllTrim(:aFields[8]:Value)+"', '" + AllTrim(:aFields[7]:Value)+"', '"+
> AllTrim(SubStr(:aFields[3]:Value, 1 , AT("$",:aFields[3]:Value) -1 ))+"',
> '"+ AllTrim(SubStr(:aFields[3]:Value, AT(",",:aFields[3]:Value)+1,
> Len(:aFields[3]:Value) ))+"', '"+AllTrim(:aFields[16]:Value)+"',
> '"+AllTrim(:aFields[17]:Value)+", "+ AllTrim(:aFields[18]:Value) +"',
> '"+AllTrim(:aFields[19]:Value)+"', '"+ AllTrim(:aFields[20]:Value)+"', '"+
> AllTrim(:aFields[21]:Value)+"', '"+
> DtoSql(CtoD(InvierteFecha(:aFields[9]:Value)))+"', '"+ cPoblacion_N+"',
> '"+
> AllTrim(:aFields[14]:Value)+"', '"+ AllTrim(:aFields[5]:Value)+"', '"+
> AllTrim(:aFields[6]:Value)+"', '"+ AllTrim(:aFields[15]:Value)+"', '"+
> cSexo+"', '"+ AllTrim(:aFields[37]:Value)+"', '"+ cECivil+"', '"+
> cNacionalida+"', '"+ DtoSql(CtoD(InvierteFecha(:aFields[25]:Value)))+"',
> '"+ AllTrim(:aFields[47]:Value)+"', '"+AllTrim(:aFields[39]:Value)+"',
> '"+AllTrim(:aFields[38]:Value)+"', '"+AllTrim(:aFields[40]:Value) +"')"
>
> AppData:oServer:Execute(cSelect)
>
>
>
Christian
Mensajes: 290
Registrado: Mié Abr 23, 2008 10:18 pm

Ayuda, me consume toda la memoria

Mensaje por Christian »

Proba cada 10 o 20 iteraciones ejecutar ProcessMessages().
Saludos
Juan Jose escribió:
> El error que suelta es de harbour Unrecoverable error 9009: hb_xrealloc
> can't reallocate memory
>
> En hb_xrealloc
>
> Alguien sabe algo
>
> Gracias.
>
> "Juan Jose" <correo@jjlopezg.jazztel.es> escribió en el mensaje
> news:48626482$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>> Hola Jose Alfonso
>>
>> He probado como me has sugerido, Funciona bien pero sigo teniendo el mismo
>> problema
>> consume toda la memoria hasta que sale el error de windows
>>
>> cSelect := "INSERT INTO PERSONAL(ID, NIF, AFILIACION, APELLIDOS,
>> NOMBRE, VIA, DOMICILIO, Codigo_Postal, POBLACION, PROVINCIA,
>> Fecha_Nacimiento, POBLACION_N, PROVINCIA_N, NOMBRE_P, NOMBRE_M,
>> TELEFONO_1,
>> SEXO, Numero_Hijos, Estado_C, Nacionalidad, FechaEA, Numero_Banco,
>> Numero_Oficina, Cuenta_Banco, DC) VALUES('0','"+
>> AllTrim(:aFields[8]:Value)+"', '" + AllTrim(:aFields[7]:Value)+"', '"+
>> AllTrim(SubStr(:aFields[3]:Value, 1 , AT("$",:aFields[3]:Value) -1 ))+"',
>> '"+ AllTrim(SubStr(:aFields[3]:Value, AT(",",:aFields[3]:Value)+1,
>> Len(:aFields[3]:Value) ))+"', '"+AllTrim(:aFields[16]:Value)+"',
>> '"+AllTrim(:aFields[17]:Value)+", "+ AllTrim(:aFields[18]:Value) +"',
>> '"+AllTrim(:aFields[19]:Value)+"', '"+ AllTrim(:aFields[20]:Value)+"', '"+
>> AllTrim(:aFields[21]:Value)+"', '"+
>> DtoSql(CtoD(InvierteFecha(:aFields[9]:Value)))+"', '"+ cPoblacion_N+"',
>> '"+
>> AllTrim(:aFields[14]:Value)+"', '"+ AllTrim(:aFields[5]:Value)+"', '"+
>> AllTrim(:aFields[6]:Value)+"', '"+ AllTrim(:aFields[15]:Value)+"', '"+
>> cSexo+"', '"+ AllTrim(:aFields[37]:Value)+"', '"+ cECivil+"', '"+
>> cNacionalida+"', '"+ DtoSql(CtoD(InvierteFecha(:aFields[25]:Value)))+"',
>> '"+ AllTrim(:aFields[47]:Value)+"', '"+AllTrim(:aFields[39]:Value)+"',
>> '"+AllTrim(:aFields[38]:Value)+"', '"+AllTrim(:aFields[40]:Value) +"')"
>>
>> AppData:oServer:Execute(cSelect)
>>
>>
>>
>
>
Juan Jose
Mensajes: 72
Registrado: Lun Jun 09, 2008 3:43 pm

Ayuda, me consume toda la memoria

Mensaje por Juan Jose »

Gracias a todos.
Ya lo solucione es culpa del :Locate() quien consume los recursos cambie
toda la funcion para localizarlo de otra forma
Un Saludo
"Christian" <christianassenza@yahoo.com.ar> escribió en el mensaje
news:[email=486823c9@ozsrv2.ozlan.local...]486823c9@ozsrv2.ozlan.local...[/email]
> Proba cada 10 o 20 iteraciones ejecutar ProcessMessages().
>
> Saludos
>
>
>
> Juan Jose escribió:
>> El error que suelta es de harbour Unrecoverable error 9009: hb_xrealloc
>> can't reallocate memory
>>
>> En hb_xrealloc
>>
>> Alguien sabe algo
>>
>> Gracias.
>>
>> "Juan Jose" <correo@jjlopezg.jazztel.es> escribió en el mensaje
>> news:48626482$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>> Hola Jose Alfonso
>>>
>>> He probado como me has sugerido, Funciona bien pero sigo teniendo el
>>> mismo
>>> problema
>>> consume toda la memoria hasta que sale el error de windows
>>>
>>> cSelect := "INSERT INTO PERSONAL(ID, NIF, AFILIACION, APELLIDOS,
>>> NOMBRE, VIA, DOMICILIO, Codigo_Postal, POBLACION, PROVINCIA,
>>> Fecha_Nacimiento, POBLACION_N, PROVINCIA_N, NOMBRE_P, NOMBRE_M,
>>> TELEFONO_1,
>>> SEXO, Numero_Hijos, Estado_C, Nacionalidad, FechaEA, Numero_Banco,
>>> Numero_Oficina, Cuenta_Banco, DC) VALUES('0','"+
>>> AllTrim(:aFields[8]:Value)+"', '" + AllTrim(:aFields[7]:Value)+"', '"+
>>> AllTrim(SubStr(:aFields[3]:Value, 1 ,
>>> AT("$",:aFields[3]:Value) -1 ))+"',
>>> '"+ AllTrim(SubStr(:aFields[3]:Value, AT(",",:aFields[3]:Value)+1,
>>> Len(:aFields[3]:Value) ))+"', '"+AllTrim(:aFields[16]:Value)+"',
>>> '"+AllTrim(:aFields[17]:Value)+", "+ AllTrim(:aFields[18]:Value) +"',
>>> '"+AllTrim(:aFields[19]:Value)+"', '"+ AllTrim(:aFields[20]:Value)+"',
>>> '"+
>>> AllTrim(:aFields[21]:Value)+"', '"+
>>> DtoSql(CtoD(InvierteFecha(:aFields[9]:Value)))+"', '"+ cPoblacion_N+"',
>>> '"+
>>> AllTrim(:aFields[14]:Value)+"', '"+ AllTrim(:aFields[5]:Value)+"', '"+
>>> AllTrim(:aFields[6]:Value)+"', '"+ AllTrim(:aFields[15]:Value)+"', '"+
>>> cSexo+"', '"+ AllTrim(:aFields[37]:Value)+"', '"+ cECivil+"', '"+
>>> cNacionalida+"', '"+
>>> DtoSql(CtoD(InvierteFecha(:aFields[25]:Value)))+"',
>>> '"+ AllTrim(:aFields[47]:Value)+"', '"+AllTrim(:aFields[39]:Value)+"',
>>> '"+AllTrim(:aFields[38]:Value)+"', '"+AllTrim(:aFields[40]:Value) +"')"
>>>
>>> AppData:oServer:Execute(cSelect)
>>>
>>>
>>>
>>
Oros Magno
Mensajes: 7
Registrado: Mié Jun 04, 2008 3:33 pm

Ayuda, me consume toda la memoria

Mensaje por Oros Magno »

Hola Juan yo uso lo siguiente con 20000 registros y todo subio bien gracias
a la ayuda de Jose F Gimenez.
METHOD CliMigra( oSender ) CLASS TForm3
local i:=0
local tipocte:='1'
local vnumcli
local cvnombre
local snombre
local mer_tx1
local ven_zonav
local dfi_calle
local dfi_colonia
local dfi_ciudad
local dfi_estado
local dfi_tel1
local dfi_cp
local cre_fpcre
local ven_prege
local dfi_email
local elquery:=" "
local elinsert:=" "
LOCAL aData
local swesta:=" "
//msgalert("dio cli")
select clientes
go top
//do while (i<2 )
do while (!eof())
vnumcli :=str(clientes->no_cli)
cvnombre :=RemCar(alltrim(clientes->nombre))
//MSGALERT(CVNOMBRE)
snombre :=clientes->nombrenego
mer_tx1 :=clientes->clave
ven_zonav :=clientes->tie
dfi_calle :=clientes->calle
dfi_cp :=str(clientes->cod_pos)
dfi_colonia:=clientes->colonia
dfi_ciudad :=clientes->ciudad
dfi_estado :=clientes->estado
dfi_tel1 :=str(clientes->telefono)
cre_fpcre :=clientes->credito
ven_prege :=str(clientes->tipocli)
dfi_email :=clientes->mail
tipocte :="1"
//msgalert(str(i)+".- "+tipocte+vnumcli+cvnombre+snombre+;
//mer_tx1+ven_zonav+dfi_calle+dfi_cp+dfi_colonia+dfi_ciudad+ ;
//dfi_tel1+cre_fpcre+ven_prege+dfi_email)
elquery:="select vnombre from directorio where
vnombre='"+cvnombre+"'"
elinsert:="insert into directorio
(vnumcte,vnombre,snombre,mer_tx1,ven_zonav,dfi_calle,dfi_cp, dfi_colonia,dfi_ciudad,dfi_estado,dfi_tel1,cre_fpcre,ven_pre ge,dfi_email,tipocte)
values
('"+vnumcli+"','"+cvnombre+"','"+snombre+"','"+mer_tx1+ "','"+ven_zonav+"','"+dfi_calle+"','"+dfi_cp+"','"+dfi_colonia+ "','"+dfi_ciudad+"','"+dfi_estado+"','"+dfi_tel1+"','"+cre_fpcre+ "','"+ven_prege+"','"+dfi_email+"','"+tipocte+"')
"
//,cvnombre,snombre,mer_tx1,ven_zonav,dfi_calle,cfi_cp,cfi_c olonia,dfi_ciudad,dfi_estado,dfi_tel1,cre_fpcre,ven_prege,df i_email) "
//msgalert("elquery: "+elquery)
//msgalert("elinsert: "+elinsert)
//swesta:=(::oMySQLDataSource1:Execute(elquery))
swesta := !Empty( ::oMySQLDataSource1:QueryValue( elquery ) )
//msgalert("swesta"+swesta)
if swesta
// msgalert(::oMySQLDataSource1:QueryValue( elquery ) )
// msgalert("acerto dato: ")
::oDbfBrowse1:Setfocus()
::oDbfBrowse1:Refresh()
else
//msgalert("no acerto alta")
::oMySQLDataSource1:Execute(elinsert)
::oDbfBrowse1:Setfocus()
::oDbfBrowse1:Refresh()
endif
i++
skip
::oDbfBrowse1:Refresh()
enddo
RETURN Nil
"Juan Jose" <correo@jjlopezg.jazztel.es> escribió en el mensaje
news:[email=4868d5e0@ozsrv2.ozlan.local...]4868d5e0@ozsrv2.ozlan.local...[/email]
> Gracias a todos.
>
> Ya lo solucione es culpa del :Locate() quien consume los recursos cambie
> toda la funcion para localizarlo de otra forma
>
> Un Saludo
>
>
> "Christian" <christianassenza@yahoo.com.ar> escribió en el mensaje
> news:[email=486823c9@ozsrv2.ozlan.local...]486823c9@ozsrv2.ozlan.local...[/email]
>> Proba cada 10 o 20 iteraciones ejecutar ProcessMessages().
>>
>> Saludos
>>
>>
>>
>> Juan Jose escribió:
>>> El error que suelta es de harbour Unrecoverable error 9009: hb_xrealloc
>>> can't reallocate memory
>>>
>>> En hb_xrealloc
>>>
>>> Alguien sabe algo
>>>
>>> Gracias.
>>>
>>> "Juan Jose" <correo@jjlopezg.jazztel.es> escribió en el mensaje
>>> news:48626482$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>>> Hola Jose Alfonso
>>>>
>>>> He probado como me has sugerido, Funciona bien pero sigo teniendo el
>>>> mismo
>>>> problema
>>>> consume toda la memoria hasta que sale el error de windows
>>>>
>>>> cSelect := "INSERT INTO PERSONAL(ID, NIF, AFILIACION, APELLIDOS,
>>>> NOMBRE, VIA, DOMICILIO, Codigo_Postal, POBLACION, PROVINCIA,
>>>> Fecha_Nacimiento, POBLACION_N, PROVINCIA_N, NOMBRE_P, NOMBRE_M,
>>>> TELEFONO_1,
>>>> SEXO, Numero_Hijos, Estado_C, Nacionalidad, FechaEA, Numero_Banco,
>>>> Numero_Oficina, Cuenta_Banco, DC) VALUES('0','"+
>>>> AllTrim(:aFields[8]:Value)+"', '" + AllTrim(:aFields[7]:Value)+"', '"+
>>>> AllTrim(SubStr(:aFields[3]:Value, 1 ,
>>>> AT("$",:aFields[3]:Value) -1 ))+"',
>>>> '"+ AllTrim(SubStr(:aFields[3]:Value, AT(",",:aFields[3]:Value)+1,
>>>> Len(:aFields[3]:Value) ))+"', '"+AllTrim(:aFields[16]:Value)+"',
>>>> '"+AllTrim(:aFields[17]:Value)+", "+ AllTrim(:aFields[18]:Value) +"',
>>>> '"+AllTrim(:aFields[19]:Value)+"', '"+ AllTrim(:aFields[20]:Value)+"',
>>>> '"+
>>>> AllTrim(:aFields[21]:Value)+"', '"+
>>>> DtoSql(CtoD(InvierteFecha(:aFields[9]:Value)))+"', '"+ cPoblacion_N+"',
>>>> '"+
>>>> AllTrim(:aFields[14]:Value)+"', '"+ AllTrim(:aFields[5]:Value)+"', '"+
>>>> AllTrim(:aFields[6]:Value)+"', '"+ AllTrim(:aFields[15]:Value)+"', '"+
>>>> cSexo+"', '"+ AllTrim(:aFields[37]:Value)+"', '"+ cECivil+"', '"+
>>>> cNacionalida+"', '"+
>>>> DtoSql(CtoD(InvierteFecha(:aFields[25]:Value)))+"',
>>>> '"+ AllTrim(:aFields[47]:Value)+"', '"+AllTrim(:aFields[39]:Value)+"',
>>>> '"+AllTrim(:aFields[38]:Value)+"', '"+AllTrim(:aFields[40]:Value)
>>>> +"')"
>>>>
>>>> AppData:oServer:Execute(cSelect)
>>>>
>>>>
>>>>
>>>
>
>
xAvi
Mensajes: 108
Registrado: Mar Abr 08, 2008 6:12 pm

Ayuda, me consume toda la memoria

Mensaje por xAvi »

Orma,
Perdona, pero que pasa cuando un cliente es de la colonia 'Afueras "Parc Gí¼ell"' o vive en la calle 'Homenaje al 1º Monitor de
21"'. Es sólo un ejemplo: fijate en el uso de las " comillas en el dato.
Un saludo
Xavi
Orma escribió:
> Hola Juan yo uso lo siguiente con 20000 registros y todo subio bien gracias
> a la ayuda de Jose F Gimenez.
>
> METHOD CliMigra( oSender ) CLASS TForm3
> local i:=0
> local tipocte:='1'
> local vnumcli
> local cvnombre
> local snombre
> local mer_tx1
> local ven_zonav
> local dfi_calle
> local dfi_colonia
> local dfi_ciudad
> local dfi_estado
> local dfi_tel1
> local dfi_cp
> local cre_fpcre
> local ven_prege
> local dfi_email
>
> local elquery:=" "
> local elinsert:=" "
> LOCAL aData
> local swesta:=" "
>
>
>
> //msgalert("dio cli")
> select clientes
> go top
> //do while (i<2 )
> do while (!eof())
> vnumcli :=str(clientes->no_cli)
> cvnombre :=RemCar(alltrim(clientes->nombre))
> //MSGALERT(CVNOMBRE)
> snombre :=clientes->nombrenego
> mer_tx1 :=clientes->clave
> ven_zonav :=clientes->tie
> dfi_calle :=clientes->calle
> dfi_cp :=str(clientes->cod_pos)
> dfi_colonia:=clientes->colonia
> dfi_ciudad :=clientes->ciudad
> dfi_estado :=clientes->estado
> dfi_tel1 :=str(clientes->telefono)
> cre_fpcre :=clientes->credito
> ven_prege :=str(clientes->tipocli)
> dfi_email :=clientes->mail
> tipocte :="1"
>
>
> //msgalert(str(i)+".- "+tipocte+vnumcli+cvnombre+snombre+;
> //mer_tx1+ven_zonav+dfi_calle+dfi_cp+dfi_colonia+dfi_ciudad+ ;
> //dfi_tel1+cre_fpcre+ven_prege+dfi_email)
>
> elquery:="select vnombre from directorio where
> vnombre='"+cvnombre+"'"
>
> elinsert:="insert into directorio
> (vnumcte,vnombre,snombre,mer_tx1,ven_zonav,dfi_calle,dfi_cp, dfi_colonia,dfi_ciudad,dfi_estado,dfi_tel1,cre_fpcre,ven_pre ge,dfi_email,tipocte)
> values
> ('"+vnumcli+"','"+cvnombre+"','"+snombre+"','"+mer_tx1+ "','"+ven_zonav+"','"+dfi_calle+"','"+dfi_cp+"','"+dfi_colonia+ "','"+dfi_ciudad+"','"+dfi_estado+"','"+dfi_tel1+"','"+cre_fpcre+ "','"+ven_prege+"','"+dfi_email+"','"+tipocte+"')
> "
> //,cvnombre,snombre,mer_tx1,ven_zonav,dfi_calle,cfi_cp,cfi_c olonia,dfi_ciudad,dfi_estado,dfi_tel1,cre_fpcre,ven_prege,df i_email) "
>
> //msgalert("elquery: "+elquery)
> //msgalert("elinsert: "+elinsert)
> //swesta:=(::oMySQLDataSource1:Execute(elquery))
> swesta := !Empty( ::oMySQLDataSource1:QueryValue( elquery ) )
>
>
> //msgalert("swesta"+swesta)
> if swesta
> // msgalert(::oMySQLDataSource1:QueryValue( elquery ) )
> // msgalert("acerto dato: ")
>
> ::oDbfBrowse1:Setfocus()
> ::oDbfBrowse1:Refresh()
>
> else
> //msgalert("no acerto alta")
> ::oMySQLDataSource1:Execute(elinsert)
> ::oDbfBrowse1:Setfocus()
> ::oDbfBrowse1:Refresh()
> endif
>
> i++
> skip
> ::oDbfBrowse1:Refresh()
> enddo
>
>
> RETURN Nil
>
> "Juan Jose" <correo@jjlopezg.jazztel.es> escribió en el mensaje
> news:[email=4868d5e0@ozsrv2.ozlan.local...]4868d5e0@ozsrv2.ozlan.local...[/email]
>> Gracias a todos.
>>
>> Ya lo solucione es culpa del :Locate() quien consume los recursos cambie
>> toda la funcion para localizarlo de otra forma
>>
>> Un Saludo
>>
>>
>> "Christian" <christianassenza@yahoo.com.ar> escribió en el mensaje
>> news:[email=486823c9@ozsrv2.ozlan.local...]486823c9@ozsrv2.ozlan.local...[/email]
>>> Proba cada 10 o 20 iteraciones ejecutar ProcessMessages().
>>>
>>> Saludos
>>>
>>>
>>>
>>> Juan Jose escribió:
>>>> El error que suelta es de harbour Unrecoverable error 9009: hb_xrealloc
>>>> can't reallocate memory
>>>>
>>>> En hb_xrealloc
>>>>
>>>> Alguien sabe algo
>>>>
>>>> Gracias.
>>>>
>>>> "Juan Jose" <correo@jjlopezg.jazztel.es> escribió en el mensaje
>>>> news:48626482$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>>>>> Hola Jose Alfonso
>>>>>
>>>>> He probado como me has sugerido, Funciona bien pero sigo teniendo el
>>>>> mismo
>>>>> problema
>>>>> consume toda la memoria hasta que sale el error de windows
>>>>>
>>>>> cSelect := "INSERT INTO PERSONAL(ID, NIF, AFILIACION, APELLIDOS,
>>>>> NOMBRE, VIA, DOMICILIO, Codigo_Postal, POBLACION, PROVINCIA,
>>>>> Fecha_Nacimiento, POBLACION_N, PROVINCIA_N, NOMBRE_P, NOMBRE_M,
>>>>> TELEFONO_1,
>>>>> SEXO, Numero_Hijos, Estado_C, Nacionalidad, FechaEA, Numero_Banco,
>>>>> Numero_Oficina, Cuenta_Banco, DC) VALUES('0','"+
>>>>> AllTrim(:aFields[8]:Value)+"', '" + AllTrim(:aFields[7]:Value)+"', '"+
>>>>> AllTrim(SubStr(:aFields[3]:Value, 1 ,
>>>>> AT("$",:aFields[3]:Value) -1 ))+"',
>>>>> '"+ AllTrim(SubStr(:aFields[3]:Value, AT(",",:aFields[3]:Value)+1,
>>>>> Len(:aFields[3]:Value) ))+"', '"+AllTrim(:aFields[16]:Value)+"',
>>>>> '"+AllTrim(:aFields[17]:Value)+", "+ AllTrim(:aFields[18]:Value) +"',
>>>>> '"+AllTrim(:aFields[19]:Value)+"', '"+ AllTrim(:aFields[20]:Value)+"',
>>>>> '"+
>>>>> AllTrim(:aFields[21]:Value)+"', '"+
>>>>> DtoSql(CtoD(InvierteFecha(:aFields[9]:Value)))+"', '"+ cPoblacion_N+"',
>>>>> '"+
>>>>> AllTrim(:aFields[14]:Value)+"', '"+ AllTrim(:aFields[5]:Value)+"', '"+
>>>>> AllTrim(:aFields[6]:Value)+"', '"+ AllTrim(:aFields[15]:Value)+"', '"+
>>>>> cSexo+"', '"+ AllTrim(:aFields[37]:Value)+"', '"+ cECivil+"', '"+
>>>>> cNacionalida+"', '"+
>>>>> DtoSql(CtoD(InvierteFecha(:aFields[25]:Value)))+"',
>>>>> '"+ AllTrim(:aFields[47]:Value)+"', '"+AllTrim(:aFields[39]:Value)+"',
>>>>> '"+AllTrim(:aFields[38]:Value)+"', '"+AllTrim(:aFields[40]:Value)
>>>>> +"')"
>>>>>
>>>>> AppData:oServer:Execute(cSelect)
>>>>>
>>>>>
>>>>>
>>
>
>
Responder