Commit f1b76ba4 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

9780596001216

0 → 120000
+1 −0
Changes for 9780596001216: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
9780596001216
 No newline at end of file

Code/EMPLU.pkg

0 → 100644
+64 −0
Changes for Code/EMPLU.pkg: 64 added lines, 0 removed lines.
Original line number Diff line number Diff line
CREATE OR REPLACE PACKAGE emplu1
IS
   FUNCTION onerow (
      employee_id_in IN employee.employee_id%TYPE
      )
   RETURN employee%ROWTYPE;
END;
/
CREATE OR REPLACE PACKAGE BODY emplu1
IS
   FUNCTION onerow (
      employee_id_in IN employee.employee_id%TYPE
      )
   RETURN employee%ROWTYPE
   IS
      CURSOR onerow_cur
      IS
         SELECT *
           FROM employee
          WHERE
         employee_id = employee_id_in;

      onerow_rec employee%ROWTYPE;
   BEGIN
      OPEN onerow_cur;
      FETCH onerow_cur INTO onerow_rec;
      CLOSE onerow_cur;
      RETURN onerow_rec;
   END;
END;
/
CREATE OR REPLACE PACKAGE emplu2
IS
   FUNCTION onerow (
      employee_id_in IN employee.employee_id%TYPE
      )
   RETURN employee%ROWTYPE;
END;
/
CREATE OR REPLACE PACKAGE BODY emplu2
IS
   TYPE tab_tabtype IS TABLE OF employee%ROWTYPE INDEX BY BINARY_INTEGER;
   loadtab tab_tabtype;

   FUNCTION onerow (
      employee_id_in IN employee.employee_id%TYPE
      )
   RETURN employee%ROWTYPE
   IS
   BEGIN
      RETURN loadtab (employee_id_in);
   EXCEPTION
      WHEN NO_DATA_FOUND
      THEN
         RETURN emplu1.onerow (employee_id_in);
   END;

BEGIN
   FOR rec IN (SELECT * FROM employee)
   LOOP
      loadtab (rec.employee_id) := rec;
   END LOOP;
END;
/

Code/JFile.java

0 → 100644
+144 −0
Changes for Code/JFile.java: 144 added lines, 0 removed lines.
Original line number Diff line number Diff line
import java.io.File;

public class JFile {
/*----------------------------------------------------------------
||                  PL/Vision Professional 
||----------------------------------------------------------------
||    File: JFile.java
||  Author: Steven Feuerstein
||
|| This is a part of the PL/Vision Professional Code library.
|| Copyright (C) 1996-1999 RevealNet, Inc.
|| All rights reserved.
||
|| For more information, call RevealNet at 1-800-REVEAL4
|| or check out our Web page: www.revealnet.com
||
******************************************************************/

/***************** Modification History **************************
|| Date     By     Description
|| 2/26/99  SEF    Created
|| 8/2000   SEF    Incorporate into PL/Vision
******************************************************************/

   public static String separator (String fileName) {
      File myFile = new File (fileName);
      return myFile.separator;
      }

   public static int canRead (String fileName) {
      File myFile = new File (fileName);
      boolean retval = myFile.canRead();
      if (retval) return 1; else return 0;
      }

   public static int canWrite (String fileName) {
      File myFile = new File (fileName);
      boolean retval = myFile.canWrite();
      if (retval) return 1; else return 0;
      }

   public static int exists (String fileName) {
      File myFile = new File (fileName);
      boolean retval = myFile.exists();
      if (retval) return 1; else return 0;
      }

   public static int isDirectory (String fileName) {
      File myFile = new File (fileName);
      boolean retval = myFile.isDirectory();
      if (retval) return 1; else return 0;
      }

   public static int isFile (String fileName) {
      File myFile = new File (fileName);
      boolean retval = myFile.isFile();
      if (retval) return 1; else return 0;
      }

   public static long length (String fileName) {
      File myFile = new File (fileName);
      return myFile.length();
      }

   public static String parentDir (String fileName) {
      File myFile = new File (fileName);
      return myFile.getParent();
      }

   public static String pathName (String fileName) {
      File myFile = new File (fileName);
      return myFile.getPath();
      }

   public static long lastModified (String fileName) {
      File myFile = new File (fileName);
      return myFile.lastModified();
      }

   public static int delete (String fileName) {
      File myFile = new File (fileName);
      boolean retval = myFile.delete();
      if (retval) return 1; else return 0;
      }

   public static int mkdir (String fileName) {
      File myFile = new File (fileName);
      boolean retval = myFile.mkdir();
      if (retval) return 1; else return 0;
      }

   public static int rename (
         String oldFile, String newFile) {
      File myFile = new File (oldFile);
      File myFile2 = new File (newFile);
      boolean retval = myFile.renameTo(myFile2);
      if (retval) return 1; else return 0;
      }
      
   /*
   public static oracle.sql.ARRAY dirContents (String dir) 
      throws SQLException, ClassNotFoundException {
      
      File myDir = new File (dir);
      String[] filesList = myDir.list();
      
      Class.forName("oracle.jdbc.driver.OracleDriver");
      Connection con = new OracleDriver().defaultConnection();
      
      ArrayDescriptor arrayDesc = 
         ArrayDescriptor.createDescriptor ("directory_t", con);
      oracle.sql.ARRAY filesArray = new oracle.sql.ARRAY (arrayDesc, con, filesList);
      
      return filesArray;
      }
   */

   public static String dirContents (String dir) {
      File myDir = new File (dir);
      String[] filesList = myDir.list();
      String contents = new String();
      for (int i = 0; i < filesList.length; i++) 
         contents = contents + "|" + filesList[i];
      return contents;
      }
   
   public static void main (String[] args) {
      String contents = dirContents (args[0]);
      System.out.println (contents);
      /*
      try {
         oracle.sql.ARRAY filesArray = dirContents (args[0]);
         String[] files = (String[]) filesArray.getArray ();
         for (int i = 0; i <= files.length; i++) 
            System.out.println (files[i]);
         }
      catch ( SQLException e ) {
         System.out.println (e.getMessage());}
      catch ( ClassNotFoundException e ) {
         System.out.println ("ClassNotFoundException");}
      */
   } 
           
}
 No newline at end of file
+178 KiB

File added.

No diff preview for this file type.

+26 −0
Changes for Code/always_use_ora.sql: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
/*
  || Reference event arributes via the
  || provided public synonyms.
*/
DROP TABLE log_create;

CREATE TABLE log_create
(object_type VARCHAR2(30),
 object_name VARCHAR2(30));

CREATE OR REPLACE TRIGGER after_create
AFTER CREATE ON SCHEMA
DECLARE
  /*-- the BAD way with direct referencing */
  v_type VARCHAR2(30) := DICTIONARY_OBJ_TYPE;
  v_name VARCHAR2(30) := DICTIONARY_OBJ_NAME;
BEGIN
  /*-- the GOOD way; via the synonyms */
  INSERT INTO log_create
  VALUES(ORA_DICT_OBJ_TYPE,
         ORA_DICT_OBJ_NAME);
  INSERT INTO log_create
  VALUES(v_type,
         v_name);
END;
/
Loading