Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
f9d3ed65
Commit
f9d3ed65
authored
Dec 12, 2003
by
Dave Cramer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
metadata encoding patch from Kris Jurka
parent
42610b1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
56 deletions
+65
-56
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
...c/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
+65
-56
No files found.
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
View file @
f9d3ed65
...
@@ -5,6 +5,7 @@ import java.sql.*;
...
@@ -5,6 +5,7 @@ import java.sql.*;
import
java.util.*
;
import
java.util.*
;
import
org.postgresql.core.BaseStatement
;
import
org.postgresql.core.BaseStatement
;
import
org.postgresql.core.Field
;
import
org.postgresql.core.Field
;
import
org.postgresql.core.Encoding
;
import
org.postgresql.util.PSQLException
;
import
org.postgresql.util.PSQLException
;
import
org.postgresql.util.PSQLState
;
import
org.postgresql.util.PSQLState
;
import
org.postgresql.Driver
;
import
org.postgresql.Driver
;
...
@@ -22,6 +23,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -22,6 +23,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
"vacuum,verbose,version"
;
"vacuum,verbose,version"
;
protected
AbstractJdbc1Connection
connection
;
// The connection association
protected
AbstractJdbc1Connection
connection
;
// The connection association
protected
Encoding
encoding
;
// These define various OID's. Hopefully they will stay constant.
// These define various OID's. Hopefully they will stay constant.
protected
static
final
int
iVarcharOid
=
1043
;
// OID for varchar
protected
static
final
int
iVarcharOid
=
1043
;
// OID for varchar
...
@@ -73,6 +75,13 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -73,6 +75,13 @@ public abstract class AbstractJdbc1DatabaseMetaData
public
AbstractJdbc1DatabaseMetaData
(
AbstractJdbc1Connection
conn
)
public
AbstractJdbc1DatabaseMetaData
(
AbstractJdbc1Connection
conn
)
{
{
this
.
connection
=
conn
;
this
.
connection
=
conn
;
try
{
this
.
encoding
=
conn
.
getEncoding
();
}
catch
(
SQLException
sqle
)
{
this
.
encoding
=
Encoding
.
defaultEncoding
();
}
}
}
/*
/*
...
@@ -1858,15 +1867,15 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -1858,15 +1867,15 @@ public abstract class AbstractJdbc1DatabaseMetaData
tuple
[
0
]
=
null
;
tuple
[
0
]
=
null
;
tuple
[
1
]
=
schema
;
tuple
[
1
]
=
schema
;
tuple
[
2
]
=
procedureName
;
tuple
[
2
]
=
procedureName
;
tuple
[
3
]
=
"returnValue"
.
getBytes
(
);
tuple
[
3
]
=
encoding
.
encode
(
"returnValue"
);
tuple
[
4
]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureColumnReturn
).
getBytes
(
);
tuple
[
4
]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureColumnReturn
)
);
tuple
[
5
]
=
Integer
.
toString
(
connection
.
getSQLType
(
returnType
)).
getBytes
(
);
tuple
[
5
]
=
encoding
.
encode
(
Integer
.
toString
(
connection
.
getSQLType
(
returnType
))
);
tuple
[
6
]
=
connection
.
getPGType
(
returnType
).
getBytes
(
);
tuple
[
6
]
=
encoding
.
encode
(
connection
.
getPGType
(
returnType
)
);
tuple
[
7
]
=
null
;
tuple
[
7
]
=
null
;
tuple
[
8
]
=
null
;
tuple
[
8
]
=
null
;
tuple
[
9
]
=
null
;
tuple
[
9
]
=
null
;
tuple
[
10
]
=
null
;
tuple
[
10
]
=
null
;
tuple
[
11
]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureNullableUnknown
).
getBytes
(
);
tuple
[
11
]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureNullableUnknown
)
);
tuple
[
12
]
=
null
;
tuple
[
12
]
=
null
;
v
.
addElement
(
tuple
);
v
.
addElement
(
tuple
);
}
}
...
@@ -1878,15 +1887,15 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -1878,15 +1887,15 @@ public abstract class AbstractJdbc1DatabaseMetaData
tuple
[
0
]
=
null
;
tuple
[
0
]
=
null
;
tuple
[
1
]
=
schema
;
tuple
[
1
]
=
schema
;
tuple
[
2
]
=
procedureName
;
tuple
[
2
]
=
procedureName
;
tuple
[
3
]
=
(
"$"
+(
i
+
1
)).
getBytes
(
);
tuple
[
3
]
=
encoding
.
encode
(
"$"
+(
i
+
1
)
);
tuple
[
4
]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureColumnIn
).
getBytes
(
);
tuple
[
4
]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureColumnIn
)
);
tuple
[
5
]
=
Integer
.
toString
(
connection
.
getSQLType
(
argOid
)).
getBytes
(
);
tuple
[
5
]
=
encoding
.
encode
(
Integer
.
toString
(
connection
.
getSQLType
(
argOid
))
);
tuple
[
6
]
=
connection
.
getPGType
(
argOid
).
getBytes
(
);
tuple
[
6
]
=
encoding
.
encode
(
connection
.
getPGType
(
argOid
)
);
tuple
[
7
]
=
null
;
tuple
[
7
]
=
null
;
tuple
[
8
]
=
null
;
tuple
[
8
]
=
null
;
tuple
[
9
]
=
null
;
tuple
[
9
]
=
null
;
tuple
[
10
]
=
null
;
tuple
[
10
]
=
null
;
tuple
[
11
]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureNullableUnknown
).
getBytes
(
);
tuple
[
11
]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureNullableUnknown
)
);
tuple
[
12
]
=
null
;
tuple
[
12
]
=
null
;
v
.
addElement
(
tuple
);
v
.
addElement
(
tuple
);
}
}
...
@@ -1901,15 +1910,15 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -1901,15 +1910,15 @@ public abstract class AbstractJdbc1DatabaseMetaData
tuple
[
0
]
=
null
;
tuple
[
0
]
=
null
;
tuple
[
1
]
=
schema
;
tuple
[
1
]
=
schema
;
tuple
[
2
]
=
procedureName
;
tuple
[
2
]
=
procedureName
;
tuple
[
3
]
=
columnrs
.
get
String
(
"attname"
).
getBytes
(
);
tuple
[
3
]
=
columnrs
.
get
Bytes
(
"attname"
);
tuple
[
4
]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureColumnResult
).
getBytes
(
);
tuple
[
4
]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureColumnResult
)
);
tuple
[
5
]
=
Integer
.
toString
(
connection
.
getSQLType
(
columnTypeOid
)).
getBytes
(
);
tuple
[
5
]
=
encoding
.
encode
(
Integer
.
toString
(
connection
.
getSQLType
(
columnTypeOid
))
);
tuple
[
6
]
=
connection
.
getPGType
(
columnTypeOid
).
getBytes
(
);
tuple
[
6
]
=
encoding
.
encode
(
connection
.
getPGType
(
columnTypeOid
)
);
tuple
[
7
]
=
null
;
tuple
[
7
]
=
null
;
tuple
[
8
]
=
null
;
tuple
[
8
]
=
null
;
tuple
[
9
]
=
null
;
tuple
[
9
]
=
null
;
tuple
[
10
]
=
null
;
tuple
[
10
]
=
null
;
tuple
[
11
]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureNullableUnknown
).
getBytes
(
);
tuple
[
11
]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
procedureNullableUnknown
)
);
tuple
[
12
]
=
null
;
tuple
[
12
]
=
null
;
v
.
addElement
(
tuple
);
v
.
addElement
(
tuple
);
}
}
...
@@ -2205,7 +2214,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -2205,7 +2214,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
for
(
i
=
0
;
i
<
types
.
length
;
i
++)
for
(
i
=
0
;
i
<
types
.
length
;
i
++)
{
{
byte
[][]
tuple
=
new
byte
[
1
][];
byte
[][]
tuple
=
new
byte
[
1
][];
tuple
[
0
]
=
types
[
i
].
getBytes
(
);
tuple
[
0
]
=
encoding
.
encode
(
types
[
i
]
);
v
.
addElement
(
tuple
);
v
.
addElement
(
tuple
);
}
}
...
@@ -2338,46 +2347,46 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -2338,46 +2347,46 @@ public abstract class AbstractJdbc1DatabaseMetaData
tuple
[
1
]
=
rs
.
getBytes
(
"nspname"
);
// Schema
tuple
[
1
]
=
rs
.
getBytes
(
"nspname"
);
// Schema
tuple
[
2
]
=
rs
.
getBytes
(
"relname"
);
// Table name
tuple
[
2
]
=
rs
.
getBytes
(
"relname"
);
// Table name
tuple
[
3
]
=
rs
.
getBytes
(
"attname"
);
// Column name
tuple
[
3
]
=
rs
.
getBytes
(
"attname"
);
// Column name
tuple
[
4
]
=
Integer
.
toString
(
connection
.
getSQLType
(
typeOid
)).
getBytes
(
);
tuple
[
4
]
=
encoding
.
encode
(
Integer
.
toString
(
connection
.
getSQLType
(
typeOid
))
);
String
pgType
=
connection
.
getPGType
(
typeOid
);
String
pgType
=
connection
.
getPGType
(
typeOid
);
tuple
[
5
]
=
pgType
.
getBytes
();
// Type name
tuple
[
5
]
=
encoding
.
encode
(
pgType
);
// Type name
// by default no decimal_digits
// by default no decimal_digits
// if the type is numeric or decimal we will
// if the type is numeric or decimal we will
// overwrite later.
// overwrite later.
tuple
[
8
]
=
"0"
.
getBytes
(
);
tuple
[
8
]
=
encoding
.
encode
(
"0"
);
if
(
pgType
.
equals
(
"bpchar"
)
||
pgType
.
equals
(
"varchar"
))
if
(
pgType
.
equals
(
"bpchar"
)
||
pgType
.
equals
(
"varchar"
))
{
{
int
atttypmod
=
rs
.
getInt
(
"atttypmod"
);
int
atttypmod
=
rs
.
getInt
(
"atttypmod"
);
tuple
[
6
]
=
Integer
.
toString
(
atttypmod
!=
-
1
?
atttypmod
-
VARHDRSZ
:
0
).
getBytes
(
);
tuple
[
6
]
=
encoding
.
encode
(
Integer
.
toString
(
atttypmod
!=
-
1
?
atttypmod
-
VARHDRSZ
:
0
)
);
}
}
else
if
(
pgType
.
equals
(
"numeric"
)
||
pgType
.
equals
(
"decimal"
))
else
if
(
pgType
.
equals
(
"numeric"
)
||
pgType
.
equals
(
"decimal"
))
{
{
int
attypmod
=
rs
.
getInt
(
"atttypmod"
)
-
VARHDRSZ
;
int
attypmod
=
rs
.
getInt
(
"atttypmod"
)
-
VARHDRSZ
;
tuple
[
6
]
=
Integer
.
toString
(
(
attypmod
>>
16
)
&
0xffff
).
getBytes
(
);
tuple
[
6
]
=
encoding
.
encode
(
Integer
.
toString
(
(
attypmod
>>
16
)
&
0xffff
)
);
tuple
[
8
]
=
Integer
.
toString
(
attypmod
&
0xffff
).
getBytes
(
);
tuple
[
8
]
=
encoding
.
encode
(
Integer
.
toString
(
attypmod
&
0xffff
)
);
tuple
[
9
]
=
"10"
.
getBytes
(
);
tuple
[
9
]
=
encoding
.
encode
(
"10"
);
}
}
else
if
(
pgType
.
equals
(
"bit"
)
||
pgType
.
equals
(
"varbit"
))
{
else
if
(
pgType
.
equals
(
"bit"
)
||
pgType
.
equals
(
"varbit"
))
{
tuple
[
6
]
=
rs
.
getBytes
(
"atttypmod"
);
tuple
[
6
]
=
rs
.
getBytes
(
"atttypmod"
);
tuple
[
9
]
=
"2"
.
getBytes
(
);
tuple
[
9
]
=
encoding
.
encode
(
"2"
);
}
}
else
{
else
{
tuple
[
6
]
=
rs
.
getBytes
(
"attlen"
);
tuple
[
6
]
=
rs
.
getBytes
(
"attlen"
);
tuple
[
9
]
=
"10"
.
getBytes
(
);
tuple
[
9
]
=
encoding
.
encode
(
"10"
);
}
}
tuple
[
7
]
=
null
;
// Buffer length
tuple
[
7
]
=
null
;
// Buffer length
tuple
[
10
]
=
Integer
.
toString
(
rs
.
getBoolean
(
"attnotnull"
)
?
java
.
sql
.
DatabaseMetaData
.
columnNoNulls
:
java
.
sql
.
DatabaseMetaData
.
columnNullable
).
getBytes
(
);
// Nullable
tuple
[
10
]
=
encoding
.
encode
(
Integer
.
toString
(
rs
.
getBoolean
(
"attnotnull"
)
?
java
.
sql
.
DatabaseMetaData
.
columnNoNulls
:
java
.
sql
.
DatabaseMetaData
.
columnNullable
)
);
// Nullable
tuple
[
11
]
=
rs
.
getBytes
(
"description"
);
// Description (if any)
tuple
[
11
]
=
rs
.
getBytes
(
"description"
);
// Description (if any)
tuple
[
12
]
=
rs
.
getBytes
(
"adsrc"
);
// Column default
tuple
[
12
]
=
rs
.
getBytes
(
"adsrc"
);
// Column default
tuple
[
13
]
=
null
;
// sql data type (unused)
tuple
[
13
]
=
null
;
// sql data type (unused)
tuple
[
14
]
=
null
;
// sql datetime sub (unused)
tuple
[
14
]
=
null
;
// sql datetime sub (unused)
tuple
[
15
]
=
tuple
[
6
];
// char octet length
tuple
[
15
]
=
tuple
[
6
];
// char octet length
tuple
[
16
]
=
rs
.
getBytes
(
"attnum"
);
// ordinal position
tuple
[
16
]
=
rs
.
getBytes
(
"attnum"
);
// ordinal position
tuple
[
17
]
=
(
rs
.
getBoolean
(
"attnotnull"
)
?
"NO"
:
"YES"
).
getBytes
(
);
// Is nullable
tuple
[
17
]
=
encoding
.
encode
(
rs
.
getBoolean
(
"attnotnull"
)
?
"NO"
:
"YES"
);
// Is nullable
v
.
addElement
(
tuple
);
v
.
addElement
(
tuple
);
}
}
...
@@ -2476,7 +2485,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -2476,7 +2485,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
}
}
sortStringArray
(
permNames
);
sortStringArray
(
permNames
);
for
(
i
=
0
;
i
<
permNames
.
length
;
i
++)
{
for
(
i
=
0
;
i
<
permNames
.
length
;
i
++)
{
byte
[]
privilege
=
permNames
[
i
].
getBytes
(
);
byte
[]
privilege
=
encoding
.
encode
(
permNames
[
i
]
);
Vector
grantees
=
(
Vector
)
permissions
.
get
(
permNames
[
i
]);
Vector
grantees
=
(
Vector
)
permissions
.
get
(
permNames
[
i
]);
for
(
int
j
=
0
;
j
<
grantees
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
grantees
.
size
();
j
++)
{
String
grantee
=
(
String
)
grantees
.
elementAt
(
j
);
String
grantee
=
(
String
)
grantees
.
elementAt
(
j
);
...
@@ -2486,10 +2495,10 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -2486,10 +2495,10 @@ public abstract class AbstractJdbc1DatabaseMetaData
tuple
[
1
]
=
schemaName
;
tuple
[
1
]
=
schemaName
;
tuple
[
2
]
=
tableName
;
tuple
[
2
]
=
tableName
;
tuple
[
3
]
=
column
;
tuple
[
3
]
=
column
;
tuple
[
4
]
=
owner
.
getBytes
(
);
tuple
[
4
]
=
encoding
.
encode
(
owner
);
tuple
[
5
]
=
grantee
.
getBytes
(
);
tuple
[
5
]
=
encoding
.
encode
(
grantee
);
tuple
[
6
]
=
privilege
;
tuple
[
6
]
=
privilege
;
tuple
[
7
]
=
grantable
.
getBytes
(
);
tuple
[
7
]
=
encoding
.
encode
(
grantable
);
v
.
addElement
(
tuple
);
v
.
addElement
(
tuple
);
}
}
}
}
...
@@ -2579,7 +2588,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -2579,7 +2588,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
}
}
sortStringArray
(
permNames
);
sortStringArray
(
permNames
);
for
(
i
=
0
;
i
<
permNames
.
length
;
i
++)
{
for
(
i
=
0
;
i
<
permNames
.
length
;
i
++)
{
byte
[]
privilege
=
permNames
[
i
].
getBytes
(
);
byte
[]
privilege
=
encoding
.
encode
(
permNames
[
i
]
);
Vector
grantees
=
(
Vector
)
permissions
.
get
(
permNames
[
i
]);
Vector
grantees
=
(
Vector
)
permissions
.
get
(
permNames
[
i
]);
for
(
int
j
=
0
;
j
<
grantees
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
grantees
.
size
();
j
++)
{
String
grantee
=
(
String
)
grantees
.
elementAt
(
j
);
String
grantee
=
(
String
)
grantees
.
elementAt
(
j
);
...
@@ -2588,10 +2597,10 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -2588,10 +2597,10 @@ public abstract class AbstractJdbc1DatabaseMetaData
tuple
[
0
]
=
null
;
tuple
[
0
]
=
null
;
tuple
[
1
]
=
schema
;
tuple
[
1
]
=
schema
;
tuple
[
2
]
=
table
;
tuple
[
2
]
=
table
;
tuple
[
3
]
=
owner
.
getBytes
(
);
tuple
[
3
]
=
encoding
.
encode
(
owner
);
tuple
[
4
]
=
grantee
.
getBytes
(
);
tuple
[
4
]
=
encoding
.
encode
(
grantee
);
tuple
[
5
]
=
privilege
;
tuple
[
5
]
=
privilege
;
tuple
[
6
]
=
grantable
.
getBytes
(
);
tuple
[
6
]
=
encoding
.
encode
(
grantable
);
v
.
addElement
(
tuple
);
v
.
addElement
(
tuple
);
}
}
}
}
...
@@ -2785,14 +2794,14 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -2785,14 +2794,14 @@ public abstract class AbstractJdbc1DatabaseMetaData
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
byte
tuple
[][]
=
new
byte
[
8
][];
byte
tuple
[][]
=
new
byte
[
8
][];
int
columnTypeOid
=
rs
.
getInt
(
"atttypid"
);
int
columnTypeOid
=
rs
.
getInt
(
"atttypid"
);
tuple
[
0
]
=
Integer
.
toString
(
scope
).
getBytes
(
);
tuple
[
0
]
=
encoding
.
encode
(
Integer
.
toString
(
scope
)
);
tuple
[
1
]
=
rs
.
getBytes
(
"attname"
);
tuple
[
1
]
=
rs
.
getBytes
(
"attname"
);
tuple
[
2
]
=
Integer
.
toString
(
connection
.
getSQLType
(
columnTypeOid
)).
getBytes
(
);
tuple
[
2
]
=
encoding
.
encode
(
Integer
.
toString
(
connection
.
getSQLType
(
columnTypeOid
))
);
tuple
[
3
]
=
connection
.
getPGType
(
columnTypeOid
).
getBytes
(
);
tuple
[
3
]
=
encoding
.
encode
(
connection
.
getPGType
(
columnTypeOid
)
);
tuple
[
4
]
=
null
;
tuple
[
4
]
=
null
;
tuple
[
5
]
=
null
;
tuple
[
5
]
=
null
;
tuple
[
6
]
=
null
;
tuple
[
6
]
=
null
;
tuple
[
7
]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
bestRowNotPseudo
).
getBytes
(
);
tuple
[
7
]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
bestRowNotPseudo
)
);
v
.
addElement
(
tuple
);
v
.
addElement
(
tuple
);
}
}
...
@@ -2854,13 +2863,13 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -2854,13 +2863,13 @@ public abstract class AbstractJdbc1DatabaseMetaData
*/
*/
tuple
[
0
]
=
null
;
tuple
[
0
]
=
null
;
tuple
[
1
]
=
"ctid"
.
getBytes
(
);
tuple
[
1
]
=
encoding
.
encode
(
"ctid"
);
tuple
[
2
]
=
Integer
.
toString
(
connection
.
getSQLType
(
"tid"
)).
getBytes
(
);
tuple
[
2
]
=
encoding
.
encode
(
Integer
.
toString
(
connection
.
getSQLType
(
"tid"
))
);
tuple
[
3
]
=
"tid"
.
getBytes
(
);
tuple
[
3
]
=
encoding
.
encode
(
"tid"
);
tuple
[
4
]
=
null
;
tuple
[
4
]
=
null
;
tuple
[
5
]
=
null
;
tuple
[
5
]
=
null
;
tuple
[
6
]
=
null
;
tuple
[
6
]
=
null
;
tuple
[
7
]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
versionColumnPseudo
).
getBytes
(
);
tuple
[
7
]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
versionColumnPseudo
)
);
v
.
addElement
(
tuple
);
v
.
addElement
(
tuple
);
/* Perhaps we should check that the given
/* Perhaps we should check that the given
...
@@ -3157,7 +3166,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -3157,7 +3166,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
else
if
(
"restrict"
.
equals
(
rule
))
else
if
(
"restrict"
.
equals
(
rule
))
action
=
java
.
sql
.
DatabaseMetaData
.
importedKeyRestrict
;
action
=
java
.
sql
.
DatabaseMetaData
.
importedKeyRestrict
;
tuple
[
9
]
=
Integer
.
toString
(
action
).
getBytes
(
);
tuple
[
9
]
=
encoding
.
encode
(
Integer
.
toString
(
action
)
);
}
}
...
@@ -3177,7 +3186,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -3177,7 +3186,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
action
=
java
.
sql
.
DatabaseMetaData
.
importedKeySetDefault
;
action
=
java
.
sql
.
DatabaseMetaData
.
importedKeySetDefault
;
else
if
(
"restrict"
.
equals
(
rule
))
else
if
(
"restrict"
.
equals
(
rule
))
action
=
java
.
sql
.
DatabaseMetaData
.
importedKeyRestrict
;
action
=
java
.
sql
.
DatabaseMetaData
.
importedKeyRestrict
;
tuple
[
10
]
=
Integer
.
toString
(
action
).
getBytes
(
);
tuple
[
10
]
=
encoding
.
encode
(
Integer
.
toString
(
action
)
);
}
}
...
@@ -3217,11 +3226,11 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -3217,11 +3226,11 @@ public abstract class AbstractJdbc1DatabaseMetaData
pkeyColumn
=
(
String
)
tokens
.
elementAt
(
element
);
pkeyColumn
=
(
String
)
tokens
.
elementAt
(
element
);
}
}
tuple
[
3
]
=
pkeyColumn
.
getBytes
(
);
//PKCOLUMN_NAME
tuple
[
3
]
=
encoding
.
encode
(
pkeyColumn
);
//PKCOLUMN_NAME
tuple
[
7
]
=
fkeyColumn
.
getBytes
(
);
//FKCOLUMN_NAME
tuple
[
7
]
=
encoding
.
encode
(
fkeyColumn
);
//FKCOLUMN_NAME
tuple
[
8
]
=
rs
.
getBytes
(
6
);
//KEY_SEQ
tuple
[
8
]
=
rs
.
getBytes
(
6
);
//KEY_SEQ
tuple
[
11
]
=
fkName
.
getBytes
(
);
//FK_NAME this will give us a unique name for the foreign key
tuple
[
11
]
=
encoding
.
encode
(
fkName
);
//FK_NAME this will give us a unique name for the foreign key
tuple
[
12
]
=
rs
.
getBytes
(
7
);
//PK_NAME
tuple
[
12
]
=
rs
.
getBytes
(
7
);
//PK_NAME
// DEFERRABILITY
// DEFERRABILITY
...
@@ -3235,7 +3244,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -3235,7 +3244,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
else
else
deferrability
=
java
.
sql
.
DatabaseMetaData
.
importedKeyInitiallyImmediate
;
deferrability
=
java
.
sql
.
DatabaseMetaData
.
importedKeyInitiallyImmediate
;
}
}
tuple
[
13
]
=
Integer
.
toString
(
deferrability
).
getBytes
(
);
tuple
[
13
]
=
encoding
.
encode
(
Integer
.
toString
(
deferrability
)
);
tuples
.
addElement
(
tuple
);
tuples
.
addElement
(
tuple
);
}
}
...
@@ -3498,18 +3507,18 @@ public abstract class AbstractJdbc1DatabaseMetaData
...
@@ -3498,18 +3507,18 @@ public abstract class AbstractJdbc1DatabaseMetaData
ResultSet
rs
=
connection
.
createStatement
().
executeQuery
(
sql
);
ResultSet
rs
=
connection
.
createStatement
().
executeQuery
(
sql
);
// cache some results, this will keep memory useage down, and speed
// cache some results, this will keep memory useage down, and speed
// things up a little.
// things up a little.
byte
b9
[]
=
"9"
.
getBytes
(
);
byte
b9
[]
=
encoding
.
encode
(
"9"
);
byte
b10
[]
=
"10"
.
getBytes
(
);
byte
b10
[]
=
encoding
.
encode
(
"10"
);
byte
bf
[]
=
"f"
.
getBytes
(
);
byte
bf
[]
=
encoding
.
encode
(
"f"
);
byte
bnn
[]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
typeNoNulls
).
getBytes
(
);
byte
bnn
[]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
typeNoNulls
)
);
byte
bts
[]
=
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
typeSearchable
).
getBytes
(
);
byte
bts
[]
=
encoding
.
encode
(
Integer
.
toString
(
java
.
sql
.
DatabaseMetaData
.
typeSearchable
)
);
while
(
rs
.
next
())
while
(
rs
.
next
())
{
{
byte
[][]
tuple
=
new
byte
[
18
][];
byte
[][]
tuple
=
new
byte
[
18
][];
String
typname
=
rs
.
getString
(
1
);
String
typname
=
rs
.
getString
(
1
);
tuple
[
0
]
=
typname
.
getBytes
(
);
tuple
[
0
]
=
encoding
.
encode
(
typname
);
tuple
[
1
]
=
Integer
.
toString
(
connection
.
getSQLType
(
typname
)).
getBytes
(
);
tuple
[
1
]
=
encoding
.
encode
(
Integer
.
toString
(
connection
.
getSQLType
(
typname
))
);
tuple
[
2
]
=
b9
;
// for now
tuple
[
2
]
=
b9
;
// for now
tuple
[
6
]
=
bnn
;
// for now
tuple
[
6
]
=
bnn
;
// for now
tuple
[
7
]
=
bf
;
// false for now - not case sensitive
tuple
[
7
]
=
bf
;
// false for now - not case sensitive
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment