Android Question Problems con RCD2 and Mysql decode

Martingz2001

New Member
I am new to this forum, I am trying to use RCD2, I have already achieved the connection and several queries, I have a problem in the user table a field was encrypted with the mysql encode function, and when making the query it does not bring me the correct information.

in config.properties i have
sql.select_cta=select decode(password,'hackcomapa'),nombres,apellidopaterno,apellidomaterno from usuarios WHERE usuario = ?

te result of query is
[B@5028984 MARTIN GAMEZ CAMACHO

sorry for my bad english
 
Solution
What type is the password field in the table usuarios, I guess it is blob.
The type of the result you queried is Blob , I have seen it. so you have to convert it to string for showing.
Modify Sub PrintTable for it
B4X:
'Prints the table to the logs.
Public Sub PrintTable(Table As DBResult)
    Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
    Dim sb As StringBuilder
    sb.Initialize
    Dim i=0, decode As Int
    For Each col In Table.Columns.Keys
        If col.As(String).ToLowerCase.Contains("decode") Then
            decode=i
        End If
        sb.Append(col).Append(TAB)
        i=i+1
    Next
    Log(sb.ToString)
 
    For Each row() As Object In Table.Rows
        i=0...

teddybear

Well-Known Member
Licensed User
What type is the password field in the table usuarios, I guess it is blob.
The type of the result you queried is Blob , I have seen it. so you have to convert it to string for showing.
Modify Sub PrintTable for it
B4X:
'Prints the table to the logs.
Public Sub PrintTable(Table As DBResult)
    Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
    Dim sb As StringBuilder
    sb.Initialize
    Dim i=0, decode As Int
    For Each col In Table.Columns.Keys
        If col.As(String).ToLowerCase.Contains("decode") Then
            decode=i
        End If
        sb.Append(col).Append(TAB)
        i=i+1
    Next
    Log(sb.ToString)
 
    For Each row() As Object In Table.Rows
        i=0
        Dim sb As StringBuilder
        sb.Initialize
        For Each record As Object In row
            If i=decode Then
                Dim bc As ByteConverter
                record=bc.StringFromBytes(record,"utf8")
            End If
            sb.Append(record).Append(TAB)
            i=i+1
        Next
        Log(sb.ToString)
    Next
End Sub
 
Last edited:
Upvote 2
Solution

Martingz2001

New Member
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…