1 / 6

When is the highest pollution?

When is the highest pollution?. Thick Client : Business logic resides at client. Select * From My_Demo_Test ;. Return table data (cursor). DB Server Oracle. Data is processed at client side. Client (Java, JDBC). Int maxPos() { … } Int main() { … EXEC SQL BEGIN DECLARE SECTION;

paley
Télécharger la présentation

When is the highest pollution?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. When is the highest pollution?

  2. Thick Client : Business logic resides at client Select * From My_Demo_Test ; Return table data (cursor) DB Server Oracle Data is processed at client side Client (Java, JDBC)

  3. Int maxPos() { … } Int main() { … EXEC SQL BEGIN DECLARE SECTION; char szServerDatabase[(SQLID_MAX * 2)+2] = “dbname"; char szLoginPassword[(SQLID_MAX * 2)+2] = “uname.password"; int t0, t1, t2, t3, t4 ; EXEC SQL END DECLARE SECTION; … EXEC SQL CONNECT TO:szServerDatabaseUSER:szLoginPassword; … EXEC SQL DECLAREC1CURSOR FORSELECT * FROM my_demo_test; EXEC SQL OPENC1 ; … EXEC SQL FETCH C1 INTO :t0, :t1, :t2, :t3, :t4 ; while (SQLCODE == 0) { Pos = maxPos(t0, t1, t2, t3, t4); PosCount[Pos] = PosCount[Pos] + 1; EXEC SQL FETCH C1 INTO :t0, :t1, :t2, :t3, :t4 ; } <-- Print out results --> }

  4. Executing sp… Thin Client : Business logic resides at server Package isk_demo { MaxPos() ; PosCount() ; } Package isk_demo { MaxPos() ; PosCount() ; } Call isk_demo.PosCount() ; Results DB Server Oracle Client (Sql*plus)

  5. Create Or Replace Package isk_demo As FunctionMaxPos(t1 Float, t2 Float, t3 Float, t4 Float, t5 Float) Return Integer ; ProcedurePosCount ; End isk_demo ; Create Or Replace Package Body isk_demo As <-- Body of package goes here --> End isk_demo ;

  6. Create Or Replace Package Body isk_demo As FunctionMaxPos(…) Return Integer <-- Body of function goes here --> End MaxPos ; ProcedurePosCount As Cursor rSet Is Select * From My_Demo_Test ; … Begin For rSetRow In rSet Loop I := MaxPos(rSetRow.t0, rSetRow.t1, rSetRow.t2, rSetRow.t3, rSetRow.t4) ; PosCountArray(I) := PosCountArray(I) + 1 ; End Loop ; <-- Return the result --> End PosCount ; End isk_demo ;

More Related