Android Question download mysql

aldomoscarda

Member
Licensed User
Longtime User
My application downloads data from my server (mysql - php - xampp - windows).
When I download 8,000 records it works perfectly, but if I try to download 75,000 or more: it stops working and exits the application.
Any help will be appreciated, thanks.

download:
[14:08, 5/10/2020] Hernando: cadena =  "select * from productos_stock where empresa='" & cliente_empresa & "' and sucursal='" & cliente_sucursal & "' order by id  "
        
        Dim trabajo1 As HttpJob
        ProgressDialogShow("Descargando . . ....")
        trabajo1.Initialize ("trabajo1", Me)
        trabajo1.PostString ("http://" & ip_remota.Trim & "/acceso_app2.php",cadena)
[14:12, 5/10/2020] Hernando: If Job.Success = True Then
        Select Job.JobName
            Case "trabajo1" ' usuarios
                        Dim res As String =""
                        res = Job.GetString2("UTF8")
                        Dim parser As JSONParser
                        Dim datos_sucursales As List
                        datos_sucursales.Initialize
                        parser.Initialize(res)
                        datos_sucursales = parser.NextArray
                        Main.SQL1.BeginTransaction
                        Main.SQL1.ExecNonQuery("delete from productos_stock")
                        Main.SQL1.TransactionSuccessful
                        Main.SQL1.EndTransaction
                        Main.SQL1.BeginTransaction
                        Dim m As Map
                        For i = 0 To datos_sucursales.Size - 1
                            m = datos_sucursales.Get(i)
                        
                            Main.SQL1.ExecNonQuery("insert into  productos_stock (id,producto,p_costo,p_venta,cod_interno,a_vencimeinto,m_vencimiento,cod_barra,stock_cliente) values (NULL,'" & m.Get ("producto") &"','0','0','" & m.Get ("cod_interno") &"','0','0','" & m.Get ("cod_barra") &"','0')")
                        Next
                        Main.SQL1.TransactionSuccessful
                        Main.SQL1.EndTransaction
 

DonManfred

Expert
Licensed User
Longtime User
1. Download all the data
2. Do NOT use one transaction for any single entry. Create a job with all entries and send them at once. NonQueryBatch....

Maybe better to split the writing into a few steps.
for ex. 1000 entries each step. Next 1000 if available...
 
Upvote 0
Top