B4J Library SQL: Simplyfying Calling Stored Procedures

victormedranop

Well-Known Member
Licensed User
Longtime User
try this
B4X:
Sub CursorToLog2(oCursorToLog As ResultSet)
    Dim iRowCount As Int
    Dim iColumnCount As Int
    Log(" ")
    Do While oCursorToLog.NextRow
        For iColumnCount = 0 To oCursorToLog.ColumnCount -1
            'Log(oCursorToLog.GetColumnName(iColumnCount) & ": " & oCursorToLog.GetString2(iColumnCount))
   Log(oCursorToLog.GetString("CodIdis"))
        Next
        Log("  ")
    Loop
End Sub

but the result wan

10203364
10203364
10203364
10203364
10203364
10203364
10203364
10203364
10203364
10203364

all colums with the real data. that 10203364 have to be the return but not an all result just CodIdis.

victor
 

victormedranop

Well-Known Member
Licensed User
Longtime User
For me its working I just have to take the first value and use it.
but this is an amazing library.

Victor
 

keirS

Well-Known Member
Licensed User
Longtime User

You have the code in the wrong place. You should have:

B4X:
Sub CursorToLog2(oCursorToLog As ResultSet)
    Dim iRowCount As Int
    Dim iColumnCount As Int
    Log(" ")
    Do While oCursorToLog.NextRow
        'For iColumnCount = 0 To oCursorToLog.ColumnCount -1
            'Log(oCursorToLog.GetColumnName(iColumnCount) & ": " & oCursorToLog.GetString2(iColumnCount))
        'Next
          Log(oCursorToLog.GetString("CodIdis"))
          Log(oCursorToLog.GetString("Nombre"))
          'lots more logs
        Log("  ")
    Loop
End Sub
[/code
 

victormedranop

Well-Known Member
Licensed User
Longtime User
You were absolutely right.
always was working, was a log that confuse me. I remove all log() and
as expected.

thanks.

great job, great lib!!!!!

Victor
 

XbNnX_507

Active Member
Licensed User
Longtime User
Hi, i know this thread is quiet old but i think this question should be of help for those using OracleDatbase...
is it possible to return a resulset Type ?
B4X:
MYSQLProcedure.AddOutputParameter(2,MYSQLProcedure.SQLINTEGER) ' <- MYSQLProcedure.SQLRESULSET ? REF CURSORS
 
Last edited:

keirS

Well-Known Member
Licensed User
Longtime User

Yes. Both the samples return result sets.
 

XbNnX_507

Active Member
Licensed User
Longtime User
Yes. Both the samples return result sets.
They indeed return a resulset set. but i don't find the MYSQLProcedure.SQLRESULSET type in your library.
B4X:
MYSQLProcedure.AddOutputParameter(2,MYSQLProcedure.SQL_CURSOR) <- here
See i'm not returning a integer, nor float, nor string... i'm returning a cursor...
 

keirS

Well-Known Member
Licensed User
Longtime User
A result set is retrieved by calling FetchResultSet. It is not defined as an output parameter. Parameters are used for returning primitive types.
 

XbNnX_507

Active Member
Licensed User
Longtime User
A result set is retrieved by calling FetchResultSet. It is not defined as an output parameter. Parameters are used for returning primitive types.
That's the case with Mariadb, Mysql...
With Oracle ( which i'm using ) i can return a cursor... Actually i need to return a cursor if need to call FetchResulset.
 

keirS

Well-Known Member
Licensed User
Longtime User
That's the case with Mariadb, Mysql...
With Oracle ( which i'm using ) i can return a cursor... Actually i need to return a cursor if need to call FetchResulset.

That's not possible with this library. It's not generic JDBC. It appears it is an extension to JDBC that is specific to the Oracle driver..
 

aregan

Member
Licensed User
Hi Kiers

Do you know is it possible to pass a binary array / blob as a parameter to a stored procedure using this library?

I see the parameter type listed as a sql type but I dont seem to be able to pass the binary array as a parameter.

Thanks
Alan
 

keirS

Well-Known Member
Licensed User
Longtime User
No it’s not possible. You can pass a string to be converted to a blob. I can’t off hand remember how this works. I will post how it’s done after Christmas as I don’t have the source for this on GitLab.
 

keirS

Well-Known Member
Licensed User
Longtime User
Sorry for the delay in getting back on this. Having looked at the source Blobs are only supported as output parameters.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…