Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register


2
(click on this box to dismiss)

How to pass a custom Object to a Stored Procedure function?

hi I have the following function.

CREATE FUNCTION "tblpacientesinsertar"("paciente" OBJECT) RETURN STRING
AS LANGUAGE JAVA 
NAME 'TblPacientes.Insertar(cubrid.sql.CUBRIDOID) return java.lang.String'

I want to pass a custom object class, but I dont know if CUBRIDOID is the right type.

My custom type is public class BoPacientes.

My stored procedure is public static String Insertar(BoPacientes paciente).

C# code looks like:

public BoPacientes Insertar(BoPacientes objeto)
        {
            .....//code code                        CUBRIDCommand com = new CUBRIDCommand();
                        com.Connection = con;
                        com.CommandText = "select tblpacientesinsertar(" + objeto + ")";
                        con.Open();       .......//some code logical       } 

The error I receive is:

Semantic: Dev9.DataAccess.Pacientes.BoPacientes is not defined.
select tblpacientesinsertar(Dev9.DataAccess.Pacientes.BoPacientes) 

I have a java object called BoPacientes.Class registered in CUBRID.

link comment (0)
asked 2 years ago
castle79
60
1 Answer
1

Custom functions can only work on CUBRID data types. This means that you cannot pass something other than what is specified here as an argument to a function. Aside from these data types, you can also use CUBRID objects. Each CUBRID table is a class and each row in that table is an object (an instance). You can pass these instances through OIDs. See the following for more information on OIDs: http://www.cubrid.org/wiki_apis/entry/cubrid-oidshttp://www.cubrid.org/questions/235437http://www.cubrid.org/manual/841/en/JDBC%20Programming-Using%20OIDs%20and%20Collections.


link comment (0)
answered 2 years ago
ginarrbrik
516




You are either using a very old browser or a browser that is not supported.
In order to browse cubrid.org you need to have one of the following browsers:



Internet Explorer: Mozilla Firefox: Google Chrome: