Android Question Update Many Rows in MySQL from Table SQLite

dhernandez

Active Member
Licensed User
Longtime User
I have updated my SQLite, but I love those records updated in MySQL and want to send to DRC MYSQL, more than 20 records to update, as I do?
Thought it with a loop:
But I have no idea how many records and send MySQL update just the way it is in SQLite.

I hope I explained and thanks for your support.

I used Google Translate.
 

dhernandez

Active Member
Licensed User
Longtime User
Yes, I´m using RDC.
Have this code For Select Data:
B4X:
Sub EnviarDatos(VALOR, FOLIO, PARAM)
    CURSOR1=SQL1.ExecQuery2("SELECT valor FROM t_extintor_det WHERE folio=?", Array As String(TXT_SEL.Text))
    For i=0 To CURSOR1.RowCount -1
        CURSOR1.Position=i
        ENVIAR_VALOR = CURSOR1.GetString("valor")
        Dim CMD As DBCommand
        CMD.Initialize
        CMD.Name="update_EXTDETA"
        CMD.Parameters=Array As Object(ENVIAR_VALOR, TXT_SEL.Text)
        ReqManager.ExecuteCommand(CMD,0)
    Next
End Sub

And This execute in a click event button:
B4X:
Sub BtnEnviar_Click
    IniciarConexion
    EnviarDatos(ENVIAR_VALOR, TXT_SEL.Text, Variables.ENVIAR_VALOR)
End Sub

And config.properties is this:
B4X:
sql.update_EXTDETA=UPDATE t_extintor_det SET Valor=? WHERE folio=? AND extintor_param=?;

Not working
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You should use
B4X:
reqManager.ExecuteBatch
to put all results from ExecQuery2 into ONE reManager-Request. Using ExecuteBatch the RDC will make a Transaction i think (have no RDC running)
 
Upvote 0

dhernandez

Active Member
Licensed User
Longtime User
execution have in the DRC but I have the Next Error in the cmd of RDC:

B4X:
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
        at java.util.ArrayList.rangeCheck(ArrayList.java:635)
        at java.util.ArrayList.get(ArrayList.java:411)
        at anywheresoftware.b4a.remotedatabase.Servlet.createStatement(Servlet.j
ava:188)
        at anywheresoftware.b4a.remotedatabase.Servlet.executeBatch(Servlet.java
:111)
        at anywheresoftware.b4a.remotedatabase.Servlet.doGet(Servlet.java:80)
        at anywheresoftware.b4a.remotedatabase.Servlet.doPost(Servlet.java:52)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538
)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java
:478)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandl
er.java:937)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:
406)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandle
r.java:871)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j
ava:117)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper
.java:110)
        at org.eclipse.jetty.server.Server.handle(Server.java:346)
        at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.
java:589)
        at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpCo
nnection.java:1065)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)

        at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:41
1)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEn
dPoint.java:535)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEnd
Point.java:40)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool
.java:529)
        at java.lang.Thread.run(Thread.java:744)
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
        at java.util.ArrayList.rangeCheck(ArrayList.java:635)
        at java.util.ArrayList.get(ArrayList.java:411)
        at anywheresoftware.b4a.remotedatabase.Servlet.createStatement(Servlet.j
ava:188)
        at anywheresoftware.b4a.remotedatabase.Servlet.executeBatch(Servlet.java
:111)
        at anywheresoftware.b4a.remotedatabase.Servlet.doGet(Servlet.java:80)
        at anywheresoftware.b4a.remotedatabase.Servlet.doPost(Servlet.java:52)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)Command:
batch (size=1), took 188ms, client=192.168.3.1

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538
)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java
:478)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandl
er.java:937)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:
406)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandle
r.java:871)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j
ava:117)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper
.java:110)
        at org.eclipse.jetty.server.Server.handle(Server.java:346)
        at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.
java:589)
        at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpCo
nnection.java:1065)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)

        at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:41
1)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEn
dPoint.java:535)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEnd
Point.java:40)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool
.java:529)
        at java.lang.Thread.run(Thread.java:744)
 
Upvote 0
Top