亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sqlbuilder.java

?? 另外一種持久性o/m軟件
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package org.apache.torque.util;/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *     http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */import java.io.Serializable;import java.util.HashSet;import java.util.Iterator;import java.util.List;import java.util.Map;import java.util.Set;import org.apache.commons.lang.StringUtils;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.torque.Torque;import org.apache.torque.TorqueException;import org.apache.torque.adapter.DB;import org.apache.torque.map.ColumnMap;import org.apache.torque.map.DatabaseMap;import org.apache.torque.util.Criteria.Criterion;/** * Factored out code that is used to process SQL tables. This code comes * from BasePeer and is put here to reduce complexity in the BasePeer class. * You should not use the methods here directly! * * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> * @author <a href="mailto:fischer@seitenbau.de">Thomas Fischer</a> * @version $Id: SQLBuilder.java,v 1.6 2005/07/02 15:22:32 tfischer Exp $ */public abstract class SQLBuilder        implements Serializable{    /** Logging */    protected static Log log = LogFactory.getLog(SQLBuilder.class);    /**     * Fully qualify a table name with an optional schema reference     *     * @param table The table name to use. If null is passed in, null is returned.     * @param dbName The name of the database to which this tables belongs.     *               If null is passed, the default database is used.     *     * @return The table name to use inside the SQL statement. If null is passed     *         into this method, null is returned.     * @exception TorqueException if an error occurs     */    public static final String getFullTableName(final String table, final String dbName)            throws TorqueException    {        if (table != null)        {            int dotIndex = table.indexOf(".");            if (dotIndex == -1) // No schema given            {                String targetDBName = (dbName == null)                         ? Torque.getDefaultDB()                        : dbName;                                String targetSchema = Torque.getSchema(targetDBName);                                // If we have a default schema, fully qualify the                // table and return.                if (StringUtils.isNotEmpty(targetSchema))                {                    return new StringBuffer()                            .append(targetSchema)                            .append(".")                            .append(table)                            .toString();                }            }        }        return table;    }    /**     * Remove a possible schema name from the table name.     *     * @param table The table name to use     *     * @return The table name with a possible schema name     *         stripped off     */    public static final String getUnqualifiedTableName(final String table)    {        if (table != null)        {            int dotIndex = table.lastIndexOf("."); // Do we have a dot?            if (++dotIndex > 0) // Incrementation allows for better test _and_ substring...            {                return table.substring(dotIndex);            }        }        return table;    }    /**     * Removes a possible function name or clause from a column name     *     * @param name The column name, possibly containing a clause     *     * @return The column name     *     * @throws TorqueException If the column name was malformed     */    private static String removeSQLFunction(final String name)            throws TorqueException    {        // Empty name => return it        if (StringUtils.isEmpty(name))        {            return name;        }        final int leftParent = name.lastIndexOf('(');        final int rightParent = name.indexOf(')');        // Do we have Parentheses?        if (leftParent < 0)        {            if (rightParent < 0)            {                // No left, no right => No function ==> return it                return name;            }        }        // We have a left parenthesis. Is the right one behind it?        if (rightParent > leftParent)        {            // Yes. Strip off the function, return the column name            return name.substring(leftParent + 1, rightParent);        }        // Bracket mismatch or wrong order ==> Exception        throwMalformedColumnNameException(                "removeSQLFunction",                name);        return null; // Ugh    }        /**     * Removes possible qualifiers (like DISTINCT) from a column name     *     * @param name The column name, possibly containing qualifiers     *     * @return The column name     *     * @throws TorqueException If the column name was malformed     */    private static String removeQualifiers(final String name)            throws TorqueException    {        // Empty name => return it        if (StringUtils.isEmpty(name))        {            return name;        }        final int spacePos = name.trim().lastIndexOf(' ');        // Do we have spaces, indicating that qualifiers are used ?        if (spacePos > 0)        {            // Qualifiers are first, tablename is piece after last space            return name.trim().substring(spacePos + 1);        }                // no spaces, nothing changed        return name;    }        /**     * Returns a table name from an identifier. Each identifier is to be qualified      * as [schema.]table.column. This could also contain FUNCTION([schema.]table.column).     *     * @param name The (possible fully qualified) identifier name     *     * @return the fully qualified table name     *     * @throws TorqueException If the identifier name was malformed     */    public static String getTableName(final String name, final String dbName)            throws TorqueException    {        final String testName = removeQualifiers(removeSQLFunction(name));        if (StringUtils.isEmpty(testName))        {            throwMalformedColumnNameException(                    "getTableName",                    name);        }        // Everything before the last dot is the table name        int rightDotIndex = testName.lastIndexOf('.');        if (rightDotIndex < 0)        {            if ("*".equals(testName))            {                return null;            }            throwMalformedColumnNameException(                    "getTableName",                    name);        }        return getFullTableName(testName.substring(0, rightDotIndex), dbName);    }                            /**     * Returns a set of all tables and possible aliases referenced     * from a criterion. The resulting Set can be directly used to     * build a WHERE clause     *     * @param crit A Criteria object     * @param tableCallback A Callback Object     * @return A Set of tables.     */    public static final Set getTableSet(            final Criteria crit,            final TableCallback tableCallback)    {        HashSet tables = new HashSet();        // Loop over all the Criterions        for (Iterator it = crit.keySet().iterator(); it.hasNext(); )        {            String key = (String) it.next();            Criteria.Criterion c = crit.getCriterion(key);            List tableNames = c.getAllTables();            // Loop over all Tables referenced in this criterion.             for (Iterator it2 = tableNames.iterator(); it2.hasNext(); )            {                String name = (String) it2.next();                String aliasName = crit.getTableForAlias(name);                // If the tables have an alias, add an "<xxx> AS <yyy> statement"                if (StringUtils.isNotEmpty(aliasName))                {                    String newName =                             new StringBuffer(name.length() + aliasName.length() + 4)                            .append(aliasName)                            .append(" AS ")                            .append(name)                            .toString();                    name = newName;                }                tables.add(name);            }            if (tableCallback != null)            {                tableCallback.process(tables, key, crit);            }        }                return tables;    }    /**     * Builds a Query clause for Updating and deleting     *     * @param crit a <code>Criteria</code> value     * @param params a <code>List</code> value     * @param qc a <code>QueryCallback</code> value     * @return a <code>Query</code> value     * @exception TorqueException if an error occurs     */    public static final Query buildQueryClause(final Criteria crit,            final List params,             final QueryCallback qc)            throws TorqueException    {        Query query = new Query();        final String dbName = crit.getDbName();        final DB db = Torque.getDB(dbName);        final DatabaseMap dbMap = Torque.getDatabaseMap(dbName);        JoinBuilder.processJoins(db, dbMap, crit, query);        processModifiers(crit, query);        processSelectColumns(crit, query, dbName);        processAsColumns(crit, query);        processCriterions(db, dbMap, dbName, crit, query,  params, qc);        processGroupBy(crit, query);        processHaving(crit, query);        processOrderBy(db, dbMap, crit, query);        LimitHelper.buildLimit(crit, query);        if (log.isDebugEnabled())        {            log.debug(query.toString());        }        return query;    }    /**     * adds the select columns from the criteria to the query     * @param criteria the criteria from which the select columns are taken     * @param query the query to which the select columns should be added     * @throws TorqueException if the select columns can not be processed      */    private static final void processSelectColumns(            final Criteria criteria,            final Query query,            final String dbName)        throws TorqueException    {        UniqueList selectClause = query.getSelectClause();        UniqueList select = criteria.getSelectColumns();                for (int i = 0; i < select.size(); i++)        {            String identifier = (String) select.get(i);            selectClause.add(identifier);            addTableToFromClause(getTableName(identifier, dbName), criteria, query);         }    }        /**     * adds the As-columns from the criteria to the query.     * @param criteria the criteria from which the As-columns are taken     * @param query the query to which the As-columns should be added     */    private static final void processAsColumns(            final Criteria criteria,            final Query query)     {        UniqueList querySelectClause = query.getSelectClause();        Map criteriaAsColumns = criteria.getAsColumns();              for (Iterator it = criteriaAsColumns.keySet().iterator(); it.hasNext(); )        {            String key = (String) it.next();            querySelectClause.add(                    new StringBuffer()                    .append(criteriaAsColumns.get(key))                    .append(SqlEnum.AS)                    .append(key)                    .toString());        }    }        /**     * adds the Modifiers from the criteria to the query     * @param criteria the criteria from which the Modifiers are taken     * @param query the query to which the Modifiers should be added     */    private static final void processModifiers(            final Criteria criteria,            final Query query)     {        UniqueList selectModifiers = query.getSelectModifiers();        UniqueList modifiers = criteria.getSelectModifiers();        for (int i = 0; i < modifiers.size(); i++)        {            selectModifiers.add(modifiers.get(i));        }    }    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲bdsm女犯bdsm网站| 99re在线精品| 91丨九色丨蝌蚪丨老版| 51精品视频一区二区三区| 欧美激情一区不卡| 日本欧美加勒比视频| 91日韩一区二区三区| 久久一区二区三区四区| 亚洲成人av电影| a4yy欧美一区二区三区| 久久久久久久久久久久久夜| 一区二区三区日韩欧美精品| 国产aⅴ精品一区二区三区色成熟| 欧美三区在线视频| 亚洲人吸女人奶水| 懂色av一区二区夜夜嗨| 久久亚洲精品国产精品紫薇| 日本少妇一区二区| 欧美日韩精品福利| 有码一区二区三区| 色综合天天做天天爱| 综合久久给合久久狠狠狠97色| 国产精选一区二区三区| 欧美一区二区三区播放老司机| 亚洲永久精品国产| 欧美午夜精品免费| 亚洲三级在线免费观看| av不卡一区二区三区| 中文字幕中文在线不卡住| 丁香婷婷综合五月| 久久久久久麻豆| 国产一区二区在线看| 久久夜色精品国产欧美乱极品| 狠狠色狠狠色合久久伊人| 精品乱码亚洲一区二区不卡| 九九精品一区二区| 久久综合九色综合97婷婷女人| 国产自产高清不卡| 久久久久久一二三区| 国产很黄免费观看久久| 国产精品久久久久影院亚瑟| 成人av片在线观看| 一区二区三区精品| 欧美日韩视频在线观看一区二区三区| 亚洲第一福利视频在线| 91精品国产高清一区二区三区蜜臀| 日韩主播视频在线| 日韩精品一区二区三区中文精品| 黄页网站大全一区二区| 久久久久久久性| 成人av在线一区二区三区| 亚洲色图第一区| 欧美性受极品xxxx喷水| 日韩国产精品91| 精品国产欧美一区二区| 国产精品1024| 亚洲女爱视频在线| 777xxx欧美| 国产精品1区2区| 亚洲视频香蕉人妖| 91精选在线观看| 国产精品91一区二区| 一区二区三区欧美| 欧美成人性福生活免费看| 成人美女视频在线观看18| 亚洲综合一二三区| 欧美一级理论片| 懂色av一区二区在线播放| 亚洲国产精品影院| 久久精品日产第一区二区三区高清版| 成人av网站免费| 日韩国产在线观看一区| 久久精品视频网| 欧美日韩高清一区二区三区| 国产综合色视频| 一区二区欧美国产| 国产三级精品三级| 欧美日韩在线播放三区四区| 国产酒店精品激情| 亚洲不卡在线观看| 国产精品私人影院| 91精品中文字幕一区二区三区| 国产.欧美.日韩| 视频一区二区三区在线| 国产精品视频在线看| 这里只有精品视频在线观看| 国产成人免费视频一区| 日韩国产精品大片| 亚洲美女电影在线| 久久只精品国产| 555www色欧美视频| 日本精品免费观看高清观看| 免播放器亚洲一区| 亚洲第一久久影院| 亚洲免费看黄网站| 国产精品美女久久久久久2018| 日韩精品中文字幕一区| 欧美精品一二三区| 欧美日本高清视频在线观看| 91电影在线观看| 99精品黄色片免费大全| 国产91精品一区二区麻豆亚洲| 免费成人小视频| 蜜臀久久久99精品久久久久久| 亚洲一区在线视频观看| 亚洲欧美日韩系列| 亚洲欧洲综合另类在线| 亚洲视频一区二区在线观看| 中文字幕在线不卡一区| 国产女主播一区| 国产喂奶挤奶一区二区三区| 国产午夜三级一区二区三| 欧美一区二区高清| 3d动漫精品啪啪一区二区竹菊| 在线观看国产日韩| 欧美亚洲综合色| 欧洲一区在线观看| 欧亚洲嫩模精品一区三区| 91九色最新地址| 欧美在线播放高清精品| 欧美亚洲综合网| 91精品国产欧美一区二区| 日韩欧美亚洲一区二区| 久久婷婷国产综合国色天香| 久久亚洲一区二区三区明星换脸| 久久精品视频一区二区三区| 国产欧美日本一区视频| 国产女人水真多18毛片18精品视频| 久久理论电影网| 国产精品私人影院| 亚洲一区免费在线观看| 日韩电影免费一区| 麻豆91在线观看| 久久aⅴ国产欧美74aaa| 国产乱码精品1区2区3区| 成人18精品视频| 欧美视频在线一区| 欧美α欧美αv大片| 中文字幕av一区 二区| 亚洲精品中文在线观看| 亚洲无线码一区二区三区| 日本午夜精品一区二区三区电影| 成人综合在线网站| 欧洲av一区二区嗯嗯嗯啊| 日韩欧美亚洲国产精品字幕久久久| 久久无码av三级| 亚洲同性gay激情无套| 亚洲一区二区三区在线| 免费观看30秒视频久久| 成人h动漫精品| 91麻豆精品久久久久蜜臀 | 国产精品国产三级国产普通话三级 | 精品国产91九色蝌蚪| 国产欧美日韩中文久久| 亚洲精品久久久蜜桃| 日韩黄色片在线观看| 久久国产尿小便嘘嘘尿| 91在线你懂得| 日韩视频永久免费| 亚洲日本va在线观看| 日韩av不卡一区二区| 岛国一区二区在线观看| 欧美日本视频在线| 国产精品久久一卡二卡| 亚洲无人区一区| 成人高清伦理免费影院在线观看| 在线不卡一区二区| 日韩毛片视频在线看| 九九国产精品视频| 欧美日韩电影在线| 综合婷婷亚洲小说| 国产精品亚洲一区二区三区妖精| 欧美三电影在线| 亚洲欧美激情插 | 欧洲一区在线观看| 国产精品天天摸av网| 久草热8精品视频在线观看| 在线观看三级视频欧美| 最新中文字幕一区二区三区| 看电视剧不卡顿的网站| 欧美久久久久中文字幕| 亚洲线精品一区二区三区| 成人av网站在线观看免费| www欧美成人18+| 蜜臀久久久99精品久久久久久| 精品视频色一区| 亚洲无人区一区| 欧美在线观看你懂的| 亚洲欧美日本韩国| 99亚偷拍自图区亚洲| 亚洲国产精品精华液2区45| 国产乱色国产精品免费视频| 精品福利一二区| 狠狠网亚洲精品| 2020国产成人综合网| 韩国三级在线一区| 久久综合狠狠综合| 国产毛片精品视频| 久久久精品天堂| 国产99久久久精品|