2015-01-07 01:26:14 +08:00
|
|
|
/*
|
|
|
|
* SQLiteBaseInfoDriver.h
|
|
|
|
*
|
|
|
|
* Created on: 2012-8-14
|
|
|
|
* Author: fasiondog
|
|
|
|
*/
|
|
|
|
|
2019-08-03 21:53:24 +08:00
|
|
|
#pragma once
|
2015-01-07 01:26:14 +08:00
|
|
|
#ifndef SQLITEBASEINFODRIVER_H_
|
|
|
|
#define SQLITEBASEINFODRIVER_H_
|
|
|
|
|
2018-08-19 16:51:10 +08:00
|
|
|
#include <sqlite3.h>
|
2016-04-03 00:08:31 +08:00
|
|
|
#include "../../../Log.h"
|
|
|
|
#include "../../BaseInfoDriver.h"
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
namespace hku {
|
|
|
|
|
|
|
|
class SQLiteBaseInfoDriver: public BaseInfoDriver {
|
|
|
|
public:
|
2017-10-09 02:25:02 +08:00
|
|
|
SQLiteBaseInfoDriver(): BaseInfoDriver("sqlite3") {}
|
2015-01-07 01:26:14 +08:00
|
|
|
virtual ~SQLiteBaseInfoDriver() { }
|
|
|
|
|
2017-10-09 02:25:02 +08:00
|
|
|
virtual bool _init();
|
|
|
|
virtual bool _loadMarketInfo();
|
|
|
|
virtual bool _loadStockTypeInfo();
|
|
|
|
virtual bool _loadStock();
|
2015-01-07 01:26:14 +08:00
|
|
|
|
2019-04-07 22:55:47 +08:00
|
|
|
virtual Parameter getFinanceInfo(const string& market, const string& code);
|
|
|
|
|
2015-01-07 01:26:14 +08:00
|
|
|
private:
|
2019-08-09 01:40:24 +08:00
|
|
|
bool _getStockWeightList(uint32, StockWeightList&);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
static int _getMarketTableCallBack(void *out, int nCol,
|
2019-04-07 22:55:47 +08:00
|
|
|
char **azVals, char **azCols);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
static int _getStockTypeInfoTableCallBack(void *out, int nCol,
|
2019-04-07 22:55:47 +08:00
|
|
|
char **azVals, char **azCols);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
static int _getStockWeightCallBack(void *out, int nCol,
|
2019-04-07 22:55:47 +08:00
|
|
|
char **azVals, char **azCols);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
static int _getStockTableCallBack(void *out, int nCol,
|
2019-04-07 22:55:47 +08:00
|
|
|
char **azVals, char **azCols);
|
|
|
|
|
|
|
|
static int _getFinanceTableCallBack(void *out, int nCol,
|
|
|
|
char **azVals, char **azCols);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
//股票基本信息数据库实例
|
|
|
|
shared_ptr<sqlite3> m_db;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace hku */
|
|
|
|
#endif /* SQLITEBASEINFODRIVER_H_ */
|