コード例 #1
0
 public void atualizaUsuario(UsuarioDesktop usuarioDesktop) {
   Connection conn = null;
   try {
     conn = ConnectionFactorySQLite.getConnection();
     Statement stm = conn.createStatement();
     stm.executeUpdate(
         "UPDATE usuario_desktop SET servidor_cpf=\""
             + usuarioDesktop.getServidor_cpf()
             + "\""
             + ",token=\""
             + usuarioDesktop.getToken()
             + "\""
             + ",usuario_sistema=\""
             + usuarioDesktop.getUsuario_sistema()
             + "\""
             + ",serial_aplicacao=\""
             + usuarioDesktop.getSerial_aplicacao()
             + "\""
             + "WHERE id=\""
             + UsuarioDesktopDao.id
             + "\"");
   } catch (SQLException e) {
     e.printStackTrace();
   } finally {
     try {
       if (conn != null) conn.close();
     } catch (SQLException ex) {
       Logger.getLogger(UsuarioDesktopDao.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
コード例 #2
0
 public void criaTabela() {
   Connection conn = null;
   try {
     conn = ConnectionFactorySQLite.getConnection();
     Statement stm = conn.createStatement();
     stm.executeUpdate("DROP TABLE IF EXISTS usuario_desktop");
     stm.executeUpdate(
         "CREATE TABLE usuario_desktop ("
             + "id varchar(1) PRIMARY KEY NOT NULL DEFAULT '"
             + UsuarioDesktopDao.id
             + "',"
             + "servidor_cpf varchar(11) NOT NULL DEFAULT '0',"
             + "token varchar(255) NOT NULL DEFAULT '0',"
             + "usuario_sistema varchar(45) NOT NULL DEFAULT 'NAME',"
             + "serial_aplicacao varchar(255) NOT NULL DEFAULT '0');");
   } catch (SQLException e) {
     e.printStackTrace();
   } finally {
     try {
       if (conn != null) conn.close();
     } catch (SQLException ex) {
       Logger.getLogger(UsuarioDesktopDao.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
コード例 #3
0
 public void criaUsuarioDefault() {
   Connection conn = null;
   try {
     conn = ConnectionFactorySQLite.getConnection();
     Statement stm = conn.createStatement();
     stm.executeUpdate(
         "INSERT INTO usuario_desktop(servidor_cpf,token,"
             + "usuario_sistema,serial_aplicacao) VALUES ('0','0','NAME','0')");
   } catch (SQLException e) {
     e.printStackTrace();
   } finally {
     try {
       if (conn != null) conn.close();
     } catch (SQLException ex) {
       Logger.getLogger(UsuarioDesktopDao.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }