⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmdboconntionparameterinfokeyvalue.java

📁 梦界家园程序开发基底框架
💻 JAVA
📖 第 1 页 / 共 2 页
字号:

    /**
     * 撪梕偺僙僢僩
     *
     * @param strSqlgroupby
     *            撪梕
     */
    public void setStrSqlgroupby (String string) {
        strSqlgroupby = string;
    }

    /**
     * 尃尷偺僙僢僩
     *
     * @param strRool
     *            尃尷
     */
    public void setStrRool (String string) {
        strRool = string;
    }

    /**
     * 嶍彍僼儔僌偺僙僢僩
     *
     * @param strDelflg
     *            嶍彍僼儔僌
     */
    public void setStrDelflg (String string) {
        strDelflg = string;
    }

    /**
     * 峏怴幰偺僙僢僩
     *
     * @param strUpdater
     *            峏怴幰
     */
    public void setStrUpdater (String string) {
        strUpdater = string;
    }

    /**
     * 峏怴擔帪偺僙僢僩
     *
     * @param strUpdatetime
     *            峏怴擔帪
     */
    public void setStrUpdatetime (String string) {
        strUpdatetime = string;
    }

    public void setUseEntity (boolean useEntity) {
        this.useEntity = useEntity;
    }

    public void setEntityName (String entityName) {
        this.entityName = entityName;
    }

    public boolean isSQLFree () {
        return isSQLFree_;
    }

    public void setSQLFree_ (boolean isSQLFree) {
        this.isSQLFree_ = isSQLFree;
    }

    /////////////////////////////////////////////////
    public synchronized boolean invoker () throws Exception {
        if (isSQLFree_) {
            return true;
        }
        /////////////////////////////////////////////
        // 嬈柋庬椶
        if ("".equals(this.getStrType())) {
            return false;
        } else if (SVC_SELECT.equals(this.getStrType())) {
            return mSQLSelect();
        } else if (SVC_INSERT.equals(this.getStrType())) {
            return mSQLInsert();
        } else if (SVC_UPDATE.equals(this.getStrType())) {
            return mSQLUpdate();
        } else if (SVC_DELETE.equals(this.getStrType())) {
            return mSQLDelete();
        } else if (SVC_PIC_SEL.equals(this.getStrType())) {
            // return mSQLSelect() ;
        } else if (SVC_PIC_CON.equals(this.getStrType())) {
            // return mSQLSelect() ;
        }

        return false;
    }

    private synchronized boolean checkRool () throws Exception {
        // 尃尷*/
       this.getStrRool();
        return true;
    }

    private synchronized boolean mSQLSelect () throws Exception {
        // 尃尷
        if (!checkRool()) {
            return false;
        }
        // 撪梕*/
       if ("".equals(JMUtility.changNvl(this.getStrSqldata()))) {
           return false;
       }

        // 撪梕*/
       if ("".equals(JMUtility.changNvl(this.getStrSqltable()))) {
           return false;
       }

        StringBuffer sql = new StringBuffer();
        sql.append("SELECT ");
        sql.append(this.getStrSqldata());
        sql.append(" FROM ");
        sql.append(this.getStrSqltable());
        // 撪梕*/
       if (!"".equals(JMUtility.changNvl(this.getStrSqlwhere()))) {
           mSQLSetWhere();
           if (!JMCheck.isNull(this.getSQL())) {
               sql.append(" WHERE ");
               sql.append(this.getSQL());
           }
       }
        // 撪梕*/
       if (!"".equals(JMUtility.changNvl(this.getStrSqlorderby()))) {
           sql.append(" ORDER BY ");
           sql.append(this.getStrSqlorderby());
       }
        // 撪梕*/
       if (!"".equals(JMUtility.changNvl(this.getStrSqlgroupby()))) {
           sql.append(" GROUP BY ");
           sql.append(this.getStrSqlgroupby());
       }

        // SQL 専嶕忦審傪曄偊偡傞
        this.setSQL(sql.toString());

        return true;
    }

    private synchronized boolean mSQLInsert () throws Exception {

        // 尃尷
        if (!checkRool()) {
            return false;
        }
        // 撪梕*/
       if ("".equals(JMUtility.changNvl(this.getStrSqldata()))) {
           return false;
       }

        // 撪梕*/
       if ("".equals(JMUtility.changNvl(this.getStrSqltable()))) {
           return false;
       }

        // 撪梕*/
       if ("".equals(JMUtility.changNvl(this.getStrSqlwhere()))) {
           return false;
       }

        StringBuffer sql = new StringBuffer();
        sql.append("INSERT INTO ");
        sql.append(this.getStrSqltable());
        sql.append(" ( ");
        sql.append(this.getStrSqldata());
        sql.append(" ) ");
        sql.append(" VALUES ");
        sql.append(" ( ");
        sql.append(this.getStrSqlwhere());
        sql.append(" ) ");

        // SQL 専嶕忦審傪曄偊偡傞
        this.setSQL(sql.toString());

        return true;
    }

    private synchronized boolean mSQLUpdate () throws Exception {

        // 尃尷
        if (!checkRool()) {
            return false;
        }

        // 撪梕*/
       if ("".equals(JMUtility.changNvl(this.getStrSqldata()))) {
           return false;
       }

        // 撪梕*/
       if ("".equals(JMUtility.changNvl(this.getStrSqltable()))) {
           return false;
       }

        // 撪梕*/
       StringBuffer sql = new StringBuffer();
        sql.append("UPDATE ");
        sql.append(this.getStrSqltable());
        sql.append(" SET ");
        sql.append(this.getStrSqldata());
        if (!"".equals(JMUtility.changNvl(this.getStrSqlwhere()))) {
            mSQLSetWhere();
            if (!JMCheck.isNull(this.getSQL())) {
                sql.append(" WHERE ");
                sql.append(this.getSQL());
            }
        }

        // SQL 専嶕忦審傪曄偊偡傞
        this.setSQL(sql.toString());

        return true;
    }

    private synchronized boolean mSQLDelete () throws Exception {

        // 尃尷
        if (!checkRool()) {
            return false;
        }

        // 撪梕*/
       if ("".equals(JMUtility.changNvl(this.getStrSqltable()))) {
           return false;
       }

        // 撪梕*/
       if ("".equals(JMUtility.changNvl(this.getStrSqldata()))) {
           return false;
       }

        // 撪梕*/
       StringBuffer sql = new StringBuffer();
        sql.append("UPDATE ");
        sql.append(this.getStrSqltable());

        mSQLSetUpdate();
        if (!"".equals(JMUtility.changNvl(this.getSQL()))) {
            sql.append(" SET ");
            sql.append(this.getSQL());
        } else {
            return false;
        }

        if (!"".equals(JMUtility.changNvl(this.getStrSqlwhere()))) {
            mSQLSetWhere();
            if (!JMCheck.isNull(this.getSQL())) {
                sql.append(" WHERE ");
                sql.append(this.getSQL());
            }
        }

        // SQL 専嶕忦審傪曄偊偡傞
        this.setSQL(sql.toString());

        return true;
    }

    /*
     * SQL 専嶕忦審傪曄偊偡傞
     */
    private synchronized boolean mSQLSetWhere () throws Exception {

        JM2DArray aoDbuse = this.getWhere();
        if (aoDbuse == null) {
            aoDbuse = new JM2DArray();
        }
        // SQLID = ? AND NAME = ? AND TYPE = ?
        JMVector<String> oSql_Where = JMUtility
                                      .toJMVector(getStrSqlwhere());

        int size = oSql_Where.size();
        // ? clear
        for (int m = 0; m < size; m++) {
            String asDBsql = oSql_Where.get(m);
            String con = "";
            // 僷儔儊乕僞傪桳岠偩
            if (m > aoDbuse.rowCount() || aoDbuse.rowCount() == 0) {
                if (isAvailability()) {
                    con = ITEM_IS_NULL;
                } else {
                    con = ITEM_REMOVE;
                }
            } else {
                con = aoDbuse.getStringValue(0, m);
            }
            if (ITEM_REMOVE.equals(con)) {
                oSql_Where.set(m, ITEM_REMOVE);
            } else {
                if (ITEM_IS_NULL.equals(con)) {
                    asDBsql = asDBsql.replace("= ?", ITEM_IS_NULL);
                } else if (ITEM_IS_NOT_NULL.equals(con)) {
                    asDBsql = asDBsql.replace("= ?", ITEM_IS_NOT_NULL);
                } else {
                    asDBsql = asDBsql.replace("?", "'" + con + "'");
                }
                // 専嶕忦審傪曄偊偡傞
                if (!JMCheck.isNull(asDBsql)) {
                    oSql_Where.set(m, asDBsql);
                } else {
                    oSql_Where.set(m, ITEM_REMOVE);
                }
            }
        }

        // 専嶕忦審傪嶍彍偡傞
        for (int i = 0; i < oSql_Where.size(); i++) {
            if (ITEM_REMOVE.equals(oSql_Where.get(i))) {
                oSql_Where.remove(i);
            }
        }

        // 専嶕忦審傪惗惉偡傞
        StringBuffer oSql_ALL = new StringBuffer();
        for (int i = 0; i < oSql_Where.size(); i++) {
            if (i != 0) {
                oSql_ALL.append(" AND ");
            }
            oSql_ALL.append(oSql_Where.get(i));
        }
        this.setSQL("" + oSql_ALL);
        return true;

    }

    /*
     * SQL INSERT傪曄偊偡傞
     */
    private synchronized boolean mSQLSetUpdate () throws Exception {

        JM2DArray aoDbuse = getData();
        // SQLID = % ; NAME = % ; TYPE = %
        JMVector<String> oSql_Where = JMUtility.toJMVector(getStrSqldata());
        int size = oSql_Where.size();
        // ? clear
        for (int m = 0; m < size; m++) {
            String asDBsql = oSql_Where.get(m);
            String con = aoDbuse.getStringValue(0, m);
            if (ITEM_IS_PASS.equals(con)) {
                asDBsql = asDBsql.replace("%", "'" + ITEM_BLANK + "'");
                // 専嶕忦審傪曄偊偡傞
                oSql_Where.set(m, asDBsql);
            } else if (ITEM_REMOVE.equals(con)) {
                oSql_Where.set(m, ITEM_REMOVE);
            } else {
                asDBsql = asDBsql.replace("%", "'" + con + "'");
                // 専嶕忦審傪曄偊偡傞
                oSql_Where.set(m, asDBsql);
            }
        }

        // 専嶕忦審傪嶍彍偡傞
        for (int i = 0; i < oSql_Where.size(); i++) {
            if (ITEM_REMOVE.equals(oSql_Where.get(i))) {
                oSql_Where.remove(i);
            }
        }

        // 専嶕忦審傪惗惉偡傞
        StringBuffer oSql_ALL = new StringBuffer();
        for (int i = 0; i < oSql_Where.size(); i++) {
            if (i != 1) {
                oSql_ALL.append(" , ");
            }
            oSql_ALL.append(oSql_Where.get(i));
        }

        this.setSQL("" + oSql_ALL);

        return true;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -