<?php
/*
辩论帖子表：pre_forum_debatepost
*/
if($start <= 1){
	truncatetable('forum_debatepost');
}

$maxcount = $xc->db['source']->result($xc->db['source']->query("SELECT COUNT(*) FROM {$source_tablepre}debatedata"), 0);
if($start < $maxcount){
	$converted = 1;
}

$query = $xc->db['source']->query("SELECT * FROM {$source_tablepre}debatedata limit $start,$end") or dexit();
while ($debatedata = $xc->db['source']->fetch_array($query)) {
	$debatedata		=	daddslashes($debatedata);
	if($debatedata['pid'] == '0') continue;
	
	//pre_forum_debatepost
	$pid		=	$debatedata['pid'];
	$stand		=	$debatedata['standpoint'];
	$tid		=	$debatedata['tid'];
	$uid		=	$debatedata['authorid'];
	$dateline	=	$debatedata['postdate'];
	$voters		=	$debatedata['voters'];
	$voterids	=	$debatedata['voteids'];

	$field1	=	array('pid','stand','tid','uid','dateline','voters','voterids');
	$query1	=	getinsertsql("{$discuz_tablepre}forum_debatepost", $field1);

	if ($xc->db['discuz']->query($query1)) {
		$convertedrows ++;
	} else {
		reportlog("无法转换辩论 tid = $tid pid=$pid，SQL 语句如下 ：<br><textarea rows=\"3\" style=\"width: 100%;\">".$query1."</textarea>");
	}
	$converted = 1;
	$totalrows ++;
}
?>