-3
我已存儲的過程中甲骨文NPOCO PL/SQL HANDELING OUT參數
CREATE OR REPLACE PROCEDURE procTest (p_param1 varchar2, p_param2 out varchar2)
AS
BEGIN
...
END;
我該如何處理輸出參數?
_db.Execute("EXEC procTest ('dsds')");
我已存儲的過程中甲骨文NPOCO PL/SQL HANDELING OUT參數
CREATE OR REPLACE PROCEDURE procTest (p_param1 varchar2, p_param2 out varchar2)
AS
BEGIN
...
END;
我該如何處理輸出參數?
_db.Execute("EXEC procTest ('dsds')");
蘆葦有關存儲過程和函數的支持上http://pocoproject.org/docs-1.5.0/00200-DataUserManual.html
存儲過程和函數支持
大多數現代數據庫系統支持存儲過程和/或功能。 Poco :: Data是否提供任何支持?你打賭。雖然具體到底什麼是可能的(例如數據類型傳入和傳出,自動或手動數據綁定,綁定方向等)最終取決於數據庫,但POCO Data最好提供對這些功能的合理訪問, out和io綁定功能。正如它們的名字暗示的那樣,這些函數正在執行參數來綁定通過或從存儲過程接收,或者兩者兼而有之。該代碼是值得千言萬語,所以這裏的一個Oracle ODBC示例:
session << "CREATE OR REPLACE "
"FUNCTION storedFunction(param1 IN OUT NUMBER, param2 IN OUT NUMBER) RETURN NUMBER IS "
" temp NUMBER := param1; "
" BEGIN param1 := param2; param2 := temp; RETURN(param1+param2); "
" END storedFunction;" , now;
int i = 1, j = 2, result = 0;
session << "{? = call storedFunction(?, ?)}", out(result), io(i), io(j), now; // i = 2, j = 1, result = 3
存儲過程被允許返回數據集(又名光標):
typedef Tuple<std::string, std::string, std::string, int> Person;
std::vector<Person> people;
int age = 13;
session << "CREATE OR REPLACE "
"FUNCTION storedCursorFunction(ageLimit IN NUMBER) RETURN SYS_REFCURSOR IS "
" ret SYS_REFCURSOR; "
"BEGIN "
" OPEN ret FOR "
" SELECT * FROM Person WHERE Age < ageLimit; "
" RETURN ret; "
"END storedCursorFunction;" , now;
session << "{call storedCursorFunction(?)}", in(age), into(people), now;
的上面顯示的代碼適用於Oracle數據庫。