Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
3f4f0e3f
提交
3f4f0e3f
authored
7月 04, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ODBC: MS Access could not link to a table with a name containing '_'.
上级
276ad6f5
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
44 行增加
和
6 行删除
+44
-6
Parser.java
h2/src/main/org/h2/command/Parser.java
+18
-6
PgServer.java
h2/src/main/org/h2/server/pg/PgServer.java
+21
-0
pg_catalog.sql
h2/src/main/org/h2/server/pg/pg_catalog.sql
+3
-0
testSimple.in.txt
h2/src/test/org/h2/test/testSimple.in.txt
+2
-0
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
3f4f0e3f
...
@@ -2373,6 +2373,9 @@ public class Parser {
...
@@ -2373,6 +2373,9 @@ public class Parser {
r
=
ValueExpression
.
get
(
ValueTimestamp
.
getNoCopy
(
ValueTimestamp
.
parseTimestamp
(
timestamp
)));
r
=
ValueExpression
.
get
(
ValueTimestamp
.
getNoCopy
(
ValueTimestamp
.
parseTimestamp
(
timestamp
)));
}
else
if
(
equalsToken
(
"E"
,
name
)
&&
currentTokenType
==
VALUE
&&
currentValue
.
getType
()
==
Value
.
STRING
)
{
}
else
if
(
equalsToken
(
"E"
,
name
)
&&
currentTokenType
==
VALUE
&&
currentValue
.
getType
()
==
Value
.
STRING
)
{
String
text
=
currentValue
.
getString
();
String
text
=
currentValue
.
getString
();
// the PostgreSQL ODBC driver uses
// LIKE E'PROJECT\\_DATA' instead of LIKE 'PROJECT\_DATA'
text
=
StringUtils
.
replaceAll
(
text
,
"\\\\"
,
"\\"
);
read
();
read
();
r
=
ValueExpression
.
get
(
ValueString
.
get
(
text
));
r
=
ValueExpression
.
get
(
ValueString
.
get
(
text
));
}
else
{
}
else
{
...
@@ -2476,12 +2479,22 @@ public class Parser {
...
@@ -2476,12 +2479,22 @@ public class Parser {
}
}
if
(
readIf
(
"::"
))
{
if
(
readIf
(
"::"
))
{
// PostgreSQL compatibility
// PostgreSQL compatibility
if
(
readIf
(
"REGCLASS"
))
{
FunctionAlias
f
=
findFunctionAlias
(
Constants
.
SCHEMA_MAIN
,
"PG_GET_OID"
);
if
(
f
==
null
)
{
throw
getSyntaxError
();
}
Expression
[]
args
=
{
r
};
JavaFunction
func
=
new
JavaFunction
(
f
,
args
);
r
=
func
;
}
else
{
Column
col
=
parseColumn
(
null
);
Column
col
=
parseColumn
(
null
);
Function
function
=
Function
.
getFunction
(
database
,
"CAST"
);
Function
function
=
Function
.
getFunction
(
database
,
"CAST"
);
function
.
setDataType
(
col
);
function
.
setDataType
(
col
);
function
.
setParameter
(
0
,
r
);
function
.
setParameter
(
0
,
r
);
r
=
function
;
r
=
function
;
}
}
}
return
r
;
return
r
;
}
}
...
@@ -4090,7 +4103,6 @@ public class Parser {
...
@@ -4090,7 +4103,6 @@ public class Parser {
return
command
;
return
command
;
}
}
private
AlterSequence
parseAlterSequence
()
{
private
AlterSequence
parseAlterSequence
()
{
String
sequenceName
=
readIdentifierWithSchema
();
String
sequenceName
=
readIdentifierWithSchema
();
Sequence
sequence
=
getSchema
().
getSequence
(
sequenceName
);
Sequence
sequence
=
getSchema
().
getSequence
(
sequenceName
);
...
...
h2/src/main/org/h2/server/pg/PgServer.java
浏览文件 @
3f4f0e3f
...
@@ -294,6 +294,27 @@ public class PgServer implements Service {
...
@@ -294,6 +294,27 @@ public class PgServer implements Service {
return
rs
.
getString
(
1
);
return
rs
.
getString
(
1
);
}
}
/**
* Get the OID of an object.
* This method is called by the database.
*
* @param conn the connection
* @param tableName the table name
* @return the oid
*/
public
static
int
getOid
(
Connection
conn
,
String
tableName
)
throws
SQLException
{
if
(
tableName
.
startsWith
(
"\""
)
&&
tableName
.
endsWith
(
"\""
))
{
tableName
=
tableName
.
substring
(
1
,
tableName
.
length
()
-
1
);
}
PreparedStatement
prep
=
conn
.
prepareStatement
(
"select oid from pg_class where relname = ?"
);
prep
.
setString
(
1
,
tableName
);
ResultSet
rs
=
prep
.
executeQuery
();
if
(!
rs
.
next
())
{
return
0
;
}
return
rs
.
getInt
(
1
);
}
/**
/**
* Get the name of this encoding code.
* Get the name of this encoding code.
* This method is called by the database.
* This method is called by the database.
...
...
h2/src/main/org/h2/server/pg/pg_catalog.sql
浏览文件 @
3f4f0e3f
...
@@ -11,6 +11,9 @@ create schema pg_catalog;
...
@@ -11,6 +11,9 @@ create schema pg_catalog;
drop
alias
if
exists
pg_convertType
;
drop
alias
if
exists
pg_convertType
;
create
alias
pg_convertType
deterministic
for
"org.h2.server.pg.PgServer.convertType"
;
create
alias
pg_convertType
deterministic
for
"org.h2.server.pg.PgServer.convertType"
;
drop
alias
if
exists
pg_get_oid
;
create
alias
pg_get_oid
deterministic
for
"org.h2.server.pg.PgServer.getOid"
;
create
table
pg_catalog
.
pg_version
as
select
1
as
version
;
create
table
pg_catalog
.
pg_version
as
select
1
as
version
;
create
view
pg_catalog
.
pg_roles
-- (oid, rolname, rolcreaterole, rolcreatedb)
create
view
pg_catalog
.
pg_roles
-- (oid, rolname, rolcreaterole, rolcreatedb)
...
...
h2/src/test/org/h2/test/testSimple.in.txt
浏览文件 @
3f4f0e3f
select E'test\\test';
> test\test;
create table a(id int) as select null;
create table a(id int) as select null;
create table b(id int references a(id)) as select null;
create table b(id int references a(id)) as select null;
delete from a;
delete from a;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论