Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
java_weekendowa_20221008
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
java_weekendowa_20221008
Commits
44dfee4e
Commit
44dfee4e
authored
Dec 11, 2022
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Poprawka w CustomerDAO
parent
1f54b347
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
CustomerDAO.java
PC25-SklepWeb/src/main/java/sklep/db/CustomerDAO.java
+3
-3
CustomerDAO.java
PC33-SoapSerwer/src/main/java/sklep/db/CustomerDAO.java
+3
-3
CustomerDAO.java
PC35-RestSerwer/src/main/java/sklep/db/CustomerDAO.java
+3
-3
No files found.
PC25-SklepWeb/src/main/java/sklep/db/CustomerDAO.java
View file @
44dfee4e
...
@@ -54,7 +54,7 @@ public class CustomerDAO {
...
@@ -54,7 +54,7 @@ public class CustomerDAO {
private
Customer
customerFromRS
(
ResultSet
rs
)
throws
SQLException
{
private
Customer
customerFromRS
(
ResultSet
rs
)
throws
SQLException
{
return
new
Customer
(
return
new
Customer
(
rs
.
getString
(
"customer_email"
),
rs
.
getString
(
"customer_email"
),
rs
.
getString
(
"
customer_
name"
),
rs
.
getString
(
"name"
),
rs
.
getString
(
"phone_number"
),
rs
.
getString
(
"phone_number"
),
rs
.
getString
(
"address"
),
rs
.
getString
(
"address"
),
rs
.
getString
(
"postal_code"
),
rs
.
getString
(
"postal_code"
),
...
@@ -64,7 +64,7 @@ public class CustomerDAO {
...
@@ -64,7 +64,7 @@ public class CustomerDAO {
public
void
insert
(
Customer
customer
)
throws
DBException
{
public
void
insert
(
Customer
customer
)
throws
DBException
{
// używać gdy obiekt ma wpisane ID (tu: email)
// używać gdy obiekt ma wpisane ID (tu: email)
final
String
sql
=
"INSERT INTO customers("
final
String
sql
=
"INSERT INTO customers("
+
"customer_email,
customer_
name, phone_number, address, postal_code, city)"
+
"customer_email, name, phone_number, address, postal_code, city)"
+
" VALUES (?, ?, ?, ?, ?, ?)"
;
+
" VALUES (?, ?, ?, ?, ?, ?)"
;
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
stmt
.
setString
(
1
,
customer
.
getEmail
());
stmt
.
setString
(
1
,
customer
.
getEmail
());
...
@@ -81,7 +81,7 @@ public class CustomerDAO {
...
@@ -81,7 +81,7 @@ public class CustomerDAO {
public
boolean
update
(
Customer
customer
)
throws
DBException
{
public
boolean
update
(
Customer
customer
)
throws
DBException
{
final
String
sql
=
"UPDATE customers SET "
final
String
sql
=
"UPDATE customers SET "
+
"
customer_
name=?, phone_number=?, address=?, postal_code=?, city=?"
+
" name=?, phone_number=?, address=?, postal_code=?, city=?"
+
" WHERE customer_email = ?"
;
+
" WHERE customer_email = ?"
;
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
stmt
.
setString
(
1
,
customer
.
getName
());
stmt
.
setString
(
1
,
customer
.
getName
());
...
...
PC33-SoapSerwer/src/main/java/sklep/db/CustomerDAO.java
View file @
44dfee4e
...
@@ -54,7 +54,7 @@ public class CustomerDAO {
...
@@ -54,7 +54,7 @@ public class CustomerDAO {
private
Customer
customerFromRS
(
ResultSet
rs
)
throws
SQLException
{
private
Customer
customerFromRS
(
ResultSet
rs
)
throws
SQLException
{
return
new
Customer
(
return
new
Customer
(
rs
.
getString
(
"customer_email"
),
rs
.
getString
(
"customer_email"
),
rs
.
getString
(
"
customer_
name"
),
rs
.
getString
(
"name"
),
rs
.
getString
(
"phone_number"
),
rs
.
getString
(
"phone_number"
),
rs
.
getString
(
"address"
),
rs
.
getString
(
"address"
),
rs
.
getString
(
"postal_code"
),
rs
.
getString
(
"postal_code"
),
...
@@ -64,7 +64,7 @@ public class CustomerDAO {
...
@@ -64,7 +64,7 @@ public class CustomerDAO {
public
void
insert
(
Customer
customer
)
throws
DBException
{
public
void
insert
(
Customer
customer
)
throws
DBException
{
// używać gdy obiekt ma wpisane ID (tu: email)
// używać gdy obiekt ma wpisane ID (tu: email)
final
String
sql
=
"INSERT INTO customers("
final
String
sql
=
"INSERT INTO customers("
+
"customer_email,
customer_
name, phone_number, address, postal_code, city)"
+
"customer_email, name, phone_number, address, postal_code, city)"
+
" VALUES (?, ?, ?, ?, ?, ?)"
;
+
" VALUES (?, ?, ?, ?, ?, ?)"
;
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
stmt
.
setString
(
1
,
customer
.
getEmail
());
stmt
.
setString
(
1
,
customer
.
getEmail
());
...
@@ -81,7 +81,7 @@ public class CustomerDAO {
...
@@ -81,7 +81,7 @@ public class CustomerDAO {
public
boolean
update
(
Customer
customer
)
throws
DBException
{
public
boolean
update
(
Customer
customer
)
throws
DBException
{
final
String
sql
=
"UPDATE customers SET "
final
String
sql
=
"UPDATE customers SET "
+
"
customer_
name=?, phone_number=?, address=?, postal_code=?, city=?"
+
" name=?, phone_number=?, address=?, postal_code=?, city=?"
+
" WHERE customer_email = ?"
;
+
" WHERE customer_email = ?"
;
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
stmt
.
setString
(
1
,
customer
.
getName
());
stmt
.
setString
(
1
,
customer
.
getName
());
...
...
PC35-RestSerwer/src/main/java/sklep/db/CustomerDAO.java
View file @
44dfee4e
...
@@ -54,7 +54,7 @@ public class CustomerDAO {
...
@@ -54,7 +54,7 @@ public class CustomerDAO {
private
Customer
customerFromRS
(
ResultSet
rs
)
throws
SQLException
{
private
Customer
customerFromRS
(
ResultSet
rs
)
throws
SQLException
{
return
new
Customer
(
return
new
Customer
(
rs
.
getString
(
"customer_email"
),
rs
.
getString
(
"customer_email"
),
rs
.
getString
(
"
customer_
name"
),
rs
.
getString
(
"name"
),
rs
.
getString
(
"phone_number"
),
rs
.
getString
(
"phone_number"
),
rs
.
getString
(
"address"
),
rs
.
getString
(
"address"
),
rs
.
getString
(
"postal_code"
),
rs
.
getString
(
"postal_code"
),
...
@@ -64,7 +64,7 @@ public class CustomerDAO {
...
@@ -64,7 +64,7 @@ public class CustomerDAO {
public
void
insert
(
Customer
customer
)
throws
DBException
{
public
void
insert
(
Customer
customer
)
throws
DBException
{
// używać gdy obiekt ma wpisane ID (tu: email)
// używać gdy obiekt ma wpisane ID (tu: email)
final
String
sql
=
"INSERT INTO customers("
final
String
sql
=
"INSERT INTO customers("
+
"customer_email,
customer_
name, phone_number, address, postal_code, city)"
+
"customer_email, name, phone_number, address, postal_code, city)"
+
" VALUES (?, ?, ?, ?, ?, ?)"
;
+
" VALUES (?, ?, ?, ?, ?, ?)"
;
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
stmt
.
setString
(
1
,
customer
.
getEmail
());
stmt
.
setString
(
1
,
customer
.
getEmail
());
...
@@ -81,7 +81,7 @@ public class CustomerDAO {
...
@@ -81,7 +81,7 @@ public class CustomerDAO {
public
boolean
update
(
Customer
customer
)
throws
DBException
{
public
boolean
update
(
Customer
customer
)
throws
DBException
{
final
String
sql
=
"UPDATE customers SET "
final
String
sql
=
"UPDATE customers SET "
+
"
customer_
name=?, phone_number=?, address=?, postal_code=?, city=?"
+
" name=?, phone_number=?, address=?, postal_code=?, city=?"
+
" WHERE customer_email = ?"
;
+
" WHERE customer_email = ?"
;
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
try
(
PreparedStatement
stmt
=
db
.
getSqlConnection
().
prepareStatement
(
sql
))
{
stmt
.
setString
(
1
,
customer
.
getName
());
stmt
.
setString
(
1
,
customer
.
getName
());
...
...
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