廢話不多說,直接開幹!
import win.ui;
import string;
import inet.whttp;
import console;
import fsys.file;
import fsys.dlg;
import thread.works
import io;
import com;
import com.excel;
import console;
import mysql.client;
//多執行緒管理器
import thread.manage
var csv="關鍵詞,數量,第一評論,第二評論,第三評論"+'\r\n'
//建立執行緒管理器
manage = thread.manage(3)
//console.log("正在連線資料庫伺服器...");
thread.invoke( function()
while(! thread.get("db4free.net:end")){
io.stdout.write(">");sleep(100);
}
)
var dbMysql,err = mysql.client(
server = "127.0.0.1"; //資料庫伺服器,可省略預設為localhost
uid = "root";//使用者名稱,可省略預設為root
pwd = "KnBf3a9k";
);
thread.set("db4free.net:end",true)
//console.clearScreen ();
if(!dbMysql){
console.log("連線資料庫失敗",err);
console.pause();
return;
}
//選擇資料庫
dbMysql.selectDb("marking")
var result = dbMysql.query("SELECT level1 FROM `cmf_role1` where 1 group by level1 ");
for level1 in result.each(){
console.log(level1)
}