+ throw new BuilderException("The properties element cannot specify both a URL and a resource based property file reference. Please specify one or the other.");
- if ("auto_increment".equals(results.getString("EXTRA"))) {
- autoIncrement = true;
- }
- idMap.put(field, new IdInfo(field, autoIncrement));
- }
- }
- }
- if (isOracle) {
- /* ORACLE 主键ID 处理方式 */
- String idSql = String.format("SELECT A.COLUMN_NAME FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME AND B.CONSTRAINT_TYPE = 'P' AND A.TABLE_NAME = '%s'", table);
- * 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.
- */
-package com.baomidou.mybatisplus.generator;
-
-/**
- * <p>
- * 数据源配置
- * </p>
- *
- * @author hubin
- * @Date 2016-04-25
- */
-public enum ConfigDataSource {
- MYSQL("mysql", "show tables", "show table status", "show full fields from %s", "NAME", "COMMENT"
- ,"FIELD","TYPE","COMMENT","KEY"),
- ORACLE("oracle", "SELECT * FROM USER_TABLES", "SELECT * FROM USER_TAB_COMMENTS",
- "SELECT A.COLUMN_NAME, A.DATA_TYPE, B.COMMENTS FROM USER_TAB_COLUMNS A, USER_COL_COMMENTS B WHERE A.TABLE_NAME=B.TABLE_NAME AND A.COLUMN_NAME = B.COLUMN_NAME AND A.TABLE_NAME='%s'",
+ "select cast(name as varchar(500)) as TABLE_NAME from sysObjects where xtype='U' order by name",
+ "select name as TABLE_NAME,(select cast(value as varchar(500)) from sys.extended_properties where major_id=id and minor_id = 0) as COMMENTS from sysobjects where xtype='U'",
+ "SELECT cast(a.name as varchar(500)) AS TABLE_NAME, cast(b.name as varchar(500)) AS COLUMN_NAME, "
+ + "cast(c.value as varchar(500)) AS COMMENTS,cast(sys.types.name as varchar(500)) as DATA_TYPE,"
+ + "(" + " SELECT case count(1) when 1 then 'PRI' else '' end"
+ + " FROM syscolumns,sysobjects,sysindexes,sysindexkeys,systypes "
+ + " WHERE syscolumns.xusertype = systypes.xusertype and syscolumns.id = object_id(A.name) AND sysobjects.xtype = 'PK'"
+ + " AND sysobjects.parent_obj = syscolumns.id " + " AND sysindexes.id = syscolumns.id "
+ + " AND sysobjects.name = sysindexes.name AND sysindexkeys.id = syscolumns.id "
+ + " AND sysindexkeys.indid = sysindexes.indid "
+ + " AND syscolumns.colid = sysindexkeys.colid and syscolumns.name = B.name) as 'KEY'"
+ + " FROM sys.tables a " + " INNER JOIN sys.columns b ON b.object_id = a.object_id"
+ + " left join sys.types on b.system_type_id=sys.types.system_type_id "
+ + " LEFT JOIN sys.extended_properties c ON c.major_id = b.object_id AND c.minor_id = b.column_id "
+ POSTGRE_SQL("postgre_sql", "select tablename from pg_tables where schemaname='public' ORDER BY tablename",
+ "SELECT A.tablename, obj_description(relfilenode, 'pg_class') AS comments FROM pg_tables A, pg_class B WHERE A.schemaname='public' AND A.tablename = B.relname",
+ "SELECT A.attname AS name,format_type(A.atttypid,A.atttypmod) AS type,col_description(A.attrelid,A.attnum) AS comment,(CASE C.contype WHEN 'p' THEN 'PRI' ELSE '' END) AS key"
+ + " FROM pg_attribute A INNER JOIN pg_class B ON A.attrelid = B.oid"
+ + " LEFT JOIN pg_constraint C ON A.attnum = C.conkey[1] WHERE B.relname = '%s' AND A.attnum>0",