dfx ( … )

Description:

Through esProc JDBC, search for and execute a program file locally. If not found, then search the server.

Syntax:

dfx (…)

Note:

Pass in the parameter … and call the cellset file dfx waiting to be executed. Firstly, locate the cellset file with relative searching path for execution. If not found, then search the server (The server list is configured in raqsoftConfig.xml file). Once the computation is completed in esProc or server, return a sequence composed of members of the result set; if there are multiple result sets, then return a sequence composed of these result sets. dfx (…) can be regarded as the simple notation of call dfx(…), which is executed with st.executeQuery() and returns a result set.

Parameter:

dfx

Cellset file, with relative addressing path or absolute path

Input parameter. Use comma to separate if there are multiple ones. These parameters will be assigned to the parameters specified in the query statement in their order, rather than according to the latter’s names.

Example:

C: \\test.dfx cellset file has the following contents, in which StuId and Class is the cellset parameters.

 

A

1

=connect("demo")

2

=A1.query("select * from SCORES where STUDENTID=? and CLASS=?",StuId,Class)

3

=A2.sum(SCORE)

4

>A1.close()

5

return A3

 

 

 

 

 

 

 

 

Here’s the test code:

public void testDataServer() {

Connection con = null;

java.sql.PreparedStatement st;

try{

Class.forName("com.esproc.jdbc.InternalDriver");

con= DriverManager.getConnection("jdbc:esproc:local://");

// Call the stored procedure in which test is the name of dfx file

st =con.prepareCall("test ?,?");

// Set the first parameter

st.setObject(1,"4");

// Set the second parameter

st.setObject(2,"Class one");

// Execute stored procedure

st.execute();

// Get result set

ResultSet set = st.getResultSet();

// Print results

printRs(set); 

// The following statement gets same result as the above-mentioned calling method has

st =con.prepareCall("test 4,\"Class one\"");

st.execute();

set = st.getResultSet();

printRs(set);

}

catch(Exception e){

System.out.println(e);

}

finally{

// Close the connection

if (con!=null) {

try {

con.close();

}

catch(Exception e) {

System.out.println(e);

}

}

}

}