modifydata.java~90~

来自「采用web2.0技术,采用动态标签,sql语句全部存储在数据库里面.开发速度快.」· JAVA~90~ 代码 · 共 331 行

JAVA~90~
331
字号
package com.sztheater.biz.order;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable up-and-up
 * @version 1.0
 */
import java.io.*;
import java.sql.*;
import com.sztheater.framework.util.*;

public class ModifyData {
    public ModifyData() {
    }

    /*
         描述:
     *<p>释放资源</p>
     * @param bSuccFlag 是否提交(对外是否成功标志,成功则提交,否则回滚)
     * @return 无
     */
    public static synchronized boolean AddTicketingSeat(String strSQL) {
        int iSuccFlag = -1;
        PreparedStatement stmt = null;
        Connection conn = null;
        String strMsg = null;
        boolean blResult = false;
        try {
            try {
                conn = DbFunc.getConnection(false);
            } catch (Exception e) {
                if (conn != null) {
                    DbFunc.free(conn, iSuccFlag);
                }
                conn = null;
                strMsg = "服务取数据库连接异常" + e.getMessage();
            }
            stmt = conn.prepareStatement(strSQL);
            blResult = stmt.execute();
             conn.commit();
        } catch (Exception ex) {
              try{conn.rollback();}catch(Exception ex1){ex1.printStackTrace();}
            ex.printStackTrace();
        } finally {
            try {
                if (stmt != null) {
                    stmt.close();
                }
                if (conn != null) {
                    conn.close();
                }
            } catch (Exception ex) {
            }
            stmt = null;
            conn = null;

        }
        return blResult;
    }

    public static synchronized boolean ModifyTicketingSeat(String strSQL) {
        int iSuccFlag = -1;
        PreparedStatement stmt = null;
        Connection conn = null;
        String strMsg = null;
        boolean blResult = false;
        try {
            try {
                conn = DbFunc.getConnection(false);
            } catch (Exception e) {
                if (conn != null) {
                    DbFunc.free(conn, iSuccFlag);
                }
                conn = null;
                strMsg = "服务取数据库连接异常" + e.getMessage();
            }
            stmt = conn.prepareStatement(strSQL);
            blResult = stmt.execute();
            System.out.println("^^^^^^^^^^^^^^^^^^^blResult="+blResult);
             conn.commit();
        } catch (Exception ex) {
            try{conn.rollback();}catch(Exception ex1){ex1.printStackTrace();}
            ex.printStackTrace();
        } finally {
            try {
                if (stmt != null) {
                    stmt.close();
                }
                if (conn != null) {
                    conn.close();
                }
            } catch (Exception ex) {
            }
            stmt = null;
            conn = null;
        }
        return blResult;
    }

    public static synchronized boolean AddSeat(String strSQL) {
        int iSuccFlag = -1;
        PreparedStatement stmt = null;
        Connection conn = null;
        String strMsg = null;
        boolean blResult = false;
        try {
            try {
                conn = DbFunc.getConnection(false);
            } catch (Exception e) {
                if (conn != null) {
                    DbFunc.free(conn, iSuccFlag);
                }
                conn = null;
                strMsg = "服务取数据库连接异常" + e.getMessage();
            }
            stmt = conn.prepareStatement(strSQL);
            blResult = stmt.execute();
             conn.commit();
        } catch (Exception ex) {
            try{conn.rollback();}catch(Exception ex1){ex1.printStackTrace();}
            ex.printStackTrace();
        } finally {
            try {
                if (stmt != null) {
                    stmt.close();
                }
                if (conn != null) {
                    conn.close();
                }
            } catch (Exception ex) {
            }
            stmt = null;
            conn = null;

        }
        return blResult;
    }
    public static synchronized boolean ModifySeat(String strSQL) {
        int iSuccFlag = -1;
        PreparedStatement stmt = null;
        Connection conn = null;
        String strMsg = null;
        boolean blResult = false;
        try {
            try {
                conn = DbFunc.getConnection(false);
            } catch (Exception e) {
                if (conn != null) {
                    DbFunc.free(conn, iSuccFlag);
                }
                conn = null;
                strMsg = "服务取数据库连接异常" + e.getMessage();
            }
            stmt = conn.prepareStatement(strSQL);
            blResult = stmt.execute();
             conn.commit();
        } catch (Exception ex) {
            try{conn.rollback();}catch(Exception ex1){ex1.printStackTrace();}
            ex.printStackTrace();
        } finally {
            try {
                if (stmt != null) {
                    stmt.close();
                }
                if (conn != null) {
                    conn.close();
                }
            } catch (Exception ex) {
            }
            stmt = null;
            conn = null;
        }
        return blResult;
    }
    public static synchronized boolean AddOrder(String strSQL) {
        int iSuccFlag = -1;
        PreparedStatement stmt = null;
        Connection conn = null;
        String strMsg = null;
        boolean blResult = false;
        try {
            try {
                conn = DbFunc.getConnection(false);
            } catch (Exception e) {
                if (conn != null) {
                    DbFunc.free(conn, iSuccFlag);
                }
                conn = null;
                strMsg = "服务取数据库连接异常" + e.getMessage();
            }
            stmt = conn.prepareStatement(strSQL);
            blResult = stmt.execute();
             conn.commit();
        } catch (Exception ex) {
            try{conn.rollback();}catch(Exception ex1){ex1.printStackTrace();}
            ex.printStackTrace();
        } finally {
            try {
                if (stmt != null) {
                    stmt.close();
                }
                if (conn != null) {
                    conn.close();
                }
            } catch (Exception ex) {
            }
            stmt = null;
            conn = null;

        }
        return blResult;
    }
    public static synchronized boolean ModifyOrder(String strSQL) {
        int iSuccFlag = -1;
        PreparedStatement stmt = null;
        Connection conn = null;
        String strMsg = null;
        boolean blResult = false;
        try {
            try {
                conn = DbFunc.getConnection(false);
            } catch (Exception e) {
                if (conn != null) {
                    DbFunc.free(conn, iSuccFlag);
                }
                conn = null;
                strMsg = "服务取数据库连接异常" + e.getMessage();
            }
            stmt = conn.prepareStatement(strSQL);
            blResult = stmt.execute();
             conn.commit();
        } catch (Exception ex) {
            try{conn.rollback();}catch(Exception ex1){ex1.printStackTrace();}
            ex.printStackTrace();
        } finally {
            try {
                conn.commit();
                if (stmt != null) {
                    stmt.close();
                }
                if (conn != null) {
                    conn.close();
                }
            } catch (Exception ex) {
            }
            stmt = null;
            conn = null;
        }
        return blResult;
    }
    public static synchronized boolean AddSeatsOrdered(String strSQL) {
     int iSuccFlag = -1;
     PreparedStatement stmt = null;
     Connection conn = null;
     String strMsg = null;
     boolean blResult = false;
     try {
         try {
             conn = DbFunc.getConnection(false);
         } catch (Exception e) {
             if (conn != null) {
                 DbFunc.free(conn, iSuccFlag);
             }
             conn = null;
             strMsg = "服务取数据库连接异常" + e.getMessage();
         }
         stmt = conn.prepareStatement(strSQL);
         blResult = stmt.execute();
         conn.commit();
     } catch (Exception ex) {
           try{conn.rollback();}catch(Exception ex1){ex1.printStackTrace();}
         ex.printStackTrace();
     } finally {
         try {
             if (stmt != null) {
                 stmt.close();
             }
             if (conn != null) {
                 conn.close();
             }
         } catch (Exception ex) {
         }
         stmt = null;
         conn = null;

     }
     return blResult;
 }
 public static synchronized boolean ModifySeatsOrdered(String strSQL) {
     int iSuccFlag = -1;
     PreparedStatement stmt = null;
     Connection conn = null;
     String strMsg = null;
     boolean blResult = false;
     try {
         try {
             conn = DbFunc.getConnection(false);
         } catch (Exception e) {
             if (conn != null) {
                 DbFunc.free(conn, iSuccFlag);
             }
             conn = null;
             strMsg = "服务取数据库连接异常" + e.getMessage();
         }
         stmt = conn.prepareStatement(strSQL);
         blResult = stmt.execute();
         conn.commit();
     } catch (Exception ex) {
           try{conn.rollback();}catch(Exception ex1){ex1.printStackTrace();}
         ex.printStackTrace();
     } finally {
         try {
             if (stmt != null) {
                 stmt.close();
             }
             if (conn != null) {
                 conn.close();
             }
         } catch (Exception ex) {
         }
         stmt = null;
         conn = null;
     }
     return blResult;
 }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?