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
db491a6d
Commit
db491a6d
authored
Jun 29, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SimpleDateFormat performance improvement, thread-safe.
Barry Lind
parent
39381507
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
19 deletions
+8
-19
src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java
...terfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java
+8
-19
No files found.
src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java
View file @
db491a6d
...
@@ -65,14 +65,6 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
...
@@ -65,14 +65,6 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
this
.
sql
=
sql
;
this
.
sql
=
sql
;
this
.
connection
=
connection
;
this
.
connection
=
connection
;
// might just as well create it here, so we don't take the hit later
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"''yyyy-MM-dd''"
);
tl_df
.
set
(
df
);
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
tl_tsdf
.
set
(
df
);
for
(
i
=
0
;
i
<
sql
.
length
();
++
i
)
for
(
i
=
0
;
i
<
sql
.
length
();
++
i
)
{
{
int
c
=
sql
.
charAt
(
i
);
int
c
=
sql
.
charAt
(
i
);
...
@@ -95,17 +87,6 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
...
@@ -95,17 +87,6 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
templateStrings
[
i
]
=
(
String
)
v
.
elementAt
(
i
);
templateStrings
[
i
]
=
(
String
)
v
.
elementAt
(
i
);
}
}
/**
* New in 7.1 - overides Statement.close() to dispose of a few local objects
*/
public
void
close
()
throws
SQLException
{
// free the ThreadLocal caches
tl_df
.
set
(
null
);
tl_tsdf
.
set
(
null
);
super
.
close
();
}
/**
/**
* A Prepared SQL query is executed and its ResultSet is returned
* A Prepared SQL query is executed and its ResultSet is returned
*
*
...
@@ -343,6 +324,10 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
...
@@ -343,6 +324,10 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
public
void
setDate
(
int
parameterIndex
,
java
.
sql
.
Date
x
)
throws
SQLException
public
void
setDate
(
int
parameterIndex
,
java
.
sql
.
Date
x
)
throws
SQLException
{
{
SimpleDateFormat
df
=
(
SimpleDateFormat
)
tl_df
.
get
();
SimpleDateFormat
df
=
(
SimpleDateFormat
)
tl_df
.
get
();
if
(
df
==
null
)
{
df
=
new
SimpleDateFormat
(
"''yyyy-MM-dd''"
);
tl_df
.
set
(
df
);
}
set
(
parameterIndex
,
df
.
format
(
x
));
set
(
parameterIndex
,
df
.
format
(
x
));
...
@@ -382,6 +367,10 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
...
@@ -382,6 +367,10 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
public
void
setTimestamp
(
int
parameterIndex
,
Timestamp
x
)
throws
SQLException
public
void
setTimestamp
(
int
parameterIndex
,
Timestamp
x
)
throws
SQLException
{
{
SimpleDateFormat
df
=
(
SimpleDateFormat
)
tl_tsdf
.
get
();
SimpleDateFormat
df
=
(
SimpleDateFormat
)
tl_tsdf
.
get
();
if
(
df
==
null
)
{
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
tl_tsdf
.
set
(
df
);
}
df
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT"
));
df
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT"
));
// Use the shared StringBuffer
// Use the shared StringBuffer
...
...
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