自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(1)
  • 资源 (1)
  • 收藏
  • 关注

原创 git学习(一)

git是一种分布式的版本控制器,较之SVN的集中式的版本控制方式。优点谁用谁知道。废话不多说。 下面来看下git的强大之处: 1.版本回退。 git reset --hard HEAD^ git reset --hard commitid git log git log --pretty=oneline git reflog 2.提交暂存区 工作区:gti add read.tx

2016-10-03 10:25:19 204

bbs系统可留言

bss系统管理的片段 package bbs.xzit.dbc; import java.sql.*; import java.util.Iterator; import java.util.LinkedHashMap; public class DatabaseUtil { private DatabaseConnection dbc; public DatabaseUtil(){ dbc = new DatabaseConnection(); } // DML DDL ---insert update delete //insert into table(f1,f2...) values(?,?...?) public int executeUpdate(String sql,Object[] param) throws Exception { Connection connect = dbc.getConn(); int num = 0; PreparedStatement pstmt = null; try { pstmt = connect.prepareStatement(sql); for(int i=0;i<param.length;i++){ pstmt.setObject(i+1, param[i]); } num = pstmt.executeUpdate(); } catch (SQLException ex) { throw new Exception("错误提示:请检查SQL语法是否有误"); //throw ex ; } finally{ close(connect,pstmt,null); } return num; } //select public ResultSet executeQuery(String sql,Object[] param) throws Exception { ResultSet rs = null; Connection connect = dbc.getConn(); PreparedStatement pstmt = null; try { pstmt = connect.prepareStatement(sql); for(int i=0;i<param.length;i++){ pstmt.setObject(i+1, param[i]); } rs = pstmt.executeQuery(); } catch (SQLException ex) { throw new Exception("错误提示:请检查SQL语法是否有误,"+ex.getMessage()); } return rs; } // oder by f1 asc,f2 dsc public ResultSet executeQuery(String sql,Object[] param,LinkedHashMap order) throws Exception { ResultSet rs = null; Connection connect = dbc.getConn(); PreparedStatement pstmt = null; String orderStr = ""; Iterator keys = order.keySet().iterator(); if(order.size()>0) orderStr = "order by "; while(keys.hasNext()){ String key =(String)keys.next(); String keyValue = (String)order.get(key); orderStr = orderStr + key +" " + keyValue +","; } orderStr.substring(0, orderStr.length()-2); sql = sql + orderStr; try { pstmt = connect.prepareStatement(sql); for(int i=0;i<param.length;i++){ pstmt.setObject(i+1, param[i]); } rs = pstmt.executeQuery(); } catch (SQLException ex) { throw new Exception("错误提示:请检查SQL语法是否有误,"+ex.getMessage()); } return rs; } public int executeCount(String sql,Object[] param) throws Exception { ResultSet rs = null; Connection connect = dbc.getConn(); PreparedStatement pstmt = null; int cnt = 0; try { pstmt = connect.prepareStatement(sql); for(int i=0;i<param.length;i++){ pstmt.setObject(i+1, param[i]); } rs = pstmt.executeQuery(); if(rs!=null){ cnt =rs.getInt(1); } } catch (SQLException ex) { throw new Exception("错误提示:"+ex.getMessage()); }finally{ close(connect,pstmt,rs); } return cnt; } public void close(Connection conn,PreparedStatement pstmt,ResultSet rs){ try{ if(rs!=null ) rs.close(); if(pstmt!=null) pstmt.close(); if(conn!=null) conn.close(); }catch(Exception ex){ } } }

2012-05-16

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除