Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
0a837e02
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0a837e02
编写于
7月 28, 2021
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
支持GBase华库数据库
上级
d45a8016
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
523 addition
and
7 deletion
+523
-7
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attendanceworkdayconfig/ActionListWithFilter.java
...l/jaxrs/attendanceworkdayconfig/ActionListWithFilter.java
+4
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/SlicePropertiesBuilder.java
...x/base/core/container/factory/SlicePropertiesBuilder.java
+15
-5
o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/GBaseMySQLDictionary.java
...om/x/base/core/openjpa/jdbc/sql/GBaseMySQLDictionary.java
+504
-0
o2server/x_console/src/main/java/com/x/server/console/InstrumentationAgent.java
.../main/java/com/x/server/console/InstrumentationAgent.java
+0
-1
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/ThisApplication.java
...in/java/com/x/query/assemble/surface/ThisApplication.java
+0
-1
未找到文件。
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attendanceworkdayconfig/ActionListWithFilter.java
浏览文件 @
0a837e02
...
...
@@ -15,6 +15,7 @@ import com.x.attendance.entity.AttendanceWorkDayConfig;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
...
...
@@ -91,10 +92,13 @@ public class ActionListWithFilter extends BaseAction {
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"名称"
)
private
String
q_Name
=
null
;
@FieldDescribe
(
"年"
)
private
String
q_Year
=
null
;
@FieldDescribe
(
"月"
)
private
String
q_Month
=
null
;
public
String
getQ_Name
()
{
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/SlicePropertiesBuilder.java
浏览文件 @
0a837e02
...
...
@@ -17,6 +17,7 @@ public class SlicePropertiesBuilder {
public
static
String
driver_dm
=
"dm.jdbc.driver.DmDriver"
;
public
static
String
driver_sqlserver
=
"com.microsoft.sqlserver.jdbc.SQLServerDriver"
;
public
static
String
driver_gbase
=
"com.gbasedbt.jdbc.Driver"
;
public
static
String
driver_gbasemysql
=
"com.gbase.cj.jdbc.Driver"
;
public
static
String
driver_kingbase
=
"com.kingbase.Driver"
;
public
static
String
driver_kingbase8
=
"com.kingbase8.Driver"
;
public
static
String
driver_oscar
=
"com.oscar.Driver"
;
...
...
@@ -30,6 +31,7 @@ public class SlicePropertiesBuilder {
public
static
String
dictionary_dm
=
"com.x.base.core.openjpa.jdbc.sql.DMDictionary"
;
public
static
String
dictionary_sqlserver
=
"sqlserver(schemaCase=preserve)"
;
public
static
String
dictionary_gbase
=
"com.x.base.core.openjpa.jdbc.sql.GBaseDictionary"
;
public
static
String
dictionary_gbasemysql
=
"com.x.base.core.openjpa.jdbc.sql.GBaseMySQLDictionary"
;
public
static
String
dictionary_kingbase
=
"com.x.base.core.openjpa.jdbc.sql.KingbaseDictionary"
;
public
static
String
dictionary_kingbase8
=
"com.x.base.core.openjpa.jdbc.sql.Kingbase8Dictionary"
;
public
static
String
dictionary_oscar
=
"com.x.base.core.openjpa.jdbc.sql.OscarDictionary"
;
...
...
@@ -42,8 +44,8 @@ public class SlicePropertiesBuilder {
public
static
String
validationQuery_h2
=
"select 1"
;
public
static
String
validationQuery_dm
=
"select getdate()"
;
public
static
String
validationQuery_sqlserver
=
"select 1"
;
// public static String validationQuery_gbase = "select 1";
public
static
String
validationQuery_gbase
=
"select 1 from dual"
;
public
static
String
validationQuery_gbasemysql
=
"select now()"
;
public
static
String
validationQuery_kingbase
=
"select now()"
;
public
static
String
validationQuery_kingbase8
=
"select now()"
;
public
static
String
validationQuery_oscar
=
"select 1 from dual"
;
...
...
@@ -68,8 +70,10 @@ public class SlicePropertiesBuilder {
return
driver_postgresql
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:informix-sqli:"
))
{
return
driver_informix
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli"
))
{
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli
:
"
))
{
return
driver_gbase
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbase:"
))
{
return
driver_gbasemysql
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:h2:tcp:"
))
{
return
driver_h2
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:dm:"
))
{
...
...
@@ -97,8 +101,10 @@ public class SlicePropertiesBuilder {
return
dictionary_postgresql
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:informix-sqli:"
))
{
return
dictionary_informix
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli"
))
{
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli
:
"
))
{
return
dictionary_gbase
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbase:"
))
{
return
dictionary_gbasemysql
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:h2:tcp:"
))
{
return
dictionary_h2
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:dm:"
))
{
...
...
@@ -126,8 +132,10 @@ public class SlicePropertiesBuilder {
return
false
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:informix-sqli:"
))
{
return
true
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli"
))
{
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli
:
"
))
{
return
true
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbase:"
))
{
return
false
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:h2:tcp:"
))
{
return
false
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:dm:"
))
{
...
...
@@ -155,8 +163,10 @@ public class SlicePropertiesBuilder {
return
validationQuery_postgresql
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:informix-sqli:"
))
{
return
validationQuery_informix
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli"
))
{
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbasedbt-sqli
:
"
))
{
return
validationQuery_gbase
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:gbase:"
))
{
return
validationQuery_gbasemysql
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:h2:tcp:"
))
{
return
validationQuery_h2
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
url
,
"jdbc:dm:"
))
{
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/GBaseMySQLDictionary.java
0 → 100644
浏览文件 @
0a837e02
package
com.x.base.core.openjpa.jdbc.sql
;
import
java.sql.Connection
;
import
java.sql.DatabaseMetaData
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Types
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.openjpa.jdbc.identifier.DBIdentifier
;
import
org.apache.openjpa.jdbc.identifier.DBIdentifier.DBIdentifierType
;
import
org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration
;
import
org.apache.openjpa.jdbc.kernel.JDBCStore
;
import
org.apache.openjpa.jdbc.kernel.exps.FilterValue
;
import
org.apache.openjpa.jdbc.schema.Column
;
import
org.apache.openjpa.jdbc.schema.ForeignKey
;
import
org.apache.openjpa.jdbc.schema.Index
;
import
org.apache.openjpa.jdbc.schema.PrimaryKey
;
import
org.apache.openjpa.jdbc.schema.Table
;
import
org.apache.openjpa.jdbc.sql.DBDictionary
;
import
org.apache.openjpa.jdbc.sql.SQLBuffer
;
import
org.apache.openjpa.jdbc.sql.Select
;
import
org.apache.openjpa.lib.util.StringUtil
;
import
org.apache.openjpa.util.StoreException
;
public
class
GBaseMySQLDictionary
extends
DBDictionary
{
public
static
final
String
SELECT_HINT
=
"openjpa.hint.MySQLSelectHint"
;
public
static
final
String
DELIMITER_BACK_TICK
=
"`"
;
/**
* The MySQL table type to use when creating tables; defaults to innodb.
*/
// public String tableType = "innodb";
public
String
tableType
=
"AcidDB"
;
/**
* Whether to use clobs; defaults to true. Set this to false if you have an old
* version of MySQL which does not handle clobs properly.
*/
public
boolean
useClobs
=
true
;
/**
* Whether the driver automatically deserializes blobs.
*/
public
boolean
driverDeserializesBlobs
=
false
;
/**
* Whether to inline multi-table bulk-delete operations into MySQL's combined
* <code>DELETE FROM foo, bar, baz</code> syntax. Defaults to false, since this
* may fail in the presence of InnoDB tables with foreign keys.
*
* @link http://dev.mysql.com/doc/refman/5.0/en/delete.html
*/
public
boolean
optimizeMultiTableDeletes
=
false
;
public
static
final
String
tinyBlobTypeName
=
"TINYBLOB"
;
public
static
final
String
mediumBlobTypeName
=
"MEDIUMBLOB"
;
public
static
final
String
longBlobTypeName
=
"LONGBLOB"
;
public
static
final
String
tinyTextTypeName
=
"TINYTEXT"
;
public
static
final
String
mediumTextTypeName
=
"MEDIUMTEXT"
;
public
static
final
String
longTextTypeName
=
"LONGTEXT"
;
public
GBaseMySQLDictionary
()
{
platform
=
"GBaseMySQL"
;
validationSQL
=
"SELECT NOW()"
;
distinctCountColumnSeparator
=
","
;
supportsUniqueConstraints
=
true
;
supportsDeferredConstraints
=
false
;
constraintNameMode
=
CONS_NAME_MID
;
supportsMultipleNontransactionalResultSets
=
false
;
requiresAliasForSubselect
=
true
;
// new versions
requiresTargetForDelete
=
true
;
supportsSelectStartIndex
=
true
;
supportsSelectEndIndex
=
true
;
datePrecision
=
MICRO
;
concatenateFunction
=
"CONCAT({0},{1})"
;
maxTableNameLength
=
64
;
maxColumnNameLength
=
64
;
maxIndexNameLength
=
64
;
maxConstraintNameLength
=
64
;
maxIndexesPerTable
=
64
;
schemaCase
=
SCHEMA_CASE_PRESERVE
;
supportsAutoAssign
=
true
;
lastGeneratedKeyQuery
=
"SELECT LAST_INSERT_ID()"
;
autoAssignClause
=
"AUTO_INCREMENT"
;
clobTypeName
=
"TEXT"
;
longVarcharTypeName
=
"TEXT"
;
longVarbinaryTypeName
=
"LONG VARBINARY"
;
timestampTypeName
=
"DATETIME"
;
xmlTypeName
=
"TEXT"
;
fixedSizeTypeNameSet
.
addAll
(
Arrays
.
asList
(
new
String
[]
{
"BOOL"
,
"LONG VARBINARY"
,
"MEDIUMBLOB"
,
"LONGBLOB"
,
"TINYBLOB"
,
"LONG VARCHAR"
,
"MEDIUMTEXT"
,
"LONGTEXT"
,
"TEXT"
,
"TINYTEXT"
,
"DOUBLE PRECISION"
,
"ENUM"
,
"SET"
,
"DATETIME"
,
}));
reservedWordSet
.
addAll
(
Arrays
.
asList
(
new
String
[]
{
"AUTO_INCREMENT"
,
"BINARY"
,
"BLOB"
,
"CHANGE"
,
"ENUM"
,
"INFILE"
,
"INT1"
,
"INT2"
,
"INT4"
,
"FLOAT1"
,
"FLOAT2"
,
"FLOAT4"
,
"LOAD"
,
"MEDIUMINT"
,
"OUTFILE"
,
"REPLACE"
,
"STARTING"
,
"TEXT"
,
"UNSIGNED"
,
"ZEROFILL"
,
"INDEX"
,
}));
// reservedWordSet subset that CANNOT be used as valid column names
// (i.e., without surrounding them with double-quotes)
// generated at 2021-05-02T15:40:16.383 via
// org.apache.openjpa.reservedwords.ReservedWordsIT
invalidColumnWordSet
.
addAll
(
Arrays
.
asList
(
new
String
[]
{
"ADD"
,
"ALL"
,
"ALTER"
,
"ANALYZE"
,
"AND"
,
"AS"
,
"ASC"
,
"ASENSITIVE"
,
"BEFORE"
,
"BETWEEN"
,
"BIGINT"
,
"BINARY"
,
"BLOB"
,
"BOTH"
,
"BY"
,
"CALL"
,
"CASCADE"
,
"CASE"
,
"CHANGE"
,
"CHAR"
,
"CHARACTER"
,
"CHECK"
,
"COLLATE"
,
"COLUMN"
,
"CONDITION"
,
"CONSTRAINT"
,
"CONTINUE"
,
"CONVERT"
,
"CREATE"
,
"CROSS"
,
"CURRENT_DATE"
,
"CURRENT_TIME"
,
"CURRENT_TIMESTAMP"
,
"CURRENT_USER"
,
"CURSOR"
,
"DATABASE"
,
"DATABASES"
,
"DAY_HOUR"
,
"DAY_MICROSECOND"
,
"DAY_MINUTE"
,
"DAY_SECOND"
,
"DEC"
,
"DECIMAL"
,
"DECLARE"
,
"DEFAULT"
,
"DELAYED"
,
"DELETE"
,
"DESC"
,
"DESCRIBE"
,
"DETERMINISTIC"
,
"DISTINCT"
,
"DISTINCTROW"
,
"DIV"
,
"DOUBLE"
,
"DROP"
,
"DUAL"
,
"EACH"
,
"ELSE"
,
"ELSEIF"
,
"ENCLOSED"
,
"END-EXEC"
,
"ESCAPED"
,
"EXISTS"
,
"EXIT"
,
"EXPLAIN"
,
"FALSE"
,
"FETCH"
,
"FLOAT"
,
"FLOAT4"
,
"FLOAT8"
,
"FOR"
,
"FORCE"
,
"FOREIGN"
,
"FROM"
,
"FULLTEXT"
,
"GENERATED"
,
"GET"
,
"GRANT"
,
"GROUP"
,
"HAVING"
,
"HIGH_PRIORITY"
,
"HOUR_MICROSECOND"
,
"HOUR_MINUTE"
,
"HOUR_SECOND"
,
"IF"
,
"IGNORE"
,
"IN"
,
"INDEX"
,
"INFILE"
,
"INNER"
,
"INOUT"
,
"INSENSITIVE"
,
"INSERT"
,
"INT"
,
"INT1"
,
"INT2"
,
"INT3"
,
"INT4"
,
"INT8"
,
"INTEGER"
,
"INTERVAL"
,
"INTO"
,
"IS"
,
"ITERATE"
,
"JOIN"
,
"KEY"
,
"KEYS"
,
"KILL"
,
"LEADING"
,
"LEAVE"
,
"LEFT"
,
"LIKE"
,
"LIMIT"
,
"LINES"
,
"LOAD"
,
"LOCALTIME"
,
"LOCALTIMESTAMP"
,
"LOCK"
,
"LONG"
,
"LONGBLOB"
,
"LONGTEXT"
,
"LOOP"
,
"LOW_PRIORITY"
,
"MATCH"
,
"MAXVALUE"
,
"MEDIUMBLOB"
,
"MEDIUMINT"
,
"MEDIUMTEXT"
,
"MIDDLEINT"
,
"MINUTE_MICROSECOND"
,
"MINUTE_SECOND"
,
"MOD"
,
"MODIFIES"
,
"NATURAL"
,
"NO_WRITE_TO_BINLOG"
,
"NOT"
,
"NULL"
,
"NUMERIC"
,
"ON"
,
"OPTIMIZE"
,
"OPTION"
,
"OPTIONALLY"
,
"OR"
,
"ORDER"
,
"OUT"
,
"OUTER"
,
"OUTFILE"
,
"PARTITION"
,
"PRECISION"
,
"PRIMARY"
,
"PROCEDURE"
,
"PURGE"
,
"RANGE"
,
"READ"
,
"READS"
,
"REAL"
,
"REFERENCES"
,
"REGEXP"
,
"RELEASE"
,
"RENAME"
,
"REPEAT"
,
"REPLACE"
,
"REQUIRE"
,
"RESIGNAL"
,
"RESTRICT"
,
"RETURN"
,
"REVOKE"
,
"RIGHT"
,
"RLIKE"
,
"SCHEMA"
,
"SCHEMAS"
,
"SECOND_MICROSECOND"
,
"SENSITIVE"
,
"SEPARATOR"
,
"SET"
,
"SHOW"
,
"SIGNAL"
,
"SMALLINT"
,
"SPATIAL"
,
"SPECIFIC"
,
"SQL"
,
"SQL_BIG_RESULT"
,
"SQL_CALC_FOUND_ROWS"
,
"SQL_SMALL_RESULT"
,
"SQLEXCEPTION"
,
"SQLSTATE"
,
"SQLWARNING"
,
"SSL"
,
"STARTING"
,
"STRAIGHT_JOIN"
,
"TABLE"
,
"TERMINATED"
,
"THEN"
,
"TINYBLOB"
,
"TINYINT"
,
"TINYTEXT"
,
"TO"
,
"TRAILING"
,
"TRIGGER"
,
"TRUE"
,
"UNDO"
,
"UNION"
,
"UNIQUE"
,
"UNLOCK"
,
"UNSIGNED"
,
"UPDATE"
,
"USAGE"
,
"USE"
,
"USING"
,
"UTC_DATE"
,
"UTC_TIME"
,
"UTC_TIMESTAMP"
,
"VALUES"
,
"VARBINARY"
,
"VARCHAR"
,
"VARCHARACTER"
,
"VARYING"
,
"WHEN"
,
"WHERE"
,
"WHILE"
,
"WITH"
,
"WRITE"
,
"XOR"
,
"YEAR_MONTH"
,
"ZEROFILL"
,
// end generated.
// the following keywords used to be defined as reserved words in the past, but
// now seem to work
// we still add them for compat reasons
"INDEX"
,
"SELECT"
}));
requiresSearchStringEscapeForLike
=
true
;
// MySQL requires double-escape for strings
searchStringEscape
=
"\\\\"
;
typeModifierSet
.
addAll
(
Arrays
.
asList
(
new
String
[]
{
"UNSIGNED"
,
"ZEROFILL"
}));
setLeadingDelimiter
(
DELIMITER_BACK_TICK
);
setTrailingDelimiter
(
DELIMITER_BACK_TICK
);
fixedSizeTypeNameSet
.
remove
(
"NUMERIC"
);
dateFractionDigits
=
0
;
}
@Override
public
void
connectedConfiguration
(
Connection
conn
)
throws
SQLException
{
super
.
connectedConfiguration
(
conn
);
DatabaseMetaData
metaData
=
conn
.
getMetaData
();
int
maj
=
0
;
int
min
=
0
;
if
(
isJDBC3
)
{
maj
=
metaData
.
getDatabaseMajorVersion
();
min
=
metaData
.
getDatabaseMinorVersion
();
}
else
{
try
{
// The product version looks like 4.1.3-nt or 5.1.30
String
productVersion
=
metaData
.
getDatabaseProductVersion
();
int
[]
versions
=
getMajorMinorVersions
(
productVersion
);
maj
=
versions
[
0
];
min
=
versions
[
1
];
}
catch
(
IllegalArgumentException
e
)
{
// we don't understand the version format.
// That is ok. We just take the default values.
if
(
log
.
isWarnEnabled
())
log
.
warn
(
e
.
toString
(),
e
);
}
}
if
(
maj
<
4
||
(
maj
==
4
&&
min
<
1
))
{
supportsSubselect
=
false
;
allowsAliasInBulkClause
=
false
;
supportsForeignKeysComposite
=
false
;
}
if
(
maj
>
5
||
(
maj
==
5
&&
min
>=
1
))
{
supportsXMLColumn
=
true
;
}
if
(
maj
>
5
||
(
maj
==
5
&&
min
>=
7
))
{
// from this version on MySQL supports fractions of a second
timestampTypeName
=
"DATETIME{0}"
;
fixedSizeTypeNameSet
.
remove
(
timestampTypeName
);
fractionalTypeNameSet
.
add
(
timestampTypeName
);
}
if
(
metaData
.
getDriverMajorVersion
()
<
5
)
{
driverDeserializesBlobs
=
true
;
}
}
// @Override
// public Connection decorate(Connection conn) throws SQLException {
// conn = super.decorate(conn);
// String driver = conf.getConnectionDriverName();
// if ("com.mysql.jdbc.ReplicationDriver".equals(driver))
// conn.setReadOnly(true);
// return conn;
// }
private
static
int
[]
getMajorMinorVersions
(
String
versionStr
)
throws
IllegalArgumentException
{
int
beginIndex
=
0
;
versionStr
=
versionStr
.
trim
();
char
[]
charArr
=
versionStr
.
toCharArray
();
for
(
int
i
=
0
;
i
<
charArr
.
length
;
i
++)
{
if
(
Character
.
isDigit
(
charArr
[
i
]))
{
beginIndex
=
i
;
break
;
}
}
int
endIndex
=
charArr
.
length
;
for
(
int
i
=
beginIndex
+
1
;
i
<
charArr
.
length
;
i
++)
{
if
(
charArr
[
i
]
!=
'.'
&&
!
Character
.
isDigit
(
charArr
[
i
]))
{
endIndex
=
i
;
break
;
}
}
String
[]
arr
=
versionStr
.
substring
(
beginIndex
,
endIndex
).
split
(
"\\."
);
if
(
arr
.
length
<
2
)
throw
new
IllegalArgumentException
();
int
maj
=
Integer
.
parseInt
(
arr
[
0
]);
int
min
=
Integer
.
parseInt
(
arr
[
1
]);
return
new
int
[]
{
maj
,
min
};
}
@Override
public
String
[]
getCreateTableSQL
(
Table
table
)
{
String
[]
sql
=
super
.
getCreateTableSQL
(
table
);
if
(!
StringUtil
.
isEmpty
(
tableType
))
sql
[
0
]
=
sql
[
0
]
+
" ENGINE = "
+
tableType
;
return
sql
;
}
@Override
public
String
[]
getDropIndexSQL
(
Index
index
)
{
return
new
String
[]
{
"DROP INDEX "
+
getFullName
(
index
)
+
" ON "
+
getFullName
(
index
.
getTable
(),
false
)
};
}
/**
* Return <code>ALTER TABLE <table name> DROP PRIMARY KEY</code>.
*/
@Override
public
String
[]
getDropPrimaryKeySQL
(
PrimaryKey
pk
)
{
if
(
DBIdentifier
.
isNull
(
pk
.
getIdentifier
()))
return
new
String
[
0
];
return
new
String
[]
{
"ALTER TABLE "
+
getFullName
(
pk
.
getTable
(),
false
)
+
" DROP PRIMARY KEY"
};
}
/**
* Return <code>ALTER TABLE <table name> DROP FOREIGN KEY
* <fk name></code>.
*/
@Override
public
String
[]
getDropForeignKeySQL
(
ForeignKey
fk
,
Connection
conn
)
{
if
(
DBIdentifier
.
isNull
(
fk
.
getIdentifier
()))
{
DBIdentifier
fkName
=
fk
.
loadIdentifierFromDB
(
this
,
conn
);
String
[]
retVal
=
(
fkName
==
null
)
?
new
String
[
0
]
:
new
String
[]
{
"ALTER TABLE "
+
getFullName
(
fk
.
getTable
(),
false
)
+
" DROP FOREIGN KEY "
+
toDBName
(
fkName
)
};
return
retVal
;
}
return
new
String
[]
{
"ALTER TABLE "
+
getFullName
(
fk
.
getTable
(),
false
)
+
" DROP FOREIGN KEY "
+
toDBName
(
fk
.
getIdentifier
())
};
}
@Override
public
String
[]
getAddPrimaryKeySQL
(
PrimaryKey
pk
)
{
String
[]
sql
=
super
.
getAddPrimaryKeySQL
(
pk
);
// mysql requires that a column be declared NOT NULL before
// it can be made a primary key.
Column
[]
cols
=
pk
.
getColumns
();
String
[]
ret
=
new
String
[
cols
.
length
+
sql
.
length
];
for
(
int
i
=
0
;
i
<
cols
.
length
;
i
++)
{
ret
[
i
]
=
"ALTER TABLE "
+
getFullName
(
cols
[
i
].
getTable
(),
false
)
+
" CHANGE "
+
toDBName
(
cols
[
i
].
getIdentifier
())
+
" "
+
toDBName
(
cols
[
i
].
getIdentifier
())
// name twice
+
" "
+
getTypeName
(
cols
[
i
])
+
" NOT NULL"
;
}
System
.
arraycopy
(
sql
,
0
,
ret
,
cols
.
length
,
sql
.
length
);
return
ret
;
}
@Override
public
String
[]
getDeleteTableContentsSQL
(
Table
[]
tables
,
Connection
conn
)
{
// mysql >= 4 supports more-optimal delete syntax
if
(!
optimizeMultiTableDeletes
)
return
super
.
getDeleteTableContentsSQL
(
tables
,
conn
);
else
{
StringBuilder
buf
=
new
StringBuilder
(
tables
.
length
*
8
);
buf
.
append
(
"DELETE FROM "
);
for
(
int
i
=
0
;
i
<
tables
.
length
;
i
++)
{
buf
.
append
(
toDBName
(
tables
[
i
].
getFullIdentifier
()));
if
(
i
<
tables
.
length
-
1
)
buf
.
append
(
", "
);
}
return
new
String
[]
{
buf
.
toString
()
};
}
}
@Override
protected
void
appendSelectRange
(
SQLBuffer
buf
,
long
start
,
long
end
,
boolean
subselect
)
{
buf
.
append
(
" LIMIT "
).
appendValue
(
start
).
append
(
", "
);
if
(
end
==
Long
.
MAX_VALUE
)
buf
.
appendValue
(
Long
.
MAX_VALUE
);
else
buf
.
appendValue
(
end
-
start
);
}
@Override
protected
Column
newColumn
(
ResultSet
colMeta
)
throws
SQLException
{
Column
col
=
super
.
newColumn
(
colMeta
);
if
(
col
.
isNotNull
()
&&
"0"
.
equals
(
col
.
getDefaultString
()))
col
.
setDefaultString
(
null
);
return
col
;
}
@Override
public
Object
getBlobObject
(
ResultSet
rs
,
int
column
,
JDBCStore
store
)
throws
SQLException
{
// if the user has set a get-blob strategy explicitly or the driver
// does not automatically deserialize, delegate to super
if
(
useGetBytesForBlobs
||
useGetObjectForBlobs
||
!
driverDeserializesBlobs
)
return
super
.
getBlobObject
(
rs
,
column
,
store
);
// most mysql drivers deserialize on getObject
return
rs
.
getObject
(
column
);
}
@Override
public
int
getPreferredType
(
int
type
)
{
if
(
type
==
Types
.
CLOB
&&
!
useClobs
)
{
return
Types
.
LONGVARCHAR
;
}
else
if
(
type
==
Types
.
TIME_WITH_TIMEZONE
)
{
// MySQL doesn't support SQL-2003 'WITH TIMEZONE' nor the respective JDBC types.
return
Types
.
TIME
;
}
else
if
(
type
==
Types
.
TIMESTAMP_WITH_TIMEZONE
)
{
// MySQL doesn't support SQL-2003 'WITH TIMEZONE' nor the respective JDBC types.
return
Types
.
TIMESTAMP
;
}
return
super
.
getPreferredType
(
type
);
}
/**
* Append XML comparison.
*
* @param buf the SQL buffer to write the comparison
* @param op the comparison operation to perform
* @param lhs the left hand side of the comparison
* @param rhs the right hand side of the comparison
* @param lhsxml indicates whether the left operand maps to XML
* @param rhsxml indicates whether the right operand maps to XML
*/
@Override
public
void
appendXmlComparison
(
SQLBuffer
buf
,
String
op
,
FilterValue
lhs
,
FilterValue
rhs
,
boolean
lhsxml
,
boolean
rhsxml
)
{
super
.
appendXmlComparison
(
buf
,
op
,
lhs
,
rhs
,
lhsxml
,
rhsxml
);
if
(
lhsxml
)
appendXmlValue
(
buf
,
lhs
);
else
lhs
.
appendTo
(
buf
);
buf
.
append
(
" "
).
append
(
op
).
append
(
" "
);
if
(
rhsxml
)
appendXmlValue
(
buf
,
rhs
);
else
rhs
.
appendTo
(
buf
);
}
/**
* Append XML column value so that it can be used in comparisons.
*
* @param buf the SQL buffer to write the value
* @param val the value to be written
*/
private
void
appendXmlValue
(
SQLBuffer
buf
,
FilterValue
val
)
{
buf
.
append
(
"ExtractValue("
).
append
(
val
.
getColumnAlias
(
val
.
getFieldMapping
().
getColumns
()[
0
])).
append
(
",'/*/"
);
val
.
appendTo
(
buf
);
buf
.
append
(
"')"
);
}
@Override
public
int
getBatchFetchSize
(
int
batchFetchSize
)
{
return
Integer
.
MIN_VALUE
;
}
/**
* Check to see if we have set the {@link #SELECT_HINT} in the fetch
* configuration, and if so, append the MySQL hint after the "SELECT" part of
* the query.
*/
@Override
public
String
getSelectOperation
(
JDBCFetchConfiguration
fetch
)
{
Object
hint
=
fetch
==
null
?
null
:
fetch
.
getHint
(
SELECT_HINT
);
String
select
=
"SELECT"
;
if
(
hint
!=
null
)
select
+=
" "
+
hint
;
return
select
;
}
@Override
protected
Collection
<
String
>
getSelectTableAliases
(
Select
sel
)
{
Set
<
String
>
result
=
new
HashSet
<>();
List
<
String
>
selects
=
sel
.
getIdentifierAliases
();
for
(
String
s
:
selects
)
{
String
tableAlias
=
s
.
substring
(
0
,
s
.
indexOf
(
'.'
));
result
.
add
(
tableAlias
);
}
return
result
;
}
// @Override
// protected int matchErrorState(Map<Integer,Set<String>> errorStates, SQLException ex) {
// int state = super.matchErrorState(errorStates, ex);
// // OPENJPA-1616 - Special case for MySQL not returning a SQLState for timeouts
// if (state == ExceptionInfo.GENERAL && ex.getErrorCode() == 0 && ex.getSQLState() == null) {
// // look at the nested MySQL exception for more details
// SQLException sqle = ex.getNextException();
// if (sqle != null && sqle.toString().startsWith("com.mysql.jdbc.exceptions.MySQLTimeoutException")) {
// if (conf != null && conf.getLockTimeout() != -1) {
// state = StoreException.LOCK;
// } else {
// state = StoreException.QUERY;
// }
// }
// }
// return state;
// }
@Override
public
boolean
isFatalException
(
int
subtype
,
SQLException
ex
)
{
if
((
subtype
==
StoreException
.
LOCK
&&
ex
.
getErrorCode
()
==
1205
)
||
(
subtype
==
StoreException
.
QUERY
&&
ex
.
getErrorCode
()
==
1317
))
{
return
false
;
}
if
(
ex
.
getErrorCode
()
==
0
&&
ex
.
getSQLState
()
==
null
)
return
false
;
return
super
.
isFatalException
(
subtype
,
ex
);
}
/**
* OPENJPA-740 Special case for MySql special column types, like LONGTEXT,
* LONGBLOG etc..
*
* @see org.apache.openjpa.jdbc.sql.DBDictionary#getTypeName(org.apache.openjpa.jdbc.schema.Column)
*/
@Override
public
String
getTypeName
(
Column
col
)
{
// handle blobs differently, if the DBItentifierType is NULL (e.g. no column
// definition is set).
if
(
col
.
getType
()
==
Types
.
BLOB
&&
col
.
getTypeIdentifier
().
getType
()
==
DBIdentifierType
.
NULL
)
{
if
(
col
.
getSize
()
<=
0
)
// unknown size
return
blobTypeName
;
// return old default of 64KB
else
if
(
col
.
getSize
()
<=
255
)
return
tinyBlobTypeName
;
else
if
(
col
.
getSize
()
<=
65535
)
return
blobTypeName
;
// old default of 64KB
else
if
(
col
.
getSize
()
<=
16777215
)
return
mediumBlobTypeName
;
else
return
longBlobTypeName
;
}
else
if
(
col
.
getType
()
==
Types
.
CLOB
&&
col
.
getTypeIdentifier
().
getType
()
==
DBIdentifierType
.
NULL
)
{
if
(
col
.
getSize
()
<=
0
)
// unknown size
return
clobTypeName
;
// return old default of 64KB
else
if
(
col
.
getSize
()
<=
255
)
return
tinyTextTypeName
;
else
if
(
col
.
getSize
()
<=
65535
)
return
clobTypeName
;
// old default of 64KB
else
if
(
col
.
getSize
()
<=
16777215
)
return
mediumTextTypeName
;
else
return
longTextTypeName
;
}
else
{
return
super
.
getTypeName
(
col
);
}
}
@Override
public
void
indexOf
(
SQLBuffer
buf
,
FilterValue
str
,
FilterValue
find
,
FilterValue
start
)
{
buf
.
append
(
"LOCATE("
);
find
.
appendTo
(
buf
);
buf
.
append
(
", "
);
str
.
appendTo
(
buf
);
if
(
start
!=
null
)
{
buf
.
append
(
", "
);
start
.
appendTo
(
buf
);
}
buf
.
append
(
")"
);
}
}
o2server/x_console/src/main/java/com/x/server/console/InstrumentationAgent.java
浏览文件 @
0a837e02
...
...
@@ -7,7 +7,6 @@ import java.nio.file.Files;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.List
;
import
java.util.Properties
;
import
java.util.jar.JarFile
;
import
java.util.stream.Stream
;
...
...
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/ThisApplication.java
浏览文件 @
0a837e02
...
...
@@ -24,7 +24,6 @@ public class ThisApplication {
try
{
CacheManager
.
init
(
context
.
clazz
().
getSimpleName
());
LoggerFactory
.
setLevel
(
Config
.
logLevel
().
x_query_assemble_surface
());
queueImportData
.
initFixedThreadPool
(
2
);
context
().
startQueue
(
queueImportData
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录