From 30451618f02711364377377614b15070cb651d49 Mon Sep 17 00:00:00 2001
From: francisco Jesusdf <Francisco.jesusdf@gmail.com>
Date: Mon, 14 Aug 2023 14:49:34 +0000
Subject: [PATCH 1/9] =?UTF-8?q?Adicionado=20controle=20de=20vers=C3=B4es?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/test/java/com/example/AppTest.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/java/com/example/AppTest.java b/src/test/java/com/example/AppTest.java
index a2ab4eda..f32e6c1b 100644
--- a/src/test/java/com/example/AppTest.java
+++ b/src/test/java/com/example/AppTest.java
@@ -4,6 +4,7 @@
 import org.junit.jupiter.api.Test;
 
 public class AppTest {
+    //comentando 
 
     @Test
     public void shouldAnswerWithTrue() {

From 01f4258f39cac5eb7d63a6e43609842125ac60b5 Mon Sep 17 00:00:00 2001
From: francisco Jesusdf <Francisco.jesusdf@gmail.com>
Date: Wed, 16 Aug 2023 03:59:13 +0000
Subject: [PATCH 2/9] Add-Arrays.Java

---
 src/test/java/com/example/App.java       | 20 ++++++++++++++++++++
 src/test/java/com/example/AppArrays.java | 18 ++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 src/test/java/com/example/App.java
 create mode 100644 src/test/java/com/example/AppArrays.java

diff --git a/src/test/java/com/example/App.java b/src/test/java/com/example/App.java
new file mode 100644
index 00000000..048aa5a3
--- /dev/null
+++ b/src/test/java/com/example/App.java
@@ -0,0 +1,20 @@
+package com.example;
+
+public class App {
+  
+    public static void main(String[] args) {
+        System.out.println();
+        System.out.println();
+        System.out.println("MInha Aplicação Java\n");  
+        
+        // TIpo nomeDaVariavel;
+        var idade = 10;
+        var  peso = 80.55;
+        System.out.println("Idade é " + idade + " Peso é " + peso); 
+        var sexo = 'M';
+        System.out.println("Sexo: " + sexo);
+        var nessecidadesEspeciais = false;
+        System.out.println("Tem necessecidades especiais: " + nessecidadesEspeciais);
+
+        }      
+    }
\ No newline at end of file
diff --git a/src/test/java/com/example/AppArrays.java b/src/test/java/com/example/AppArrays.java
new file mode 100644
index 00000000..d110a9a1
--- /dev/null
+++ b/src/test/java/com/example/AppArrays.java
@@ -0,0 +1,18 @@
+package com.example;
+
+import java.util.Arrays;
+
+public class AppArrays {
+    public static void main(String[] args) {
+        int x = 10 ;
+        System.out.println(x);
+    
+        x = 20;
+
+        System.out.println(x);
+        double vetorDouble [] = {10, 20, 30};
+        System.out.println(Arrays.toString(vetorDouble)); 
+
+    }
+    
+}

From a99ac24c09590b72b31382275b6248695cfed530 Mon Sep 17 00:00:00 2001
From: francisco Jesusdf <Francisco.jesusdf@gmail.com>
Date: Fri, 18 Aug 2023 02:42:29 +0000
Subject: [PATCH 3/9] Revert "Adiciona capitais dos estados"

This reverts commit b397c675f0c12cfe82a01a2f4a74a8db33ff85ca.
---
 dados.sql                          | 43 +++++++++++++++---------------
 src/test/java/com/example/App.java |  3 +--
 2 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/dados.sql b/dados.sql
index 3097ea8d..12a6ef2a 100644
--- a/dados.sql
+++ b/dados.sql
@@ -43,7 +43,6 @@ CREATE TABLE cidade (
     id serial PRIMARY KEY NOT NULL,
     nome varchar(120) NOT NULL,
     estado_id int NOT NULL,
-    capital boolean not null default false,
     constraint fk_cidade_estado foreign key (estado_id) references estado(id)
 );
 
@@ -175,33 +174,33 @@ FOR EACH ROW EXECUTE PROCEDURE atualiza_estoque_func();
 INSERT INTO regiao_geografica (nome) VALUES ('Norte'), ('Nordeste'), ('Centro-Oeste'), ('Sudeste'), ('Sul');
 
 INSERT INTO estado (id, nome, uf, regiao_id, area_km2, populacao) VALUES
-     (1, 'Acre',                'AC', 1,  164123,   829780),
-     (2, 'Alagoas',             'AL', 2,   27848,  3125254),
-     (3, 'Amazonas',            'AM', 1, 1559167,  3952262),
-     (4, 'Amapá',               'AP', 1,  142470,   774268),
+     (1, 'Acre',                'AC', 1,  164123, 829780),
+     (2, 'Alagoas',             'AL', 2,   27848, 3125254),
+     (3, 'Amazonas',            'AM', 1, 1559167, 3952262),
+     (4, 'Amapá',               'AP', 1,  142470, 774268),
      (5, 'Bahia',               'BA', 2,  564760, 14659023),
-     (6, 'Ceará',               'CE', 2,  148894,  8936431),
-     (7, 'Distrito Federal',    'DF', 3,    5760,  2923369),
-     (8, 'Espírito Santo',      'ES', 4,   46074,  4108508),
-     (9, 'Goiás',               'GO', 3,  340203,  6950976),
-     (10, 'Maranhão',           'MA', 2,  329642,  6800605),
+     (6, 'Ceará',               'CE', 2,  148894, 8936431),
+     (7, 'Distrito Federal',    'DF', 3,    5760, 2923369),
+     (8, 'Espírito Santo',      'ES', 4,   46074, 4108508),
+     (9, 'Goiás',               'GO', 3,  340203, 6950976),
+     (10, 'Maranhão',           'MA', 2,  329642, 6800605),
      (11, 'Minas Gerais',       'MG', 4,  586521, 20732660),
-     (12, 'Mato Grosso do Sul', 'MS', 3,  357145,  2833742),
-     (13, 'Mato Grosso',        'MT', 3,  903207,  3784239),
-     (14, 'Pará',               'PA', 1, 1245870,  8442962),
-     (15, 'Paraíba',            'PB', 2,   56467,  4030961),
-     (16, 'Pernambuco',         'PE', 2,   98067,  9051113),
-     (17, 'Piauí',              'PI', 2,  251756,  3270174),
+     (12, 'Mato Grosso do Sul', 'MS', 3,  357145, 2833742),
+     (13, 'Mato Grosso',        'MT', 3,  903207, 3784239),
+     (14, 'Pará',               'PA', 1, 1245870, 8442962),
+     (15, 'Paraíba',            'PB', 2,   56467, 4030961),
+     (16, 'Pernambuco',         'PE', 2,   98067, 9051113),
+     (17, 'Piauí',              'PI', 2,  251756, 3270174),
      (18, 'Paraná',             'PR', 5,  199298, 11835379),
      (19, 'Rio de Janeiro',     'RJ', 4,   43750, 16615526),
-     (20, 'Rio Grande do Norte','RN', 2,   52809,  3303953),
-     (21, 'Rondônia',           'RO', 1,  237765,  1616379),
-     (22, 'Roraima',            'RR', 1,  223644,   634805),
+     (20, 'Rio Grande do Norte','RN', 2,   52809, 3303953),
+     (21, 'Rondônia',           'RO', 1,  237765, 1616379),
+     (22, 'Roraima',            'RR', 1,  223644, 634805),
      (23, 'Rio Grande do Sul',  'RS', 5,  281707, 11088065),
-     (24, 'Santa Catarina',     'SC', 5,   95730,  7762154),
-     (25, 'Sergipe',            'SE', 2,   21925,  2211868),
+     (24, 'Santa Catarina',     'SC', 5,   95730, 7762154),
+     (25, 'Sergipe',            'SE', 2,   21925, 2211868),
      (26, 'São Paulo',          'SP', 4,  248219, 46024937),
-     (27, 'Tocantins',          'TO', 1,  277466,  1584306);
+     (27, 'Tocantins',          'TO', 1,  277466, 1584306);
 
 
 INSERT INTO cidade (id, nome, estado_id) VALUES
diff --git a/src/test/java/com/example/App.java b/src/test/java/com/example/App.java
index 048aa5a3..de20aca4 100644
--- a/src/test/java/com/example/App.java
+++ b/src/test/java/com/example/App.java
@@ -3,8 +3,7 @@
 public class App {
   
     public static void main(String[] args) {
-        System.out.println();
-        System.out.println();
+    
         System.out.println("MInha Aplicação Java\n");  
         
         // TIpo nomeDaVariavel;

From a0ae9c11025aba77729f448df30ca4a86fad2842 Mon Sep 17 00:00:00 2001
From: francisco Jesusdf <Francisco.jesusdf@gmail.com>
Date: Fri, 18 Aug 2023 03:02:16 +0000
Subject: [PATCH 4/9] Recomecando Aula 03

---
 src/main/java/com/example/App.java | 110 ++++++-----------------------
 1 file changed, 21 insertions(+), 89 deletions(-)

diff --git a/src/main/java/com/example/App.java b/src/main/java/com/example/App.java
index 9407ea49..81c48291 100644
--- a/src/main/java/com/example/App.java
+++ b/src/main/java/com/example/App.java
@@ -1,98 +1,30 @@
 package com.example;
 
-import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 
 public class App {
-    private static final String PASSWORD = "";
-    private static final String USERNAME = "gitpod";
-    private static final String JDBC_URL = "jdbc:postgresql://localhost/postgres";
 
-    public static void main(String[] args) {
-        new App();
+    public static void main(String[] args){
+        System.out.println();
+        System.out.println("Aplicação Java OVO de Exemplo\n");
+      //  listarEstados();
     }
 
-    public App(){
-        try(var conn = getConnection()){
-            carregarDriverJDBC();
-            listarEstados(conn);
-            localizarEstado(conn, "PR");
-            listarDadosTabela(conn, "produto");
-        } catch (SQLException e) {
-            System.err.println("Não foi possível conectar ao banco de dados: " + e.getMessage());
-        }        
-    }
-
-    private void listarDadosTabela(Connection conn, String tabela) {
-        var sql = "select * from " + tabela;
-        //System.out.println(sql);
-        try {
-            var statement = conn.createStatement();
-            var result = statement.executeQuery(sql);
-
-            var metadata = result.getMetaData();
-            int cols = metadata.getColumnCount();
-
-            for (int i = 1; i <= cols; i++) {
-                System.out.printf("%-25s | ", metadata.getColumnName(i));
-            }
-            System.out.println();
-
-            while(result.next()){
-                for (int i = 1; i <= cols; i++) {
-                    System.out.printf("%-25s | ", result.getString(i));
-                }
-                System.out.println();
-            }
-        } catch (SQLException e) {
-            System.err.println("Erro na execução da consulta: " + e.getMessage());
-        }
-        
-    }
-
-    private void localizarEstado(Connection conn, String uf) {
-        try{
-            //var sql = "select * from estado where uf = '" + uf + "'"; //suscetível a SQL Injection
-            var sql = "select * from estado where uf = ?";
-            var statement = conn.prepareStatement(sql);
-            //System.out.println(sql);
-            statement.setString(1, uf);
-            var result = statement.executeQuery();
-            if(result.next()){
-                System.out.printf("Id: %d Nome: %s UF: %s\n", result.getInt("id"), result.getString("nome"), result.getString("uf"));
-            }
-            System.out.println();
-        } catch(SQLException e){
-            System.err.println("Erro ao executar consulta SQL: " + e.getMessage());
-        }
-        
-    }
-
-    private void listarEstados(Connection conn) {
-        try{
-            System.out.println("Conexão com o banco realizada com sucesso.");
-
-            var statement = conn.createStatement();
-            var result = statement.executeQuery("select * from estado");
-            while(result.next()){
-                System.out.printf("Id: %d Nome: %s UF: %s\n", result.getInt("id"), result.getString("nome"), result.getString("uf"));
-            }
-            System.out.println();
-        } catch (SQLException e) {
-            System.err.println("Não foi possível executar a consulta ao banco: " + e.getMessage());
-        }
-    }
-
-    private Connection getConnection() throws SQLException {
-        return DriverManager.getConnection(JDBC_URL, USERNAME, PASSWORD);
-    }
-
-    private void carregarDriverJDBC() {
-        try {
-            Class.forName("org.postgresql.Driver");
-        } catch (ClassNotFoundException e) {
-            System.err.println("Não foi possível carregar a biblioteca para acesso ao banco de dados: " + e.getMessage());
-        }
-    }
-}
+    // public static void listarEstados()  {
+    //     System.out.println("Listando estados cadastrados no banco de dados");
+    //     try {
+    //         Class.forName("org.postgresql.Driver");
+    //         try(var conn = DriverManager.getConnection("jdbc:postgresql://localhost/meubanco", "postgres", "")){
+    //             var stm = conn.createStatement();
+    //             var result = stm.executeQuery("select * from estado");
+    //             while(result.next()) {
+    //                 System.out.println(result.getString("nome"));
+    //             }
+    //         }
+    //     } catch (ClassNotFoundException | SQLException e) {
+    //         System.out.println("Erro: " + e.getMessage());
+    //     }
+    // }
+
+}
\ No newline at end of file

From 3a66f32ef844eb1c1319bf197d96782138cd6261 Mon Sep 17 00:00:00 2001
From: francisco Jesusdf <Francisco.jesusdf@gmail.com>
Date: Fri, 18 Aug 2023 03:04:45 +0000
Subject: [PATCH 5/9] Alterando para o meu Projeto

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index b0d5a8ce..7ff96584 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 ## Postgres Playground
 
-[![](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/manoelcampos/java-postgres-playground)
+[![](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/franciscoJesusdf/java-postgres-playground)
 
 > **Warning**
 > O gitpod.io não funciona se você tiver a extensão do tradutor habilitada no seu navegador.

From d569b36052652674c4209e090ab371419d954a2f Mon Sep 17 00:00:00 2001
From: francisco Jesusdf <Francisco.jesusdf@gmail.com>
Date: Sun, 20 Aug 2023 19:30:34 +0000
Subject: [PATCH 6/9] App Array-creation

---
 src/main/java/com/example/AppArrays.java | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 src/main/java/com/example/AppArrays.java

diff --git a/src/main/java/com/example/AppArrays.java b/src/main/java/com/example/AppArrays.java
new file mode 100644
index 00000000..d360df3e
--- /dev/null
+++ b/src/main/java/com/example/AppArrays.java
@@ -0,0 +1,8 @@
+package com.example;
+
+public class AppArrays {
+    public static void main(String[] args) {
+        int x = 10;
+        System.out.println(x);
+    }
+}

From f10708177cb02b04fd990af49c2e9ba937141391 Mon Sep 17 00:00:00 2001
From: francisco Jesusdf <Francisco.jesusdf@gmail.com>
Date: Sun, 20 Aug 2023 20:28:09 +0000
Subject: [PATCH 7/9] alinha saida

---
 .vscode/settings.json                    |  3 ++-
 src/main/java/com/example/AppArrays.java | 12 +++++++++++-
 src/test/java/com/example/AppArrays.java | 18 ------------------
 3 files changed, 13 insertions(+), 20 deletions(-)
 delete mode 100644 src/test/java/com/example/AppArrays.java

diff --git a/.vscode/settings.json b/.vscode/settings.json
index 29380f9b..70d59c29 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -15,5 +15,6 @@
     ],
     "maven.executable.preferMavenWrapper": false,
     "terminal.integrated.defaultProfile.linux": "zsh",
-    "java.configuration.updateBuildConfiguration": "automatic"
+    "java.configuration.updateBuildConfiguration": "automatic",
+    "java.debug.settings.onBuildFailureProceed": true
 }
diff --git a/src/main/java/com/example/AppArrays.java b/src/main/java/com/example/AppArrays.java
index d360df3e..d110a9a1 100644
--- a/src/main/java/com/example/AppArrays.java
+++ b/src/main/java/com/example/AppArrays.java
@@ -1,8 +1,18 @@
 package com.example;
 
+import java.util.Arrays;
+
 public class AppArrays {
     public static void main(String[] args) {
-        int x = 10;
+        int x = 10 ;
+        System.out.println(x);
+    
+        x = 20;
+
         System.out.println(x);
+        double vetorDouble [] = {10, 20, 30};
+        System.out.println(Arrays.toString(vetorDouble)); 
+
     }
+    
 }
diff --git a/src/test/java/com/example/AppArrays.java b/src/test/java/com/example/AppArrays.java
deleted file mode 100644
index d110a9a1..00000000
--- a/src/test/java/com/example/AppArrays.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.example;
-
-import java.util.Arrays;
-
-public class AppArrays {
-    public static void main(String[] args) {
-        int x = 10 ;
-        System.out.println(x);
-    
-        x = 20;
-
-        System.out.println(x);
-        double vetorDouble [] = {10, 20, 30};
-        System.out.println(Arrays.toString(vetorDouble)); 
-
-    }
-    
-}

From eb2e9639decfa0e472fe2c6f8e5549a88edbd631 Mon Sep 17 00:00:00 2001
From: francisco Jesusdf <Francisco.jesusdf@gmail.com>
Date: Sun, 20 Aug 2023 20:31:42 +0000
Subject: [PATCH 8/9] edt changes

---
 src/main/java/com/example/AppArrays.java | 26 ++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/example/AppArrays.java b/src/main/java/com/example/AppArrays.java
index d110a9a1..2ee43457 100644
--- a/src/main/java/com/example/AppArrays.java
+++ b/src/main/java/com/example/AppArrays.java
@@ -4,15 +4,25 @@
 
 public class AppArrays {
     public static void main(String[] args) {
-        int x = 10 ;
-        System.out.println(x);
+        int vetor3[] = new int[5] ;
+       for (int i = 0; i < vetor3.length; i++) {
+        vetor3[i] = 100 * (i + 1);
+       }
+        System.out.println(Arrays.toString(vetor3));
+        System.out.println();
     
-        x = 20;
-
-        System.out.println(x);
-        double vetorDouble [] = {10, 20, 30};
-        System.out.println(Arrays.toString(vetorDouble)); 
+        double matriz [] [] = new double[3] [4];
+        for (int i = 0; i < matriz.length; i++) {
+            for (int j = 0; j < matriz[i].length; j++) {
+                matriz[i][j] = (i *  matriz[i].length + j+1) * 10;      
+            }
+        }
 
+        for (int i = 0; i < matriz.length; i++) {
+            for (int j = 0; j < matriz[i].length; j++) {
+                System.out.printf("%5.1f ", matriz[i][j]);           
+            }
+            System.err.println();
+        }
     }
-    
 }

From daa126e948e08a68d497c972c3b77afe28406b44 Mon Sep 17 00:00:00 2001
From: francisco Jesusdf <Francisco.jesusdf@gmail.com>
Date: Sun, 20 Aug 2023 21:52:27 +0000
Subject: [PATCH 9/9] get e set

---
 src/main/java/com/example/AppClasses.java | 42 +++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 src/main/java/com/example/AppClasses.java

diff --git a/src/main/java/com/example/AppClasses.java b/src/main/java/com/example/AppClasses.java
new file mode 100644
index 00000000..af68da92
--- /dev/null
+++ b/src/main/java/com/example/AppClasses.java
@@ -0,0 +1,42 @@
+package com.example;
+
+class Cliente{
+    double renda;
+    char sexo;
+    int anoNascimento;
+
+    double getRenda(){
+        return renda;
+    }
+
+        void setRenda(double renda){
+            if(renda >=0 )
+                this.renda = renda;
+           else System.out.println("A Renda deve ser Maior que ZERO");
+        }
+        
+}
+
+public class AppClasses {
+
+
+    public static void main(String[] args) {
+        System.out.println("Criando Classes");
+        Cliente cliente = new Cliente();
+        cliente.setRenda(-10000);
+        cliente.sexo = 'M';
+        cliente.anoNascimento = 1975;
+        System.out.println("Renda: " + cliente.getRenda());
+        System.out.println("Sexo: " + cliente.sexo);
+        System.out.println("Ano de Nasc: " + cliente.anoNascimento);
+
+        Cliente cliente2 = new Cliente();
+        cliente2.setRenda(9500);
+        cliente2.sexo = 'F';
+        cliente2.anoNascimento = 1968;
+        System.out.println();
+        System.out.println("Renda: " + cliente2.renda);
+        System.out.println("Sexo: " + cliente2.sexo);
+        System.out.println("Ano de Nasc: " + cliente2.anoNascimento);
+    }
+}
