Description of the package (package) application specification

zhaozj2021-02-11  163

First, Database Dedicated: Package is divided into two parts: 1, Package Head, 2, Package Body. The former is the definition of the header, the latter is an entity of the process and method. As long as the header definition is described in detail, the details of the enabble can be hidden. For example: Package Head Pkg_topNetis - User Define Data Type --- User Custom Data Type -

--user define procedure and function- - User-defined procedures and functions - --the procedure proc_password_validate is the process ofpassword validate- --the param log_id is the pa_id coloum- --the param log_pass is the pb_yhpwd coloum- - the param member_name is the pb_name coloum- --if the member_name is return value "none", it verification indicate that the- --login process has been crash- --proc_password_validate procedure for password - - log_id parameter field is pa_id - - log_pass parameter field is pb_yhpwd - - member_name parameter field is pb_name - - member_name if the return value of "none", then the verification process error - procedure proc_password_validate (log_id in number, log_pass in varchar2, member_name out varchar2 );

--the procedure proc_password_change is the process ofpassword change- --the param log_id is the pa_id coloum- --the param org_pass is the user's original password- --the param new_pass is the user's new password- --the param status is the Status of this process - - IT ITUS Is Return Value 0, It Indicate That The The The- - -change Process Has Been Validate --- If The Status Is Return Value 1, It Indicate That The The- --user's Original Password Make Misetake - --proc_password_change process The modification of the password - - Parameter log_id is the PA_ID field - - Parameter org_pass is the original password - - Parameter new_pass for the user new password - - Parameter status is the status return value of the process - - If the return value of Status is 0, the modification process is successful - if the return value of STATUS is 1, then the user's original password is wrong - Procedure Proc_Password_change (log_id in number, org_pass in varchar2, new_pass In varchar2, status out number;

Therefore, we only need to provide a standardized Baotou information to meet your development needs, and the detailed process of the enclosure can be hidden. When there is a new need, you only need to update the package, then give you a description of a header. You can, in the development phase, you can use Procedure first, and then unify all procedure packages, the modification of the APP is small, just update the three lines of code. Second, AppServer end development explanation: 1, JDBC Description: package pepper_dog999.usejdbc; import java.sql. *;

Public class jdbccallpackage {

Public static void main (string [] args) {connection road = "oracle.jdbc.driver.OracleDriver"; string url = "JDBC: Oracle: Thin: @ 192.168.128.41: 1521: ORC2"; try {conn = JdbcConnDb.connDb (driver, url, "pepper_dog999", "bad_boy2"); CallableStatement cstmt = conn.prepareCall ( "{call pkg_topnet.proc_password_validate (,,)???}"); cstmt.setInt (1,10001) Cstmt.setString (2, "pass1"); cstmt.registeroutparameter (3, Types.varchar); cstmt.executeQuery (); string pbname = cstmt.getstring (3); system.out.println ("the Output Param IS) PBNAME, AND ITS VALUE IS: " PBNAME);} catch (sqlexception ex) {system.out.println (" SQL Exception: " ex.getMessage ());}}}

Class JDBCConNDB {

public static Connection connDb (String driver, String url, String user, String pass) {Connection conn = null; try {Class.forName (driver);} catch (java.lang.ClassNotFoundException e) {System.out.println ( " Class Not Found Exception: " E.GetMessage ());} Try {conn = drivermanager.getConnection (URL, User, Pass);} catch (sqlexception ex) {system.out.println (" SQL Exception: " EX .getMessage ());} Return (conn);}}

One of the CONNDB classes is a custom class that generates an object instance for connectivity.

2, ODBC ADO Data Model Description: (Each language is adjusted according to its own characteristics) Function Connectora8 (DSN_NAME, User, Password) set conn = server.createObject (AdoDb.Connection ") conn.connectionstring =" DSN = "& DSN_Name &"; uid = "& user &"; pwd = "& password &"; "conn.Open conn = ConnectOra8 (" dsn_name "," user "," password ") end funcationsub ODBCCallPackage () const adOpenStatic = 3 const adCmdText = & h0001 const adCmdStoredProcedure = & H0004 const adParamInput = & H0001 const adParamOutput = & H0002 const adVarChar = 200 const adInteger = 3 const adDate = 7 SQLString = "{call pkg_topnet_package.proc_password_validate (?,?,?)}" conn = connectOra8 ( "conn_Ora", "pepper_dog999", "bad_boy2 ") set comm = server.createObject (" ADODB.Command ") with comm .activeConnection = conn .commandType = adCmdText .commandText = SQLString end with set pa_id = comm.CreateParameter (pa_id, adInteger, adParamInput, 12) pa_id.value = 10001 Comm.Parameters.Append PA_ID SET PB_YHPWD = Comm.createParameter (PB_YHPWD, Advarchar, Adparaminput, 20) PB_YHPWD.VALUE = "pass1" Comm.Parameters.Append PB_Y hpwd 'output set pb_name = comm.CreateParameter (pp_name, adVarChar, adParamOutput, 20) comm.parameters.append pb_name comm.execute response.write "the output param is member_name and it's value is" & pb_name end sub

转载请注明原文地址:https://www.9cbs.com/read-5374.html

New Post(0)