Skip to content

Commit

Permalink
Release 1.0.0.7
Browse files Browse the repository at this point in the history
Clean Code
  • Loading branch information
edleyhoyler committed Sep 20, 2018
1 parent b278ed2 commit c995926
Show file tree
Hide file tree
Showing 19 changed files with 900 additions and 934 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package br.com.hoyler.apps.database.sqlite;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.DriverManager;

import org.sqlite.SQLiteConfig;
import java.sql.PreparedStatement;

import br.com.hoyler.apps.tools.CheckFile;

public class Database {

public Database() {

}
public Database(){}

private Connection connection = null;
private PreparedStatement preparedStatement = null;
private final String BANCO_DE_DADOS_ARQUIVO = ("ImprimePonto.s3db");
private final String BANCO_DE_DADOS_CAMINHO = ("ImprimePonto/Database/");

public final String TABELA_FUNCOES = ("Funcoes");
public final String TABELA_EMPRESAS = ("Empresas");
public final String TABELA_PESSOAS = ("Pessoas");
Expand Down Expand Up @@ -88,14 +88,11 @@ public void CriarConexaoDB() {
"public class br.com.hoyler.apps.database.sqlite CriarConexaoDB DB_URL: [%s] [SQLException TRY ERRO]",
DatabaseURL));
}

} else {
System.out.println(String.format(
"public class br.com.hoyler.apps.database.sqlite CriarConexaoDB BANCO_EXISTE: [%s] [ELSE ERRO]",
ARQUIVO_EXISTE.toString()));

}

}

public void ConexaoDBClose() throws SQLException {
Expand Down Expand Up @@ -171,7 +168,6 @@ public Boolean DeletarNomes(String tablela, String campo, String nome) {
"public class br.com.hoyler.apps.database.sqlite DeletarNomes TABELA: [%s] - CAMPO: [%s] - VALOR: [%s] [SQLException TRY ERRO]\n%s",
tablela, campo, nome));
}

return returnBool;
}

Expand All @@ -182,17 +178,16 @@ public ResultSet ExecutarSQL(String scriptSQL) {
this.CriarConexaoDB();

try {

preparedStatement = connection.prepareStatement(scriptSQL);

returnResultSet = preparedStatement.executeQuery();

} catch (SQLException e) {
} catch (SQLException sqlEx) {

System.out.println(String.format(
"public class br.com.hoyler.apps.database.sqlite ExecutarSQL SQL: [%s] [SQLException TRY ERRO]", scriptSQL));
"public class br.com.hoyler.apps.database.sqlite ExecutarSQL SQL: %s [SQLException TRY ERRO] %s", scriptSQL, sqlEx.getMessage()));
}

return (returnResultSet);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,38 @@

public class Empresas {

private int CODIGO;
private String NOME;
private String CPNJ;
private String ENDERECO;

public int getCODIGO() {
return CODIGO;
public Empresas() {}

private int codigo;
private String nome;
private String cnpj;
private String endereco;

public int getCodigo() {
return codigo;
}

public void setCODIGO(int cODIGO) {
CODIGO = cODIGO;
public void setCodigo(int codigo) {
this.codigo = codigo;
}

public String getNOME() {
return NOME;
public String getNome() {
return nome;
}

public void setNOME(String nOME) {
NOME = nOME;
public void setNome(String nome) {
this.nome = nome;
}

public String getCPNJ() {
return CPNJ;
public String getCnpj() {
return cnpj;
}

public void setCPNJ(String cPNJ) {
CPNJ = cPNJ;
public void setCnpj(String cnpj) {
this.cnpj = cnpj;
}

public String getENDERECO() {
return ENDERECO;
public String getEndereco() {
return endereco;
}

public void setENDERECO(String eNDERECO) {
ENDERECO = eNDERECO;
public void setEndereco(String endereco) {
this.endereco = endereco;
}



}
Loading

0 comments on commit c995926

Please sign in to comment.