Android Question httputils error - SOLVED

elitevenkat

Active Member
Licensed User
Longtime User
i am trying to read a mysql database tables and download to local sqllite db in the device.
i am running rdc server @"http://192.168.0.6:17180.
The jserver is running. when i test with http://192.168.0.6:17180/test
it returns
RemoteServer is running (09/27/2016 22:15:37)
Connection successful.

B4X:
#Region  Project Attributes 
    #ApplicationLabel: apos
    #VersionCode: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: true
#End Region

#Region  Activity Attributes 
    #FullScreen: true
    #IncludeTitle: false

#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
        Public SQL As SQLCipher
    Dim dbPass As String ="Dyno2008"
    Dim rm As DBRequestManager
    Dim cCnn As String ="http://192.168.0.6:17180/rdc"
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
     
    Private pnlStart As Panel
    Private nCckey As Int =1
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    rm.Initialize(Me, cCnn)
    If FirstTime Then
        Activity.LoadLayout("startscr")
       
        If File.Exists(File.DirRootExternal  ,  "kot.db") Then               
        SQL.Initialize(File.DirRootExternal , "kot.db",False,dbPass,"")   
    '    CallSubDelayed(Main,"CloseStartLogo")       
       
    Else              
        SQL.Initialize(File.DirRootExternal , "kot.db",True,dbPass,"")
        CreateTables       
       
    End If
   
    '    CallSubDelayed(Me,"SyncMasters")   
       SyncMasters       
    End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub  SyncMasters
    SyncPosControl
    SyncPosArea
'    SyncCaptainMaster
'    SyncItemaster
'    SyncItemcategory
'    SyncItemGroups
'
'    SyncUom
'    SyncWaiters
'    SyncTables
'   
    CloseStartLogo
End Sub

Sub CloseStartLogo
   
End Sub



 Private Sub  SyncPosArea
  Dim cmd As DBCommand
   
    cmd.Initialize
    cmd.Name = "select_posTAB"
    'cmd.Parameters = Array As Object(cU,cP,Main.nCckey)
   
    rm.ExecuteQuery(cmd, 0, "POSAREA")
   

End Sub
Private Sub  SyncPosControl
    Dim cmd As DBCommand
   
    cmd.Initialize
    cmd.Name = "select_poscontrol"
    'cmd.Parameters = Array As Object(cU,cP,Main.nCckey)
   
    rm.ExecuteQuery(cmd, 0, "POSCONTROL")
   

End Sub
 

Sub JobDone(Job As HttpJob)
    If Job.Success = False Then
        Log("Error: " & Job.ErrorMessage)
'        fx.Msgbox(Mform,Job.ErrorMessage,"error")
        'tvPos.Items.Clear
        If Job.JobName = "chk" Then
        '     fx.Msgbox(Mform,"No net","Login")   
        End If
        Job.Release
    Else
       
        If Job.JobName = "DBRequest" Then
            Dim result As DBResult = rm.HandleJob(Job)
       
           If Job.Tag = "POSCONTROL" Then
                Dim ListOfMaps As List
                ListOfMaps.Initialize
  
               
             For Each row() As Object In result.Rows
               Dim cc1 As Map=result.Columns
                Dim cc As Int=cc1.Size-1
                Dim n As Int=cc
               
              'For i = 0 To result.rows.Size - 1          
                  Dim m As Map      
                    m.Initialize
                    Dim  j As Int
                    For Each col In result.Columns.Keys
                     m.Put(col, row(j))                     
                   Next
                    ListOfMaps.Add(m)
                         
              Next
  
               
               DBUtils.InsertMaps(SQL, "POSCONTROL", ListOfMaps)
           End If
         
         
          If Job.Tag = "POSAREA" Then
                Dim ListOfMaps As List
                ListOfMaps.Initialize
  
               
             For Each row() As Object In result.Rows
               Dim cc1 As Map=result.Columns
                Dim cc As Int=cc1.Size-1
                Dim n As Int=cc
               
              'For i = 0 To result.rows.Size - 1          
                  Dim m As Map      
                    m.Initialize
                    Dim  j As Int
                    For Each col In result.Columns.Keys
                     m.Put(col, row(j))                     
                   Next
                    ListOfMaps.Add(m)
                         
              Next
               
               
               DBUtils.InsertMaps(SQL, "POSAREA", ListOfMaps)
           End If

  
        End If  
    End If
End Sub



private Sub CreateTables
    PosControlCreateTable
    PosAreaCreateTable
    CaptainCreateTable
    ItemCategoryCreateTable
    ItemGrupMasterCreateTable
    ItemMasterCreateTable
    TableMasterCreateTable
    WaiterCreateTable
End Sub





public Sub PosControlCreateTable
    DBUtils.DropTable(SQL, "POSCONTROL")
    'Create the CAPTAINMAST table which holds data about each ITEM.
    Dim m As Map
    m.Initialize
   
     
    ' CaptainPckey, CaptainName, PosAreaPckey, Pw

   
    m.Put("posname", DBUtils.DB_TEXT)
    m.Put("posaddress",DBUtils.DB_TEXT)
    m.Put("phone", DBUtils.DB_TEXT)   
    m.Put("lastcloseddate", DBUtils.DB_TEXT)
    m.Put("emaillinked", DBUtils.DB_INTEGER)
    m.Put("posaddress2", DBUtils.DB_TEXT)
    m.Put("smslink", DBUtils.DB_INTEGER)
    m.Put("cckey", DBUtils.DB_INTEGER)   
    m.Put("Rpckey", DBUtils.DB_INTEGER)       
   
    DBUtils.CreateTable(SQL, "POSCONTROL", m,"Rpckey")

   
End Sub
 
public Sub PosAreaCreateTable
    DBUtils.DropTable(SQL, "POSAREA")
   
    Dim m As Map
    m.Initialize
   
    m.Put("posareapckey", DBUtils.DB_INTEGER)
    m.Put("posareaname", DBUtils.DB_TEXT)
    m.Put("currentsessionpckey",DBUtils.DB_INTEGER)
    m.Put("gettable", DBUtils.DB_INTEGER)   
    m.Put("getcaptain", DBUtils.DB_INTEGER)
    m.Put("getwaiter", DBUtils.DB_INTEGER)
    m.Put("getpax", DBUtils.DB_INTEGER)
    m.Put("getphone", DBUtils.DB_INTEGER)   
    m.Put("Rpckey", DBUtils.DB_INTEGER)       
   
    DBUtils.CreateTable(SQL, "POSAREA", m,"Rpckey")

   
End Sub

the problem is the jobdone event is not firing. However the same code was running before i re arranged some part of code ...

b4a ver 6
rdc ver 2.1
httputils 2.01 version


the error log says

Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:b4a.example
** Activity (main) Create, isFirst = true **
~w:1004,main,36

sending message to waiting queue of uninitialized activity (submitjob)
sending message to waiting queue of uninitialized activity (submitjob)


** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
Connected to B4A-Bridge (Wifi)
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **

Can someone help ?
 

elitevenkat

Active Member
Licensed User
Longtime User
@Pendrush

This is how the it is invoked.

B4X:
Private Sub  SyncPosAreaDim 

cmd As DBCommand
 
 cmd.Initialize
 cmd.Name = "select_posTAB"'cmd.Parameters = Array As Object(cU,cP,Main.nCckey) 
 rm.ExecuteQuery(cmd, 0, "POSAREA")
 End Sub

Private Sub  SyncPosControlDim 

cmd As DBCommand
 
 cmd.Initialize
 cmd.Name = "select_poscontrol"'cmd.Parameters = Array As Object(cU,cP,Main.nCckey) 
 rm.ExecuteQuery(cmd, 0, "POSCONTROL")
 End Sub
 
Upvote 0

elitevenkat

Active Member
Licensed User
Longtime User
I had invoked clean project and restart adb server options from the tools option. It now works fine.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…