/// <summary> /// Test CREATE Database Stored Functions calls /// </summary> private static void Test_CreateFunction() { using (CUBRIDConnection conn = new CUBRIDConnection()) { conn.ConnectionString = TestCases.connString; conn.Open(); try { TestCases.ExecuteSQL("drop function sp1", conn); } catch { } string sql = "CREATE FUNCTION sp1(a int) RETURN string AS LANGUAGE JAVA NAME 'SpTest.test1(int) return java.lang.String'"; using (CUBRIDCommand cmd = new CUBRIDCommand(sql, conn)) { cmd.ExecuteNonQuery(); } CUBRIDSchemaProvider schema = new CUBRIDSchemaProvider(conn); DataTable dt = schema.GetProcedures(null); Debug.Assert(dt.Rows.Count == 1); TestCases.ExecuteSQL("drop function sp1", conn); } }
/// <summary> /// Test CREATE Stored Procedures calls /// </summary> private static void Test_CreateProcedure() { using (CUBRIDConnection conn = new CUBRIDConnection()) { conn.ConnectionString = TestCases.connString; conn.Open(); try { TestCases.ExecuteSQL("drop function sp2", conn); } catch { } string sql = "CREATE PROCEDURE \"sp2\"() AS LANGUAGE JAVA NAME 'SpTest.test2()'"; using (CUBRIDCommand cmd = new CUBRIDCommand(sql, conn)) { cmd.ExecuteNonQuery(); } CUBRIDSchemaProvider schema = new CUBRIDSchemaProvider(conn); DataTable dt = schema.GetProcedures(null); Debug.Assert(dt.Rows.Count == 1); TestCases.ExecuteSQL("drop procedure sp2", conn); } }
/// <summary> /// Test CUBRIDSchemaProvider GetProcedures() method /// </summary> private static void Test_GetProcedures() { using (CUBRIDConnection conn = new CUBRIDConnection()) { conn.ConnectionString = TestCases.connString; conn.Open(); CUBRIDSchemaProvider schema = new CUBRIDSchemaProvider(conn); DataTable dt = schema.GetProcedures(null); Debug.Assert(dt.Columns.Count == 7); Debug.Assert(dt.Rows.Count == 0); } }