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
ded46bd5
Commit
ded46bd5
authored
Apr 11, 1999
by
Peter Mount
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement UpdateCount
parent
50eb8b7d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
4 deletions
+25
-4
src/interfaces/jdbc/CHANGELOG
src/interfaces/jdbc/CHANGELOG
+7
-0
src/interfaces/jdbc/example/basic.java
src/interfaces/jdbc/example/basic.java
+4
-0
src/interfaces/jdbc/postgresql/Connection.java
src/interfaces/jdbc/postgresql/Connection.java
+13
-3
src/interfaces/jdbc/postgresql/Statement.java
src/interfaces/jdbc/postgresql/Statement.java
+1
-1
No files found.
src/interfaces/jdbc/CHANGELOG
View file @
ded46bd5
Sun Apr 11 17:00:00 BST 1999
- getUpdateCount() now returns the actual update count (before it
simply returned 1 for everything).
- added some updates to example.basic so it would test the new update
count code.
- corrected typo in a comment in Statement.java
Mon Jan 25 19:45:00 GMT 1999
Mon Jan 25 19:45:00 GMT 1999
- created subfolders example/corba and example/corba/idl to hold the
- created subfolders example/corba and example/corba/idl to hold the
new example showing how to hook CORBA and PostgreSQL via JDBC
new example showing how to hook CORBA and PostgreSQL via JDBC
...
...
src/interfaces/jdbc/example/basic.java
View file @
ded46bd5
...
@@ -77,6 +77,10 @@ public class basic
...
@@ -77,6 +77,10 @@ public class basic
st
.
executeUpdate
(
"insert into basic values (2,1)"
);
st
.
executeUpdate
(
"insert into basic values (2,1)"
);
st
.
executeUpdate
(
"insert into basic values (3,1)"
);
st
.
executeUpdate
(
"insert into basic values (3,1)"
);
// Now change the value of b from 1 to 8
st
.
executeUpdate
(
"update basic set b=8"
);
System
.
out
.
println
(
"Updated "
+
st
.
getUpdateCount
()+
" rows"
);
// For large inserts, a PreparedStatement is more efficient, because it
// For large inserts, a PreparedStatement is more efficient, because it
// supports the idea of precompiling the SQL statement, and to store
// supports the idea of precompiling the SQL statement, and to store
// directly, a Java object into any column. PostgreSQL doesnt support
// directly, a Java object into any column. PostgreSQL doesnt support
...
...
src/interfaces/jdbc/postgresql/Connection.java
View file @
ded46bd5
...
@@ -10,7 +10,7 @@ import postgresql.largeobject.*;
...
@@ -10,7 +10,7 @@ import postgresql.largeobject.*;
import
postgresql.util.*
;
import
postgresql.util.*
;
/**
/**
* $Id: Connection.java,v 1.1
4 1999/01/17 04:51:50 momjian
Exp $
* $Id: Connection.java,v 1.1
5 1999/04/11 18:03:00 peter
Exp $
*
*
* This abstract class is used by postgresql.Driver to open either the JDBC1 or
* This abstract class is used by postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class.
* JDBC2 versions of the Connection class.
...
@@ -321,6 +321,7 @@ public abstract class Connection
...
@@ -321,6 +321,7 @@ public abstract class Connection
int
fqp
=
0
;
int
fqp
=
0
;
boolean
hfr
=
false
;
boolean
hfr
=
false
;
String
recv_status
=
null
,
msg
;
String
recv_status
=
null
,
msg
;
int
update_count
=
1
;
SQLException
final_error
=
null
;
SQLException
final_error
=
null
;
if
(
sql
.
length
()
>
8192
)
if
(
sql
.
length
()
>
8192
)
...
@@ -358,6 +359,15 @@ public abstract class Connection
...
@@ -358,6 +359,15 @@ public abstract class Connection
break
;
break
;
case
'C'
:
// Command Status
case
'C'
:
// Command Status
recv_status
=
pg_stream
.
ReceiveString
(
8192
);
recv_status
=
pg_stream
.
ReceiveString
(
8192
);
// Now handle the update count correctly.
if
(
recv_status
.
startsWith
(
"INSERT"
)
||
recv_status
.
startsWith
(
"UPDATE"
))
{
try
{
update_count
=
Integer
.
parseInt
(
recv_status
.
substring
(
1
+
recv_status
.
lastIndexOf
(
' '
)));
}
catch
(
NumberFormatException
nfe
)
{
throw
new
SQLException
(
"Unable to fathom update count \""
+
recv_status
+
"\""
);
}
}
if
(
fields
!=
null
)
if
(
fields
!=
null
)
hfr
=
true
;
hfr
=
true
;
else
else
...
@@ -414,8 +424,8 @@ public abstract class Connection
...
@@ -414,8 +424,8 @@ public abstract class Connection
}
}
if
(
final_error
!=
null
)
if
(
final_error
!=
null
)
throw
final_error
;
throw
final_error
;
return
getResultSet
(
this
,
fields
,
tuples
,
recv_status
,
1
);
//return new ResultSet(this, fields, tuples, recv_status, 1
);
return
getResultSet
(
this
,
fields
,
tuples
,
recv_status
,
update_count
);
}
}
}
}
...
...
src/interfaces/jdbc/postgresql/Statement.java
View file @
ded46bd5
...
@@ -35,7 +35,7 @@ public class Statement implements java.sql.Statement
...
@@ -35,7 +35,7 @@ public class Statement implements java.sql.Statement
}
}
/**
/**
* Execute a SQL statement that ret
ru
ns a single ResultSet
* Execute a SQL statement that ret
ur
ns a single ResultSet
*
*
* @param sql typically a static SQL SELECT statement
* @param sql typically a static SQL SELECT statement
* @return a ResulSet that contains the data produced by the query
* @return a ResulSet that contains the data produced by the query
...
...
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