存档

文章标签 ‘push’

以前写过一篇PushWeb 采集站点信息发布的最佳方案(http://www.miaoqiyuan.cn/p/pushweb),用了很久,现在数据量大了,导入速度很慢(主要原因是导入一条记录,自动修复一次数据),在此,我修改了一下代码,暂且算是升级到1.01吧:

‘pushWeb 1.01

‘刷新时间
const pushWeb_flush_Time=600000
‘数据库路径
const pushWeb_dbPath="D:\WebDesign\Products\pushWeb\DB\PushWebDB.mdb"

function pushWeb()
on error resume next
dim conn,rs,push_id,push_webid,push_sql
dim web_db,web_name
dim push_Arr,push_str

set conn=createobject("ADODB.connection")
conn.open "provider=microsoft.jet.oledb.4.0;data source="&pushWeb_dbPath
set rs=conn.execute("select push_webid from push")
if rs.eof then
push_id=0
wscript.echo "没有更新,"&pushWeb_flush_Time/1000&"秒后再检查…"
else
push_webid=rs(0)
end if
rs.close
set rs=nothing

if push_webid<>0 then
‘载入站点信息
set rs=conn.execute("select web_name,web_db from web where web_id="&push_webid)
if not rs.eof then
web_name=rs(0)
web_db=rs(1)
else
wscript.echo "错误的任务请求,"&pushWeb_flush_Time/1000&"秒后再检查…"
exit function
end if
rs.close
set rs=nothing

‘如果是合法的站点
if web_db<>"" and web_name<>"" then
wscript.echo "找到一个任务[站点名="&web_name&"],导入中…"
‘创建新的连接对象
set newConn=CreateObject("ADODB.Connection")
newConn.open web_db

set rs=conn.execute("select push_sql from push where push_webid="&push_webid)

do while not rs.eof
push_sql=rs(0)
push_Arr=split(push_sql,vbCrlf)
for [...]

四 16th, 2010 | Filed under VB程序
标签: ,