/** 检查数据库中是否只剩下一条此类型的图片数据信息 true--只剩下一条,false--不只有一条 */ public boolean onlyOne(LEDPicSchema tLEDPicSchema) { ExeSQL mExeSQL = new ExeSQL(); String sql = "select * from ledpic where typecode= ? "; String[] param1 = {"String", tLEDPicSchema.getTypecode()}; ArrayList<String[]> sqlParamList = new ArrayList<String[]>(); sqlParamList.add(param1); SSRS tSSRS = mExeSQL.execSQL(sql, sqlParamList); if (tSSRS == null || tSSRS.MaxRow <= 1) { return true; } return false; }
/** * 新增图片信息 * * @param LEDPicSchema * @return boolean */ public boolean add(LEDPicSchema tLEDPicSchema) { ExeSQL mExeSQL = new ExeSQL(); StringBuffer sqlbuf = new StringBuffer(); sqlbuf.append("insert into ledpic values("); sqlbuf.append("?,"); sqlbuf.append("?,"); sqlbuf.append("?,"); sqlbuf.append("?,"); sqlbuf.append("?,"); sqlbuf.append("?,"); sqlbuf.append("?,"); sqlbuf.append("?,"); sqlbuf.append("?)"); ArrayList<String[]> list = new ArrayList<String[]>(); String[] arr = new String[2]; arr[0] = "String"; arr[1] = tLEDPicSchema.getPicCode(); list.add(arr); arr = new String[2]; arr[0] = "String"; arr[1] = tLEDPicSchema.getName(); list.add(arr); arr = new String[2]; arr[0] = "String"; arr[1] = tLEDPicSchema.getTypecode(); list.add(arr); arr = new String[2]; arr[0] = "String"; arr[1] = tLEDPicSchema.getUseFlag(); list.add(arr); arr = new String[2]; arr[0] = "String"; arr[1] = tLEDPicSchema.getField1(); list.add(arr); arr = new String[2]; arr[0] = "String"; arr[1] = tLEDPicSchema.getField2(); list.add(arr); arr = new String[2]; arr[0] = "String"; arr[1] = tLEDPicSchema.getField3(); list.add(arr); arr = new String[2]; arr[0] = "String"; arr[1] = tLEDPicSchema.getMakeDate(); list.add(arr); arr = new String[2]; arr[0] = "String"; arr[1] = tLEDPicSchema.getMakeTime(); list.add(arr); if (!mExeSQL.execUpdateSQL(sqlbuf.toString(), list)) { System.out.println("图片保存过程出现错误!"); return false; } System.out.println("图片保存成功!"); return true; }