⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stockdb.java

📁 股票信息采集源码
💻 JAVA
字号:
/**
 * 
 */
package cn.com.lucre.stock.db;

import java.sql.SQLException;
import java.util.LinkedList;
import java.util.Vector;

import cn.com.lucre.db.use.DbObject;

/**
 * @author candy
 * 
 */
public class StockDB extends DbObject {

	/**
	 * @param args
	 */
	public Vector[] getStockCode() {
		Vector[] temp = new Vector[3];
		temp[0] = new Vector();
		temp[1] = new Vector();
		temp[2] = new Vector();
		String sql = "select * from s_code";
		LinkedList ll = new LinkedList();
		ll = this.getData(sql);
		if (ll != null) {
			if (ll.size() > 0) {
				String[] rs = null;
				for (int i = 0; i < ll.size(); i++) {
					rs = (String[]) ll.get(i);
					temp[0].addElement(rs[0]);
					temp[1].addElement(rs[1]);
					temp[2].addElement(rs[2]);
				}
			} else {
				temp[0] = null;
				temp[1] = null;
			}
		} else {
			temp[0] = null;
			temp[1] = null;
		}
		return temp;
	}

	public void addStockMeg(String c_id, String price, String date,
			String time, String fluctuate, String open_quotation,
			String max_price, String min_price, String quantity) {
		this.useAffair(true);
		if (this.getCount("s_info", "d_date='"+date+"' and d_time='"+time+"' and s_id='"+c_id+"'") == 0) {
			String sql = "insert into s_info(s_id,price,d_date,d_time,change,open_price,high_price,low_price,quantity) values('"
					+ c_id
					+ "',"
					+ price
					+ ",'"
					+ date
					+ "','"
					+ time
					+ "',"
					+ fluctuate
					+ ","
					+ open_quotation
					+ ","
					+ max_price
					+ "," + min_price + "," + quantity + ")";
			this.doInsert(sql);
		}
		try {
			this.tocommit();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		this.useAffair(false);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}

⌨️ 快捷键说明

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