Examples of CallableStatement


Examples of java.sql.CallableStatement

      oStmt.close();
      bRetVal = true;
    }
    else {
      if (DebugFile.trace) DebugFile.writeln("Connection.prepareCall({ call k_sp_del_duty ('" + sDutyGUID + "')})");
      CallableStatement oCall = oConn.prepareCall("{call k_sp_del_duty ('" + sDutyGUID + "')}");
      bRetVal = oCall.execute();
      oCall.close();
    }

    return bRetVal;
  } // delete()
View Full Code Here

Examples of java.sql.CallableStatement

          oStmt.executeQuery("SELECT k_sp_del_mime_msg('" + oDeleted.getString(0,m) + "')");
        } // next (message)
        oStmt.close();
        oStmt=null;
      } else {
        CallableStatement oCall = oConn.prepareCall("{ call k_sp_del_mime_msg(?) }");
        for (int m=0; m<iDeleted; m++) {
          oCall.setString(1, oDeleted.getString(0,m));
          oCall.execute();
        } // next
        oCall.close();
        oCall=null;
      } // fi
      // When the Category is deleted its associated Products are erased from disk.
      // As the MBOX files are stored as products of the category, the MBOX files
      // will be deleted as a side effect of deleting the Category
View Full Code Here

Examples of java.sql.CallableStatement

   * @param iRecurse Remove permissions also from childs Categories all levels down.
   * @param iObjects Not Used, must be zero.
   * @throws SQLException
   */
  public void removeGroupPermissions (Connection oConn, String sIdGroups, short iRecurse, short iObjects) throws SQLException {
    CallableStatement oStmt;
    StringTokenizer oUsrTok;
    int iTokCount;
    String sIdCategory;

    if (DebugFile.trace) {
       DebugFile.writeln("Begin Category.removeGroupPermissions([Connection], " + sIdGroups + "," + iRecurse + "," + iObjects + ")" );
       DebugFile.incIdent();
       DebugFile.writeln("Connection.prepareCall({ call k_sp_cat_del_grp ('" + getStringNull(DB.gu_category, "null") + "',?," + String.valueOf(iRecurse) + "," + String.valueOf(iObjects) + ") }");
     }

    if (oConn.getMetaData().getDatabaseProductName().equals("PostgreSQL"))
      oStmt = oConn.prepareCall("{ call k_sp_cat_del_grp ('" + getString(DB.gu_category) + "',?,CAST(" + String.valueOf(iRecurse) + " AS SMALLINT), CAST(" + String.valueOf(iObjects) + " AS SMALLINT)) }");
    else
      oStmt = oConn.prepareCall("{ call k_sp_cat_del_grp ('" + getString(DB.gu_category) + "',?," + String.valueOf(iRecurse) + "," + String.valueOf(iObjects) + ") }");

    if (sIdGroups.indexOf(',')>=0) {
      oUsrTok = new StringTokenizer(sIdGroups, ",");
      iTokCount = oUsrTok.countTokens();
      sIdCategory = getString(DB.gu_category);

      for (int t=0; t<iTokCount; t++) {
        oStmt.setString(1, oUsrTok.nextToken());
        oStmt.execute();
      } // end for ()

      oStmt.close();
    }
    else {
      oStmt.setString(1, sIdGroups);
      oStmt.execute();
      oStmt.close();
    }

    if (DebugFile.trace) {
       DebugFile.decIdent();
       DebugFile.writeln("End Category.Category.removeGroupPermissions()");
View Full Code Here

Examples of java.sql.CallableStatement

   * @throws SQLException
   * @see com.knowgate.acl.ACL
   */
  public void setGroupPermissions(Connection oConn, String sIdGroups, int iACLMask, short iRecurse, short iObjects) throws SQLException {
    PreparedStatement oStmt;
    CallableStatement oCall;
    StringTokenizer oUsrTok;
    String sToken;
    int iTokCount;

    if (DebugFile.trace) {
       DebugFile.writeln("Begin Category.setGroupPermissions([Connection], " + sIdGroups + "," + iACLMask + "," + iRecurse + "," + iObjects + ")" );
       DebugFile.incIdent();

       DebugFile.writeln("database product name " + oConn.getMetaData().getDatabaseProductName());

       if (oConn.getMetaData().getDatabaseProductName().equals("PostgreSQL"))
         DebugFile.writeln("Connection.prepareStatement(SELECT k_sp_cat_set_grp ('" + getString(DB.gu_category) + "',?," + String.valueOf(iACLMask) + ", CAST(" + String.valueOf(iRecurse) + " AS SMALLINT), CAST(" + String.valueOf(iObjects) + " AS SMALLINT))");
       else
         DebugFile.writeln("Connection.prepareCall({ call k_sp_cat_set_grp ('" + getStringNull(DB.gu_category, "null") + "',?," + String.valueOf(iACLMask) + "," + String.valueOf(iRecurse) + "," + String.valueOf(iObjects) + ") }");
     }

    if (oConn.getMetaData().getDatabaseProductName().equals("PostgreSQL")) {
      oStmt = oConn.prepareStatement("SELECT k_sp_cat_set_grp ('" + getString(DB.gu_category) + "',?," + String.valueOf(iACLMask) + ", CAST(" + String.valueOf(iRecurse) + " AS SMALLINT), CAST(" + String.valueOf(iObjects) + " AS SMALLINT))");
      if (sIdGroups.indexOf(',')>0) {
        oUsrTok = new StringTokenizer(sIdGroups, ",");
        iTokCount = oUsrTok.countTokens();
        for (int t=0; t<iTokCount; t++) {
          oStmt.setString(1, oUsrTok.nextToken());
          oStmt.executeQuery().close();
        } // end for ()
      }
      else {
        oStmt.setString(1, sIdGroups);
        oStmt.executeQuery().close();
      }
      oStmt.close();
    } else {
      oCall = oConn.prepareCall("{ call k_sp_cat_set_grp ('" + getString(DB.gu_category) + "',?," + String.valueOf(iACLMask) + "," + String.valueOf(iRecurse) + "," + String.valueOf(iObjects) + ") }");
      if (sIdGroups.indexOf(',')>0) {
        oUsrTok = new StringTokenizer(sIdGroups, ",");
        iTokCount = oUsrTok.countTokens();
        for (int t=0; t<iTokCount; t++) {
          sToken = oUsrTok.nextToken();
          if (DebugFile.trace) DebugFile.writeln("CallableStatement.setString(1,"+sToken+")");
          oCall.setString(1, sToken);
          oCall.execute();
        } // end for ()
      }
      else {
        if (DebugFile.trace) DebugFile.writeln("CallableStatement.setString(1,"+sIdGroups+")");
        oCall.setString(1, sIdGroups);
        oCall.execute();
      }
      oCall.close();
    }

    if (DebugFile.trace) {
       String[] aGrps = com.knowgate.misc.Gadgets.split(sIdGroups,',');
       int iMsk;
View Full Code Here

Examples of java.sql.CallableStatement

   * ACL.PERMISSION_SEND,ACL.PERMISSION_GRANT,ACL.PERMISSION_FULL_CONTROL }
   * @throws SQLException
   */
  public int getUserPermissions(Connection oConn, String sIdUser) throws SQLException {
    int iACLMask;
    CallableStatement oCall;
    Statement oStmt;
    ResultSet oRSet;

    if (DebugFile.trace) {
       DebugFile.writeln("Begin Category.getUserPermissions([Connection], " + sIdUser + ")" );
       DebugFile.incIdent();
    }

    if (oConn.getMetaData().getDatabaseProductName().equals("PostgreSQL")) {
      oStmt = oConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);

      if (DebugFile.trace) DebugFile.writeln("Statement.executeQuery(SELECT k_sp_cat_usr_perm ('" + sIdUser + "','" + getStringNull(DB.gu_category,"null") + "'))");

      oRSet = oStmt.executeQuery("SELECT k_sp_cat_usr_perm ('" + sIdUser + "','" + getString(DB.gu_category) + "')");
      oRSet.next();
      iACLMask = oRSet.getInt(1);
      oRSet.close();
      oStmt.close();
    }
    else {
      if (DebugFile.trace) DebugFile.writeln("Connection.prepareCall({ call k_sp_cat_usr_perm('" + sIdUser + "','" + getStringNull(DB.gu_category,null) + "',?) })");

      oCall = oConn.prepareCall("{ call k_sp_cat_usr_perm(?,?,?) }");
      oCall.setString(1, sIdUser);
      oCall.setString(2, getString(DB.gu_category));
      oCall.registerOutParameter(3, java.sql.Types.INTEGER);
      oCall.execute();
      iACLMask = oCall.getInt(3);
      oCall.close();
    }

    if (DebugFile.trace) {
       DebugFile.decIdent();
       DebugFile.writeln("End Category.getUserPermissions() : " + String.valueOf(iACLMask));
View Full Code Here

Examples of java.sql.CallableStatement

   * @throws SQLException
   * @since 3.0
   */
  public int getGroupPermissions(Connection oConn, String sIdGroup) throws SQLException {
    int iACLMask;
    CallableStatement oCall;
    Statement oStmt;
    ResultSet oRSet;

    if (DebugFile.trace) {
       DebugFile.writeln("Begin Category.getGroupPermissions([Connection], " + sIdGroup + ")" );
       DebugFile.incIdent();
    }

    if (oConn.getMetaData().getDatabaseProductName().equals("PostgreSQL")) {
      oStmt = oConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);

      if (DebugFile.trace) DebugFile.writeln("Statement.executeQuery(SELECT k_sp_cat_grp_perm ('" + sIdGroup + "','" + getStringNull(DB.gu_category,"null") + "'))");

      oRSet = oStmt.executeQuery("SELECT k_sp_cat_grp_perm ('" + sIdGroup + "','" + getString(DB.gu_category) + "')");
      oRSet.next();
      iACLMask = oRSet.getInt(1);
      oRSet.close();
      oStmt.close();
    }
    else {
      if (DebugFile.trace) DebugFile.writeln("Connection.prepareCall({ call k_sp_cat_grp_perm('" + sIdGroup + "','" + getStringNull(DB.gu_category,null) + "',?) })");

      oCall = oConn.prepareCall("{ call k_sp_cat_grp_perm(?,?,?) }");
      oCall.setString(1, sIdGroup);
      oCall.setString(2, getString(DB.gu_category));
      oCall.registerOutParameter(3, java.sql.Types.INTEGER);
      oCall.execute();
      iACLMask = oCall.getInt(3);
      oCall.close();
    }

    if (DebugFile.trace) {
       DebugFile.decIdent();
       DebugFile.writeln("End Category.getGroupPermissions() : " + String.valueOf(iACLMask));
View Full Code Here

Examples of java.sql.CallableStatement

   * @param iRecurse Remove permissions from child categories.
   * @param iObjects Not used, must be zero.
   * @throws SQLException
   */
  public void removeUserPermissions(Connection oConn, String sIdUsers, short iRecurse, short iObjects) throws SQLException {
    CallableStatement oStmt;
    StringTokenizer oUsrTok;
    int iTokCount;

    if (DebugFile.trace) {
       DebugFile.writeln("Begin Category.removeUserPermissions([Connection], " + sIdUsers + "," + iRecurse + "," + iObjects + ")" );
       DebugFile.incIdent();
       DebugFile.writeln("Connection.prepareCall({ call k_sp_cat_del_usr ('" + getStringNull(DB.gu_category, "null") + "',?," + String.valueOf(iRecurse) + "," + String.valueOf(iObjects) + ") }");
     }

    if (oConn.getMetaData().getDatabaseProductName().equals("PostgreSQL"))
      oStmt = oConn.prepareCall("{ call k_sp_cat_del_usr ('" + getString(DB.gu_category) + "',?, CAST(" + String.valueOf(iRecurse) + " AS SMALLINT), CAST(" + String.valueOf(iObjects) + " AS SMALLINT)) }");
    else
      oStmt = oConn.prepareCall("{ call k_sp_cat_del_usr ('" + getString(DB.gu_category) + "',?," + String.valueOf(iRecurse) + "," + String.valueOf(iObjects) + ") }");

    if (sIdUsers.indexOf(',')>=0) {
      oUsrTok = new StringTokenizer(sIdUsers, ",");
      iTokCount = oUsrTok.countTokens();

      for (int t=0; t<iTokCount; t++) {
        oStmt.setString(1, oUsrTok.nextToken());
        oStmt.execute();
      } // end for ()

      oStmt.close();
    }
    else {
      oStmt.setString(1, sIdUsers);
      oStmt.execute();
      oStmt.close();
    }

    if (DebugFile.trace) {
       DebugFile.decIdent();
       DebugFile.writeln("End Category.Category.removeUserPermissions()");
View Full Code Here

Examples of java.sql.CallableStatement

   * @param iObjects Not used, must be zero.
   * @throws SQLException
   */
  public void setUserPermissions(Connection oConn, String sIdUsers, int iACLMask, short iRecurse, short iObjects) throws SQLException {
    PreparedStatement oStmt = null;
    CallableStatement oCall = null;
    StringTokenizer oUsrTok;
    String sSQL;
    String sUserId;
    int iTokCount;

    if (DebugFile.trace) {
       DebugFile.writeln("Begin Category.setUserPermissions([Connection], " + sIdUsers + "," + iACLMask + "," + iRecurse + "," + iObjects + ")" );
       DebugFile.incIdent();
       DebugFile.writeln("  " + DB.gu_category + "=" + getStringNull(DB.gu_category, "null"));
     }

    if (oConn.getMetaData().getDatabaseProductName().equalsIgnoreCase("PostgreSQL")) {
      sSQL = "SELECT k_sp_cat_set_usr (?,?," + String.valueOf(iACLMask) + ", CAST(" + String.valueOf(iRecurse) + " AS SMALLINT), CAST(" + String.valueOf(iObjects) + " AS SMALLINT))";
      if (DebugFile.trace) DebugFile.writeln("Connection.prepareStatement(" + sSQL + ")");
      oStmt = oConn.prepareStatement(sSQL);
    } else {
      sSQL = "{ call k_sp_cat_set_usr (?,?," + String.valueOf(iACLMask) + "," + String.valueOf(iRecurse) + "," + String.valueOf(iObjects) + ") }";
      if (DebugFile.trace) DebugFile.writeln("Connection.prepareCall(" + sSQL + ")");
      oCall = oConn.prepareCall(sSQL);
    }

    if (sIdUsers.indexOf(',')>0) {
      oUsrTok = new StringTokenizer(sIdUsers, ",");
      iTokCount = oUsrTok.countTokens();

      for (int t=0; t<iTokCount; t++) {
        sUserId = oUsrTok.nextToken();

        if (DebugFile.trace) DebugFile.writeln("binding user " + String.valueOf(t+1) + "/" + String.valueOf(iTokCount) + " " + sUserId);

    if (null!=oCall) {
          oCall.setString(1, getString(DB.gu_category));
          oCall.setString(2, sUserId);
          oCall.execute();
    } else {
          oStmt.setObject(1, getString(DB.gu_category), java.sql.Types.CHAR);
          oStmt.setObject(2, sUserId, java.sql.Types.CHAR);
          oStmt.executeQuery().close();
    }
      } // end for ()

    } else {

      if (DebugFile.trace) DebugFile.writeln("binding user " + sIdUsers);

    if (null!=oCall) {
        oCall.setString(1, getString(DB.gu_category));
        oCall.setString(2, sIdUsers);
        if (DebugFile.trace) DebugFile.writeln("CallableStatement.execute()");
        oCall.execute();
    } else {
        oStmt.setObject(1, getString(DB.gu_category), java.sql.Types.CHAR);
        oStmt.setObject(2, sIdUsers, java.sql.Types.CHAR);
        if (DebugFile.trace) DebugFile.writeln("PreparedStatement.executeQuery()");
        oStmt.executeQuery().close();
    }
    }

    if (DebugFile.trace) DebugFile.writeln("Statement.close()");

    if (null!=oCall) oCall.close();
    if (null!=oStmt) oStmt.close();

    if (DebugFile.trace) {
       DebugFile.decIdent();
       DebugFile.writeln("End Category.setUserPermissions()");
View Full Code Here

Examples of java.sql.CallableStatement

   * @return Category depth evel starting at 1.
   * @throws SQLException
   */
  public int level(JDCConnection oConn) throws SQLException {
    int iLevel;
    CallableStatement oCall;
    Statement oStmt;
    ResultSet oRSet;

    if (oConn.getDataBaseProduct()==JDCConnection.DBMS_POSTGRESQL) {
      oStmt = oConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      oRSet = oStmt.executeQuery("SELECT k_sp_cat_level('" + getString(DB.gu_category) + "')");
      oRSet.next();
      iLevel = oRSet.getInt(1);
      oRSet.close();
      oStmt.close();
    }
    else {
      oCall = oConn.prepareCall("{ call k_sp_cat_level(?,?)}");
      oCall.setString(1, getString(DB.gu_category));
      oCall.registerOutParameter(2, java.sql.Types.INTEGER);
      oCall.execute();
      iLevel = oCall.getInt(2);
      oCall.close();
    }

    return iLevel;
  } // level
View Full Code Here

Examples of java.sql.CallableStatement

   * Expansion tree is stored at k_cat_expand table.
   * @param oConn Database Connection
   * @throws SQLException
   */
  public void expand(Connection oConn) throws SQLException {
    CallableStatement oStmt;

    if (DebugFile.trace) {
      DebugFile.writeln("Begin Category.expand([Connection])");
      DebugFile.incIdent();
      DebugFile.writeln("Connection.prepareCall({ call k_sp_cat_expand ('" + getStringNull(DB.gu_category,"null") + "')}");
    }

    oStmt = oConn.prepareCall("{ call k_sp_cat_expand ('" + getString(DB.gu_category) + "') }");
    oStmt.execute();
    oStmt.close();

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln("End Category.expand()");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.