#include
#include
#include "seetime.h"
#include "writeoff_inc.h"
/*db_user_fee_detail db_user_fee_detail;
connection* amsconn;
char sql[1024];
ind_user_fee_detail_by_insprodid ind_user_fee_detail_by_insprodid;
long inituserinfo()
g_clogfile.info(0, "裝載使用者資料成功,共計[%d]條", db_user_fee_detail.getnodenumber());
// crecords c_record(*amsconn, 1);
// c_record.query(sql);
// for (int i = 0; i < 10; i++)
//
return j;
}long outputfeedetail()
plistuserfeedetail->next();
if (!plistuserfeedetail->position())
if (!plistuserfeedetail->position())
if (j >= 0)
else}}
return j;
}int main()
dbfactory.initial();
dbfactory.getconnection("ams", "1", amsconn);
db_user_fee_detail.setbatchsize(max_batch_size);
db_user_fee_detail.addindex(&ind_user_fee_detail_by_insprodid);
inituserinfo();
// outputfeedetail();
stru_user_fee_detail* stru;
ind_user_fee_detail_by_insprodid.query(3804338, stru);
cout << stru->product_instance_id << endl;
cout << stru->opt_date << endl;
crecords record(*amsconn, 1);
char str[256];
strcpy(str, "select * from student");
j = record.query(str);
while (j > 0)
dbfactory.freeconnection(amsconn);
logout();
cout << gettime() << endl;
return 0;
}*//*
//錶類的應用
int main()
connection* amsconn = null;
dbfactory.initial();
dbfactory.getconnection("ams", "1", amsconn);
// crecords crecord(*amsconn, 1);
//// char sql[256];
// sprintf(sql, "insert into cc values('1','123','20081010121222')");
// j = crecord.query(sql);
// if (j <= 0)
//
//// amsconn->commit();
t_sms_cur_balance table_a(*amsconn, 1);
table_a.settablename("cc");
table_a.acct_id = 1;
table_a.balance = 23;
table_a.opt_date = "2008091012";
j = table_a.insert();
if (j <= 0)
amsconn->commit();
logout();
return 0;
}*/int main()
connection* amsconn = null;
dbfactory.initial();
j = dbfactory.getconnection("ams", "1", amsconn);
if (j <= 0)
t_acct_balance table_a(*amsconn, 1);
table_a.settablename("cc");
cfilereader cread("f://test.txt", ",", " " );
j = cread.open();
int i = 0;
while (j > 0)
j = amsconn->commit();
if (j <= 0)
cout << "ok"
<< endl;
cout << i << endl;
cread.close();
dbfactory.freeconnection(amsconn);
cout << gettime() << endl;
return 0;
}使用sqlldr 是個不錯的方法
匯入csv檔案到資料庫
csv 逗號分隔值 comma separated values,csv,有時也稱為字元分隔值,因為分隔字元也可以不是逗號 其檔案以純文字形式儲存 資料 數字和文字 純文字意味著該檔案是乙個字串行,不含必須像二進位制數字那樣被解讀的資料。csv檔案由任意數目的記錄組成,記錄間以某種換行符分隔 每條記...
匯入 csv檔案到mysql資料庫
首先通過如下命令獲取到mysql的secure file priv的值 show variables like secure secure file priv 的值是在對mysql匯入匯出csv檔案時的路徑,mysql的檔案只能匯入匯出到此路徑,我的的mysql資料庫的 secure file pr...
mysqlimport 匯入檔案到資料庫命令
mysqlimport h 172.16.145.125 u ocetl pocetl test fields terminated by home ocetl tmp user info.txt columns user id,user name,user age,user addr local ...