获取SQLServer数据库中所有的用户存储过程,获取地址栏传递的参数,获取客户端真实ip地址,获取上G的文件行数的最快速的代码 获取输入数字组然后进行排序,不使用指针,获取网页上图片的下载地址,获取网站百度权重搜狗谷歌PR,获取真实IP,即便他使用代理,获取指定目录下的符合条件的文件,获取指定日期近31天的日期列表,基于C#的GPS坐标转换接口调用代码实例 [代码] MongoDB.h #ifndef _MONGO_H_ #define _MONGP_H_
#include
//python分析列表文件的内容是否支持JSON //python获取每个文件的名称和大小 class Cmongodb {
public:
Cmongodb(void); public:
void Init(string strip, int port, string tbname); bool ConnectServer(string & strerrmsg); bool IsFailedState();
bool QueryTarget(string strhash,string & strerrmsg); bool UpdateTime(string strhash,string & strerrmsg); bool QueryandSet(string strhash,string & strerrmsg);
bool QueryandInsertSet(string strhash,string & strerrmsg);
bool InsertTarget(string strhash,string & strerrmsg); void set_action_interval(int); private:
string m_strip; int m_port; string m_tbname;
int m_action_interval; DBClientConnection m_conn; };
//基于C#的航班动态接口调用代码实例 //基于C#的航班动态接口调用代码实例 Cmongodb::Cmongodb(void){
m_action_interval = 10; }
void Cmongodb::set_action_interval(int c){ printf(\
m_action_interval = c;
}
void Cmongodb::Init(string strip, int port, string tbname){ m_strip = strip; m_port = port; m_tbname = tbname; }
bool Cmongodb::ConnectServer(string & strerrmsg){
char szDest[128]={0};
sprintf(szDest,\ if (!m_conn.connect(szDest, strerrmsg)) { return false; }
return true; }
bool Cmongodb::IsFailedState(){
string str = m_conn.getServerAddress(); if(m_conn.getServerAddress().empty()) return true;
return m_conn.isFailed(); }
bool Cmongodb::QueryTarget(string strhash ,string & strerrmsg){
mongo::BSONObjBuilder query; try{
auto_ptr
catch(DBException &e ){
strerrmsg =e.what(); return true; }
return true; }
bool Cmongodb::QueryandInsertSet(string strhash ,string & strerrmsg){ mongo::BSONObjBuilder query; try{
auto_ptr
time_t now_t = time(NULL); long long now_ll = now_t; if(cursor->more()){
BSONObj p = cursor->next();
int count = p.getIntField(\ count ++;
m_conn.update(m_tbname,BSON(\BSON(\ if(count ==0)
return false; else
return true; }else{
m_conn.update(m_tbname,BSON(\BSON(\ }
return false; }
catch(DBException &e ){
strerrmsg =e.what(); return true; } }
bool Cmongodb::InsertTarget(string strhash,string & strerrmsg){
BSONObjBuilder query; try{
query <<\
m_conn.insert(m_tbname, query.obj()); }
catch(DBException &e ){
strerrmsg = e.what(); return false; }
return true; }
#endif
[代码] test.cpp
#include