public void UpdateStockPriceByExDivide(String market) throws SQLException {
		
		log.info("start update stock price by ex-divide! market:" + market);
		
		String sql;
		
		//获取所有除权数据市场的表
		ArrayList<String> table_list = new ArrayList<String>();
		
		sql = "show tables like '" + STOCK_EXDIVIDE_TABLE_PRE + "%'";
		log.info(sql);
		ResultSet rs = dbInst.selectSQL(sql);
		
		if (rs == null) {
			log.info("没有可供处理的除权数据表:" + STOCK_EXDIVIDE_TABLE_PRE);
			return;
		}
		
		while (rs.next()) {
			String table = rs.getString(1);
			System.out.println(table);
			table_list.add(table);
		}
		
		rs.close();
		
		for (int i = 0; i < table_list.size(); i++) {
			String ex_table = table_list.get(i);
			
			log.info("开始处理除权表:" + ex_table);
			
			//如果指定了某个市场
			if (!market.equals(STOCK_MARKET_ALL)) {
				if (!ex_table.endsWith(market)) {
					continue;
				}
			}
			
			String stock_table = ex_table.replace(STOCK_EXDIVIDE_TABLE_PRE, STOCK_PRICE_TABLE_PRE);
			String stock_ed_table = ex_table.replace(STOCK_EXDIVIDE_TABLE_PRE, STOCK_PRICE_ED_TABLE_PRE);
			
			System.out.println("ex_table = " + ex_table + ", stock_table = " + stock_table + ", stock_ed_table = " + stock_ed_table);
			
			//1. 先删除除权后的股票价格表
			sql = "drop table if exists " + stock_ed_table;
			log.info(sql);
			dbInst.updateSQL(sql);
			
			//2. 创建除权后的股票价格表（从历史股票价格表导入）
			sql = "create table " + stock_ed_table + " select * from " + stock_table;
			log.info(sql);
			dbInst.updateSQL(sql);
			
			//3. 转为分区表
			sql = "alter table " + stock_ed_table + " partition by key(code) partitions 200";
			log.info(sql);
			dbInst.updateSQL(sql);
			
			//4. 根据除权数据文件，更新股票价格表
			sql = "select `code` as `code`, `day` as `day`, `give` as `give`, `right` as `right`, `right_price` as `right_price`, `bonus` as `bonus` from " + ex_table + " order by code, day";
			log.info(sql);
			rs = dbInst.selectSQL(sql);
			
			while (rs.next()) {
				String code = rs.getString("code");
				String day  = rs.getString("day");
				double give = rs.getDouble("give");
				double right = rs.getDouble("right");
				double right_price = rs.getDouble("right_price");
				double bonus = rs.getDouble("bonus");
				
				log.info("code:" + code + ", day:" + day);
				
//				//送股、分红
//				if (give != 0 || bonus !=0) {
//					sql = "update " + ed_table_name + " set open = open / " + String.valueOf(1 + give) + " - " + String.valueOf(bonus) +
//							", close = close / " + String.valueOf(1 + give) + " - " + String.valueOf(bonus) +
//							" where date < '" + date + "'"; 
//				}
//				//配股
//				else if (right != 0) {
//					sql = "update " + ed_table_name + " set open = (open + " + String.valueOf(right_price * right) + ") / " + String.valueOf(1 + right) +
//							", close = (close + " + String.valueOf(right_price * right) + ") / " + String.valueOf(1 + right) +
//							" where date < '" + date + "'"; 
//				}
				
				//除权价=(收盘价+配股比例×配股价-每股所派现金)÷(1+送股比例+配股比例)
				sql = "update " + stock_ed_table + " set open = (open + " + String.valueOf(right_price * right) + " - " + String.valueOf(bonus) + ") / " + String.valueOf(1 + give + right) +
						", close = (close + " + String.valueOf(right_price * right) + " - " + String.valueOf(bonus) + ") / " + String.valueOf(1 + give + right) +
						" where code = '" + code + "' and day < '" + day + "'"; 
				
				//log.info(sql);
				dbInst.updateSQL(sql);
			}
			rs.close();
		}
	}