Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
113996ea
提交
113996ea
authored
2月 23, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup:
- Javadocs - Work in progress
上级
daa2b0bf
全部展开
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
1715 行增加
和
1716 行删除
+1715
-1716
Query.java
h2/src/tools/org/h2/jaqu/Query.java
+13
-9
QueryWhere.java
h2/src/tools/org/h2/jaqu/QueryWhere.java
+2
-2
SQLDialect.java
h2/src/tools/org/h2/jaqu/SQLDialect.java
+106
-106
SQLStatement.java
h2/src/tools/org/h2/jaqu/SQLStatement.java
+8
-7
SetColumn.java
h2/src/tools/org/h2/jaqu/SetColumn.java
+40
-40
Table.java
h2/src/tools/org/h2/jaqu/Table.java
+43
-41
TableDefinition.java
h2/src/tools/org/h2/jaqu/TableDefinition.java
+1
-1
TableInspector.java
h2/src/tools/org/h2/jaqu/TableInspector.java
+695
-716
Validation.java
h2/src/tools/org/h2/jaqu/Validation.java
+115
-113
ClassUtils.java
h2/src/tools/org/h2/jaqu/util/ClassUtils.java
+4
-0
GenerateModels.java
h2/src/tools/org/h2/jaqu/util/GenerateModels.java
+169
-165
JdbcUtils.java
h2/src/tools/org/h2/jaqu/util/JdbcUtils.java
+243
-241
Message.java
h2/src/tools/org/h2/jaqu/util/Message.java
+2
-0
StatementBuilder.java
h2/src/tools/org/h2/jaqu/util/StatementBuilder.java
+4
-2
StatementLogger.java
h2/src/tools/org/h2/jaqu/util/StatementLogger.java
+85
-90
StringUtils.java
h2/src/tools/org/h2/jaqu/util/StringUtils.java
+185
-183
没有找到文件。
h2/src/tools/org/h2/jaqu/Query.java
浏览文件 @
113996ea
...
@@ -19,7 +19,6 @@ import org.h2.jaqu.bytecode.ClassReader;
...
@@ -19,7 +19,6 @@ import org.h2.jaqu.bytecode.ClassReader;
import
org.h2.jaqu.util.StatementLogger
;
import
org.h2.jaqu.util.StatementLogger
;
import
org.h2.jaqu.util.JdbcUtils
;
import
org.h2.jaqu.util.JdbcUtils
;
import
org.h2.jaqu.util.Utils
;
import
org.h2.jaqu.util.Utils
;
//import org.h2.util.JdbcUtils;
//## Java 1.5 end ##
//## Java 1.5 end ##
/**
/**
...
@@ -38,8 +37,8 @@ public class Query<T> {
...
@@ -38,8 +37,8 @@ public class Query<T> {
private
final
IdentityHashMap
<
Object
,
SelectColumn
<
T
>>
aliasMap
=
Utils
.
newIdentityHashMap
();
private
final
IdentityHashMap
<
Object
,
SelectColumn
<
T
>>
aliasMap
=
Utils
.
newIdentityHashMap
();
private
ArrayList
<
OrderExpression
<
T
>>
orderByList
=
Utils
.
newArrayList
();
private
ArrayList
<
OrderExpression
<
T
>>
orderByList
=
Utils
.
newArrayList
();
private
Object
[]
groupByExpressions
;
private
Object
[]
groupByExpressions
;
private
long
limit
=
0
;
private
long
limit
;
private
long
offset
=
0
;
private
long
offset
;
Query
(
Db
db
)
{
Query
(
Db
db
)
{
this
.
db
=
db
;
this
.
db
=
db
;
...
@@ -65,6 +64,7 @@ public class Query<T> {
...
@@ -65,6 +64,7 @@ public class Query<T> {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
finally
{
}
finally
{
int
whyTrue
;
JdbcUtils
.
closeSilently
(
rs
,
true
);
JdbcUtils
.
closeSilently
(
rs
,
true
);
}
}
}
}
...
@@ -122,10 +122,12 @@ public class Query<T> {
...
@@ -122,10 +122,12 @@ public class Query<T> {
}
}
public
<
A
>
SetColumn
<
T
,
A
>
set
(
A
field
)
{
public
<
A
>
SetColumn
<
T
,
A
>
set
(
A
field
)
{
int
renameSetColumnClassToUpdateSetColumn
;
return
new
SetColumn
<
T
,
A
>(
this
,
field
);
return
new
SetColumn
<
T
,
A
>(
this
,
field
);
}
}
public
<
A
>
IncrementColumn
<
T
,
A
>
increment
(
A
field
)
{
public
<
A
>
IncrementColumn
<
T
,
A
>
increment
(
A
field
)
{
int
renameIncrementColumnClassToUpdateIncrementColumn
;
return
new
IncrementColumn
<
T
,
A
>(
this
,
field
);
return
new
IncrementColumn
<
T
,
A
>(
this
,
field
);
}
}
...
@@ -137,7 +139,7 @@ public class Query<T> {
...
@@ -137,7 +139,7 @@ public class Query<T> {
from
.
appendSQL
(
stat
);
from
.
appendSQL
(
stat
);
stat
.
appendSQL
(
" SET "
);
stat
.
appendSQL
(
" SET "
);
int
i
=
0
;
int
i
=
0
;
for
(
Declaration
declaration
:
declarations
)
{
for
(
Declaration
declaration
:
declarations
)
{
if
(
i
++
>
0
)
{
if
(
i
++
>
0
)
{
stat
.
appendSQL
(
", "
);
stat
.
appendSQL
(
", "
);
}
}
...
@@ -196,6 +198,7 @@ public class Query<T> {
...
@@ -196,6 +198,7 @@ public class Query<T> {
try
{
try
{
X
value
;
X
value
;
Object
o
=
rs
.
getObject
(
1
);
Object
o
=
rs
.
getObject
(
1
);
int
convertHereIsProbablyWrong
;
if
(
Clob
.
class
.
isAssignableFrom
(
o
.
getClass
()))
{
if
(
Clob
.
class
.
isAssignableFrom
(
o
.
getClass
()))
{
value
=
(
X
)
Utils
.
convert
(
o
,
String
.
class
);
value
=
(
X
)
Utils
.
convert
(
o
,
String
.
class
);
}
else
}
else
...
@@ -325,6 +328,7 @@ public class Query<T> {
...
@@ -325,6 +328,7 @@ public class Query<T> {
}
}
void
addDeclarationToken
(
Declaration
declaration
)
{
void
addDeclarationToken
(
Declaration
declaration
)
{
int
todoWhatIsDeclaration
;
declarations
.
add
(
declaration
);
declarations
.
add
(
declaration
);
}
}
...
...
h2/src/tools/org/h2/jaqu/QueryWhere.java
浏览文件 @
113996ea
h2/src/tools/org/h2/jaqu/SQLDialect.java
浏览文件 @
113996ea
h2/src/tools/org/h2/jaqu/SQLStatement.java
浏览文件 @
113996ea
...
@@ -82,8 +82,9 @@ public class SQLStatement {
...
@@ -82,8 +82,9 @@ public class SQLStatement {
ps
.
executeUpdate
();
ps
.
executeUpdate
();
long
identity
=
-
1
;
long
identity
=
-
1
;
ResultSet
rs
=
ps
.
getGeneratedKeys
();
ResultSet
rs
=
ps
.
getGeneratedKeys
();
if
(
rs
!=
null
&&
rs
.
next
())
if
(
rs
!=
null
&&
rs
.
next
())
{
identity
=
rs
.
getLong
(
1
);
identity
=
rs
.
getLong
(
1
);
}
JdbcUtils
.
closeSilently
(
rs
);
JdbcUtils
.
closeSilently
(
rs
);
return
identity
;
return
identity
;
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
...
@@ -101,8 +102,8 @@ public class SQLStatement {
...
@@ -101,8 +102,8 @@ public class SQLStatement {
}
}
}
}
private
PreparedStatement
prepare
(
boolean
return
Identity
)
{
private
PreparedStatement
prepare
(
boolean
return
GeneratedKeys
)
{
PreparedStatement
prep
=
db
.
prepare
(
getSQL
(),
return
Identity
);
PreparedStatement
prep
=
db
.
prepare
(
getSQL
(),
return
GeneratedKeys
);
for
(
int
i
=
0
;
i
<
params
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
params
.
size
();
i
++)
{
Object
o
=
params
.
get
(
i
);
Object
o
=
params
.
get
(
i
);
setValue
(
prep
,
i
+
1
,
o
);
setValue
(
prep
,
i
+
1
,
o
);
...
...
h2/src/tools/org/h2/jaqu/SetColumn.java
浏览文件 @
113996ea
h2/src/tools/org/h2/jaqu/Table.java
浏览文件 @
113996ea
/*
/*
* Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License, Version
* Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,
* 1.0, and under the Eclipse Public License, Version 1.0
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
*/
package
org
.
h2
.
jaqu
;
package
org
.
h2
.
jaqu
;
...
@@ -10,6 +11,9 @@ import java.lang.annotation.Retention;
...
@@ -10,6 +11,9 @@ import java.lang.annotation.Retention;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
java.lang.annotation.Target
;
/**
* A class that implements this interface can be used as a database table.
*/
/**
/**
* A class that implements the JaQu model mapping options.
* A class that implements the JaQu model mapping options.
* <p>
* <p>
...
@@ -116,8 +120,9 @@ import java.lang.annotation.Target;
...
@@ -116,8 +120,9 @@ import java.lang.annotation.Target;
* <pre>
* <pre>
* Db db = Db.open("jdbc:h2:mem:", "sa", "sa");
* Db db = Db.open("jdbc:h2:mem:", "sa", "sa");
* DbInspector inspector = new DbInspector(db);
* DbInspector inspector = new DbInspector(db);
* List<String> models = inspector.generateModel(schema, table,
* List<String> models =
* packageName, annotateSchema, trimStrings);
* inspector.generateModel(schema, table, packageName,
* annotateSchema, trimStrings)
* </pre>
* </pre>
*
*
* OR you may use the <i>GenerateModels</i> tool to generate and save your
* OR you may use the <i>GenerateModels</i> tool to generate and save your
...
@@ -134,33 +139,34 @@ import java.lang.annotation.Target;
...
@@ -134,33 +139,34 @@ import java.lang.annotation.Target;
* <b>Model Validation</b>
* <b>Model Validation</b>
* <p>
* <p>
* You may validate your model class with <i>DbInspector</i> object.<br>
* You may validate your model class with <i>DbInspector</i> object.<br>
* The DbInspector will report ERRORS, WARNINGS, and SUGGESTIONS to help you.
* The DbInspector will report ERRORS, WARNINGS, and
* SUGGESTIONS to help you.
*
*
* <pre>
* <pre>
* Db db = Db.open("jdbc:h2:mem:", "sa", "sa");
* Db db = Db.open("jdbc:h2:mem:",
* "sa", "sa");
* DbInspector inspector = new DbInspector(db);
* DbInspector inspector = new DbInspector(db);
*
MyModel model = new MyModel();
*
List<Validation> remarks =
*
List<Validation> remarks = inspector.validateModel(model
, throwOnError);
*
inspector.validateModel(new MyModel()
, throwOnError);
* for (Validation remark : remarks)
* for (Validation remark : remarks)
{
* System.out.println(remark);
* System.out.println(remark);
* }
* </pre>
* </pre>
*/
*/
public
interface
Table
{
public
interface
Table
{
static
final
int
reviewWholeClassAndJavadocs
=
0
;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
TYPE
)
@Target
(
ElementType
.
TYPE
)
public
@interface
JQDatabase
{
public
@interface
JQDatabase
{
/**
/**
* If
<b>version</b> is set to a <i>non-zero</i>
value, JaQu will
* If
version is set to a non-zero
value, JaQu will
* maintain a "_jq_versions" table within your database. The
* maintain a "_jq_versions" table within your database. The
* <i>version</i> number will be used to call to a registered
* version number will be used to call to a registered
* <i>DbUpgrader</i> implementation to perform relevant ALTERs or
* DbUpgrader implementation to perform relevant ALTER statements.
* whatever.
* Default: 0.
* <p>
* You must specify a DbUpgrader on your Db object to
* <b>Default: <i>0</i></b>
* <p>
* <b>NOTE:</b><br>
* You must specify a <i>DbUpgrader</i> on your <i>Db</i> object to
* use this parameter.
* use this parameter.
*/
*/
int
version
()
default
0
;
int
version
()
default
0
;
...
@@ -170,17 +176,14 @@ public interface Table {
...
@@ -170,17 +176,14 @@ public interface Table {
@Target
(
ElementType
.
TYPE
)
@Target
(
ElementType
.
TYPE
)
public
@interface
JQSchema
{
public
@interface
JQSchema
{
/**
/**
* <b>schema</b> may be optionally specified. If it is not specified the
* The schema may be optionally specified. If it is not specified the
* schema will be ignored.
* schema will be ignored. Default: Unspecified.
* <p>
* <b>Default: <i>Unspecified</i></b>
*/
*/
String
name
()
default
""
;
String
name
()
default
""
;
}
}
/**
/**
* Enumeration defining the 4 index types.
* Enumeration defining the 4 index types.
*
*/
*/
public
static
enum
IndexType
{
public
static
enum
IndexType
{
STANDARD
,
UNIQUE
,
HASH
,
UNIQUE_HASH
;
STANDARD
,
UNIQUE
,
HASH
,
UNIQUE_HASH
;
...
@@ -190,17 +193,16 @@ public interface Table {
...
@@ -190,17 +193,16 @@ public interface Table {
@Target
(
ElementType
.
TYPE
)
@Target
(
ElementType
.
TYPE
)
public
@interface
JQIndex
{
public
@interface
JQIndex
{
/**
/**
*
<b>standard</b>
indexes may be optionally specified. If not specified,
*
Standard
indexes may be optionally specified. If not specified,
* these values will be ignored.
* these values will be ignored.
* <ul>
* <ul>
* <li>standard = "id, name"
* <li>standard = "id, name"
* <li>standard = "id name"
* <li>standard = "id name"
* <li>standard = { "id name", "date" }
* <li>standard = { "id name", "date" }
* </ul>
* </ul>
* Standard indexes may still be added in the
<i>define()</i>
method if
* Standard indexes may still be added in the
define()
method if
* the model class is not annotated with JQTable.
* the model class is not annotated with JQTable.
* <p>
* Default: Unspecified.
* <b>Default: <i>Unspecified</i></b>
*/
*/
String
[]
standard
()
default
{};
String
[]
standard
()
default
{};
...
@@ -337,8 +339,8 @@ public interface Table {
...
@@ -337,8 +339,8 @@ public interface Table {
* If <b>version</b> is set to a <i>non-zero</i> value, JaQu will
* If <b>version</b> is set to a <i>non-zero</i> value, JaQu will
* maintain a "_jq_versions" table within your database. The
* maintain a "_jq_versions" table within your database. The
* <i>version</i> number will be used to call to a registered
* <i>version</i> number will be used to call to a registered
* <i>DbUpgrader</i> implementation to perform relevant ALTER
s or
* <i>DbUpgrader</i> implementation to perform relevant ALTER
*
whatever
.
*
statements
.
* <p>
* <p>
* <b>Default: <i>0</i></b>
* <b>Default: <i>0</i></b>
* <p>
* <p>
...
...
h2/src/tools/org/h2/jaqu/TableDefinition.java
浏览文件 @
113996ea
h2/src/tools/org/h2/jaqu/TableInspector.java
浏览文件 @
113996ea
差异被折叠。
点击展开。
h2/src/tools/org/h2/jaqu/Validation.java
浏览文件 @
113996ea
...
@@ -19,6 +19,8 @@ import org.h2.jaqu.util.StringUtils;
...
@@ -19,6 +19,8 @@ import org.h2.jaqu.util.StringUtils;
*/
*/
public
class
Validation
{
public
class
Validation
{
private
int
todoReviewWholeClass
;
public
static
Validation
CONSIDER
(
String
table
,
String
type
,
String
message
)
{
public
static
Validation
CONSIDER
(
String
table
,
String
type
,
String
message
)
{
return
new
Validation
(
Level
.
CONSIDER
,
table
,
type
,
message
);
return
new
Validation
(
Level
.
CONSIDER
,
table
,
type
,
message
);
}
}
...
...
h2/src/tools/org/h2/jaqu/util/ClassUtils.java
浏览文件 @
113996ea
...
@@ -13,6 +13,8 @@ package org.h2.jaqu.util;
...
@@ -13,6 +13,8 @@ package org.h2.jaqu.util;
*/
*/
public
class
ClassUtils
{
public
class
ClassUtils
{
int
todoDelete
;
private
ClassUtils
()
{
private
ClassUtils
()
{
// utility class
// utility class
}
}
...
@@ -31,5 +33,7 @@ public class ClassUtils {
...
@@ -31,5 +33,7 @@ public class ClassUtils {
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
}
}
//## Java 1.5 end ##
//## Java 1.5 end ##
}
}
h2/src/tools/org/h2/jaqu/util/GenerateModels.java
浏览文件 @
113996ea
...
@@ -28,6 +28,8 @@ import org.h2.message.DbException;
...
@@ -28,6 +28,8 @@ import org.h2.message.DbException;
*/
*/
public
class
GenerateModels
{
public
class
GenerateModels
{
private
static
final
int
todoReview
=
0
;
/**
/**
* The output stream where this tool writes to.
* The output stream where this tool writes to.
*/
*/
...
@@ -112,10 +114,11 @@ public class GenerateModels {
...
@@ -112,10 +114,11 @@ public class GenerateModels {
List
<
String
>
models
=
inspector
.
generateModel
(
schema
,
table
,
List
<
String
>
models
=
inspector
.
generateModel
(
schema
,
table
,
packageName
,
annotateSchema
,
trimStrings
);
packageName
,
annotateSchema
,
trimStrings
);
File
parentFile
;
File
parentFile
;
if
(
StringUtils
.
isNullOrEmpty
(
folder
))
if
(
StringUtils
.
isNullOrEmpty
(
folder
))
{
parentFile
=
new
File
(
System
.
getProperty
(
"user.dir"
));
parentFile
=
new
File
(
System
.
getProperty
(
"user.dir"
));
else
}
else
{
parentFile
=
new
File
(
folder
);
parentFile
=
new
File
(
folder
);
}
parentFile
.
mkdirs
();
parentFile
.
mkdirs
();
Pattern
p
=
Pattern
.
compile
(
"class ([a-zA-Z0-9]+)"
);
Pattern
p
=
Pattern
.
compile
(
"class ([a-zA-Z0-9]+)"
);
for
(
String
model
:
models
)
{
for
(
String
model
:
models
)
{
...
@@ -162,4 +165,5 @@ public class GenerateModels {
...
@@ -162,4 +165,5 @@ public class GenerateModels {
out
.
println
(
" -annotateSchema <boolean>"
);
out
.
println
(
" -annotateSchema <boolean>"
);
out
.
println
(
" -trimStrings <boolean>"
);
out
.
println
(
" -trimStrings <boolean>"
);
}
}
}
}
h2/src/tools/org/h2/jaqu/util/JdbcUtils.java
浏览文件 @
113996ea
...
@@ -21,6 +21,8 @@ import javax.sql.XAConnection;
...
@@ -21,6 +21,8 @@ import javax.sql.XAConnection;
*/
*/
public
class
JdbcUtils
{
public
class
JdbcUtils
{
private
static
final
int
todoDeleteClass
=
0
;
private
static
final
String
[]
DRIVERS
=
{
private
static
final
String
[]
DRIVERS
=
{
"h2:"
,
"org.h2.Driver"
,
"h2:"
,
"org.h2.Driver"
,
"Cache:"
,
"com.intersys.jdbc.CacheDriver"
,
"Cache:"
,
"com.intersys.jdbc.CacheDriver"
,
...
...
h2/src/tools/org/h2/jaqu/util/Message.java
浏览文件 @
113996ea
...
@@ -18,6 +18,8 @@ import java.sql.SQLException;
...
@@ -18,6 +18,8 @@ import java.sql.SQLException;
*/
*/
public
class
Message
{
public
class
Message
{
private
int
todoDelete
;
private
Message
()
{
private
Message
()
{
// utility class
// utility class
}
}
...
...
h2/src/tools/org/h2/jaqu/util/StatementBuilder.java
浏览文件 @
113996ea
...
@@ -30,6 +30,8 @@ package org.h2.jaqu.util;
...
@@ -30,6 +30,8 @@ package org.h2.jaqu.util;
*/
*/
public
class
StatementBuilder
{
public
class
StatementBuilder
{
private
int
todoDelete
;
private
final
StringBuilder
builder
=
new
StringBuilder
();
private
final
StringBuilder
builder
=
new
StringBuilder
();
private
int
index
;
private
int
index
;
...
...
h2/src/tools/org/h2/jaqu/util/StatementLogger.java
浏览文件 @
113996ea
...
@@ -20,72 +20,67 @@ import java.util.concurrent.atomic.AtomicLong;
...
@@ -20,72 +20,67 @@ import java.util.concurrent.atomic.AtomicLong;
*/
*/
public
class
StatementLogger
{
public
class
StatementLogger
{
public
static
boolean
logStatements
=
false
;
public
static
boolean
logStatements
;
private
static
PrintWriter
out
=
new
PrintWriter
(
System
.
out
);
public
static
PrintWriter
out
=
new
PrintWriter
(
System
.
out
);
private
static
final
AtomicLong
SELECT_COUNT
=
new
AtomicLong
();
private
static
final
AtomicLong
CREATE_COUNT
=
new
AtomicLong
();
public
final
static
AtomicLong
selectCount
=
new
AtomicLong
(
0
);
private
static
final
AtomicLong
INSERT_COUNT
=
new
AtomicLong
();
private
static
final
AtomicLong
UPDATE_COUNT
=
new
AtomicLong
();
public
final
static
AtomicLong
createCount
=
new
AtomicLong
(
0
);
private
static
final
AtomicLong
MERGE_COUNT
=
new
AtomicLong
();
private
static
final
AtomicLong
DELETE_COUNT
=
new
AtomicLong
();
public
final
static
AtomicLong
insertCount
=
new
AtomicLong
(
0
);
public
final
static
AtomicLong
updateCount
=
new
AtomicLong
(
0
);
public
final
static
AtomicLong
mergeCount
=
new
AtomicLong
(
0
);
public
final
static
AtomicLong
deleteCount
=
new
AtomicLong
(
0
);
public
static
void
create
(
String
statement
)
{
public
static
void
create
(
String
statement
)
{
createCount
.
incrementAndGet
();
CREATE_COUNT
.
incrementAndGet
();
log
(
statement
);
log
(
statement
);
}
}
public
static
void
insert
(
String
statement
)
{
public
static
void
insert
(
String
statement
)
{
insertCount
.
incrementAndGet
();
INSERT_COUNT
.
incrementAndGet
();
log
(
statement
);
log
(
statement
);
}
}
public
static
void
update
(
String
statement
)
{
public
static
void
update
(
String
statement
)
{
updateCount
.
incrementAndGet
();
UPDATE_COUNT
.
incrementAndGet
();
log
(
statement
);
log
(
statement
);
}
}
public
static
void
merge
(
String
statement
)
{
public
static
void
merge
(
String
statement
)
{
mergeCount
.
incrementAndGet
();
MERGE_COUNT
.
incrementAndGet
();
log
(
statement
);
log
(
statement
);
}
}
public
static
void
delete
(
String
statement
)
{
public
static
void
delete
(
String
statement
)
{
deleteCount
.
incrementAndGet
();
DELETE_COUNT
.
incrementAndGet
();
log
(
statement
);
log
(
statement
);
}
}
public
static
void
select
(
String
statement
)
{
public
static
void
select
(
String
statement
)
{
selectCount
.
incrementAndGet
();
SELECT_COUNT
.
incrementAndGet
();
log
(
statement
);
log
(
statement
);
}
}
private
static
void
log
(
String
statement
)
{
private
static
void
log
(
String
statement
)
{
if
(
logStatements
)
if
(
logStatements
)
{
out
.
println
(
statement
);
out
.
println
(
statement
);
}
}
}
public
static
void
printStats
()
{
public
static
void
printStats
()
{
out
.
println
(
"JaQu Runtime Stat
s"
);
out
.
println
(
"JaQu Runtime Stat
istics"
);
out
.
println
(
"======================="
);
out
.
println
(
"======================="
);
printStat
(
"CREATE"
,
createCount
);
printStat
(
"CREATE"
,
CREATE_COUNT
);
printStat
(
"INSERT"
,
insertCount
);
printStat
(
"INSERT"
,
INSERT_COUNT
);
printStat
(
"UPDATE"
,
updateCount
);
printStat
(
"UPDATE"
,
UPDATE_COUNT
);
printStat
(
"MERGE"
,
mergeCount
);
printStat
(
"MERGE"
,
MERGE_COUNT
);
printStat
(
"DELETE"
,
deleteCount
);
printStat
(
"DELETE"
,
DELETE_COUNT
);
printStat
(
"SELECT"
,
selectCount
);
printStat
(
"SELECT"
,
SELECT_COUNT
);
}
}
private
static
void
printStat
(
String
name
,
AtomicLong
value
)
{
private
static
void
printStat
(
String
name
,
AtomicLong
value
)
{
if
(
value
.
get
()
>
0
)
{
if
(
value
.
get
()
>
0
)
{
DecimalFormat
df
=
new
DecimalFormat
(
"###,###,###,###"
);
DecimalFormat
df
=
new
DecimalFormat
(
"###,###,###,###"
);
out
.
println
(
name
+
"="
+
df
.
format
(
createCount
.
get
()));
out
.
println
(
name
+
"="
+
df
.
format
(
CREATE_COUNT
.
get
()));
}
}
}
}
}
}
\ No newline at end of file
h2/src/tools/org/h2/jaqu/util/StringUtils.java
浏览文件 @
113996ea
...
@@ -12,6 +12,8 @@ package org.h2.jaqu.util;
...
@@ -12,6 +12,8 @@ package org.h2.jaqu.util;
*/
*/
public
class
StringUtils
{
public
class
StringUtils
{
private
int
todoDelete
;
/**
/**
* Replace all occurrences of the before string with the after string.
* Replace all occurrences of the before string with the after string.
*
*
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论