This commit is contained in:
Andreas Österreicher
2009-07-15 11:58:09 +00:00
parent 380a0b8360
commit 23f8e3d842
3 changed files with 82 additions and 300 deletions
+4 -5
View File
@@ -26,17 +26,16 @@
header("Content-type: application/xhtml+xml");
require_once('../../../config/cis.config.inc.php');
require_once('../../../include/basis_db.class.php');
if (!$db = new basis_db())
die('Fehler beim Oeffnen der Datenbankverbindung');
require_once('../../config/cis.config.inc.php');
require_once('../../include/functions.inc.php');
require_once('../../include/frage.class.php');
require_once('../../include/vorschlag.class.php');
require_once('../../include/antwort.class.php');
require_once('../../include/gebiet.class.php');
if (!$db = new basis_db())
die('Fehler beim Oeffnen der Datenbankverbindung');
$PHP_SELF=$_SERVER["PHP_SELF"];
session_start();
+1 -1
View File
@@ -41,7 +41,7 @@ class antwort extends basis_db
{
parent::__construct();
if(!is_null(antwort_id))
if(!is_null($antwort_id))
$this->load($antwort_id);
}
+77 -294
View File
@@ -32,79 +32,27 @@ header('Cache-Control: no-store, no-cache, must-revalidate' );
header('Pragma: no-cache' );
header('Content-Type: text/html;charset=UTF-8');
#define("DB_NAME","-devvilesci");
require_once('../config/system.config.inc.php');
echo "<br>\nStart Host:".DB_HOST.' DB:'.DB_NAME .' line '. __LINE__ .' ; file ' . __FILE__."<br>\n";
flush();
error_reporting (E_ALL);
require_once('../include/basis_db.class.php');
//Hexcode in String umwandeln
function hexstr($hex)
{
$string='';
if (!$len=mb_strlen($hex,'UTF-8'))
return $string;
for ($i=0;$i<mb_strlen($hex,'UTF-8')-1;$i+=2)
$string.=chr(hexdec(mb_substr($hex,$i,1,'UTF-8').mb_substr($hex,$i+1,1,'UTF-8')));
return $string;
}
function convert($string)
{
if (!$len=mb_strlen($string,'UTF-8'))
return $string;
$ret=base64_encode(hexstr($string));
return $ret;
}
$next_row_counter=10;
echo "Records je Zeile $next_row_counter <br>\n";
flush();
$db = new basis_db();
if (!$db->db_query('BEGIN'))
die('Error:'.$db->db_last_error()."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
die('Error bei begin');
echo "tbl_akte...".date('Y-m-d H:i:s')."<br>\n";
flush();
//Akte
$qry = "SELECT akte_id, inhalt FROM public.tbl_akte where inhalt is not null and inhalt>''; \n";
if($result = $db->db_query($qry))
$qry = "UPDATE public.tbl_akte SET inhalt = encode(decode(inhalt, 'hex'),'base64')";
if(!$db->db_query($qry))
{
echo "<br>\nRecords...".$db->db_num_rows($result)."<br>\n";
flush();
$i=0;
while($row = $db->db_fetch_object($result))
{
$row->inhalt=convert($row->inhalt);
$qry = "UPDATE public.tbl_akte SET inhalt='".$row->inhalt."' WHERE akte_id='".addslashes($row->akte_id)."'; ";
$res=$db->db_query($qry);
if(!$rows=$db->db_affected_rows($res))
{
$err=$db->db_last_error();
$db->db_query('ROLLBACK');
die("Error :" .$err."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
}
if ($i>0 && !$i%$next_row_counter)
{
echo "<br>\n";
flush();
}
echo $row->akte_id.", ";
flush();
$i++;
}
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
#$db->db_free_result($result);
echo "<br>\ntbl_akte...".date('Y-m-d H:i:s')." ENDE ".$db->db_last_error()."<br>\n";
echo "<br>\ntbl_akte...".date('Y-m-d H:i:s')." ENDE<br>\n";
flush();
echo "<hr>\n";
@@ -112,116 +60,69 @@ echo "<hr>\n";
echo "tbl_person...".date('Y-m-d H:i:s')."<br>\n";
flush();
$qry = "SELECT foto, person_id FROM public.tbl_person WHERE foto is not null and foto>'' ; \n";
if($result = $db->db_query($qry))
$qry = "UPDATE public.tbl_person SET foto = encode(decode(foto, 'hex'),'base64') WHERE foto is not null";
if(!$db->db_query($qry))
{
echo "<br>\nRecords...".$db->db_num_rows($result)."<br>\n";
flush();
$i=0;
while($row = $db->db_fetch_object($result))
{
$row->foto=convert($row->foto);
$qry = "UPDATE public.tbl_person SET foto='".$row->foto."' WHERE person_id='".addslashes($row->person_id)."'; \n";
$res=$db->db_query($qry);
if(!$rows=$db->db_affected_rows($res))
{
$err=$db->db_last_error();
$db->db_query('ROLLBACK');
die("Error :" .$err."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
}
if ($i>0 && !$i%$next_row_counter)
{
echo "<br>\n";
flush();
}
echo $row->person_id.", ";
flush();
$i++;
}
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
#$db->db_free_result($result);
echo "<br>\ntbl_person...".date('Y-m-d H:i:s')." ENDE ".$db->db_last_error()."<br>\n";
flush();
echo "<hr>\n";
//Testtool - tbl_frage_sprache.bild
echo "tbl_frage_sprache bild...".date('Y-m-d H:i:s')."<br>\n";
flush();
$qry = "UPDATE testtool.tbl_frage_sprache SET bild = encode(decode(bild, 'hex'),'base64') WHERE bild is not null and bild<>''";
if(!$db->db_query($qry))
{
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
echo "<br>\ntbl_frage_sprache bild...".date('Y-m-d H:i:s')." ENDE<br>\n";
flush();
//Testtool - tbl_frage_sprache.bild
echo "tbl_frage_sprache bild+audio...".date('Y-m-d H:i:s')."<br>\n";
echo "tbl_frage_sprache audio...".date('Y-m-d H:i:s')."<br>\n";
flush();
$qry = "SELECT bild,audio, frage_id, sprache FROM testtool.tbl_frage_sprache WHERE (bild is not null and bild >'') or (audio is not null and audio >'') ; \n";
if($result = $db->db_query($qry))
$qry = "UPDATE testtool.tbl_frage_sprache SET audio = encode(decode(audio, 'hex'),'base64') WHERE audio is not null AND audio<>''";
if(!$db->db_query($qry))
{
echo "<br>\nRecords...".$db->db_num_rows($result)."<br>\n";
flush();
$i=0;
while($row = $db->db_fetch_object($result))
{
$row->bild=convert($row->bild);
$row->audio=convert($row->audio);
$qry = "UPDATE testtool.tbl_frage_sprache SET audio=".($row->audio?"'".$row->audio."'":'null')." ,bild=".($row->bild?"'".$row->bild."'":'null')." WHERE frage_id='".addslashes($row->frage_id)."' AND sprache='".addslashes($row->sprache)."'; \n";
$res=$db->db_query($qry);
if(!$rows=$db->db_affected_rows($res))
{
$err=$db->db_last_error();
$db->db_query('ROLLBACK');
die("Error :" .$err."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
}
if ($i>0 && !$i%$next_row_counter)
{
echo "<br>\n";
flush();
}
echo $row->frage_id.", ";
flush();
$i++;
}
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
#$db->db_free_result($result);
echo "<br>\ntbl_frage_sprache bild+audio...".date('Y-m-d H:i:s')." ENDE ".$db->db_last_error()."<br>\n";
echo "<br>\ntbl_frage_sprache audio...".date('Y-m-d H:i:s')." ENDE<br>\n";
flush();
echo "<hr>\n";
//Testtool - tbl_vorschlag_sprache.bild
echo "testtool.tbl_vorschlag_sprache bild+audio...".date('Y-m-d H:i:s')."<br>\n";
echo "testtool.tbl_vorschlag_sprache bild...".date('Y-m-d H:i:s')."<br>\n";
flush();
$qry = "SELECT bild,audio, vorschlag_id, sprache FROM testtool.tbl_vorschlag_sprache WHERE (bild is not null and bild>'') or (audio is not null and audio>'') ; \n";
# --->$qry = "SELECT bild, frage_id, sprache FROM testtool.tbl_vorschlag_sprache WHERE bild is not null and bild>''";
if($result = $db->db_query($qry))
$qry = "UPDATE testtool.tbl_vorschlag_sprache SET bild = encode(decode(bild, 'hex'),'base64') WHERE bild is not null AND bild<>''";
if(!$db->db_query($qry))
{
echo "<br>\nRecords...".$db->db_num_rows($result)."<br>\n";
flush();
$i=0;
while($row = $db->db_fetch_object($result))
{
$row->bild=convert($row->bild);
$row->audio=convert($row->audio);
$qry = "UPDATE testtool.tbl_vorschlag_sprache SET bild=".($row->bild?"'".$row->bild."'":'null').", audio=".($row->audio?"'".$row->audio."'":'null')." WHERE vorschlag_id='".addslashes($row->vorschlag_id)."' AND sprache='".addslashes($row->sprache)."'; \n";
$res=$db->db_query($qry);
if(!$rows=$db->db_affected_rows($res))
{
$err=$db->db_last_error();
$db->db_query('ROLLBACK');
die("Error :" .$err."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
}
if ($i>0 && !$i%$next_row_counter)
{
echo "<br>\n";
flush();
}
echo $row->vorschlag_id.", ";
flush();
$i++;
}
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
echo "<br>\ntesttool.tbl_vorschlag_sprache bild + audio...".date('Y-m-d H:i:s')." ENDE ".date('Y-m-d H:i:s')." ".$db->db_last_error()."<br>\n";
echo "<br>\ntesttool.tbl_vorschlag_sprache bild...".date('Y-m-d H:i:s')." ENDE <br>\n";
flush();
echo "<hr>\n";
//Testtool - tbl_vorschlag_sprache.audio
echo "testtool.tbl_vorschlag_sprache audio...".date('Y-m-d H:i:s')."<br>\n";
flush();
$qry = "UPDATE testtool.tbl_vorschlag_sprache SET audio = encode(decode(audio, 'hex'),'base64') WHERE audio is not null AND audio<>''";
if(!$db->db_query($qry))
{
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
echo "<br>\ntesttool.tbl_vorschlag_sprache audio...".date('Y-m-d H:i:s')." ENDE <br>\n";
flush();
echo "<hr>\n";
@@ -229,76 +130,28 @@ echo "<hr>\n";
//Kommune tbl_wettbewerb
echo "kommune.tbl_wettbewerb icon...".date('Y-m-d H:i:s')."<br>\n";
flush();
$qry = "SELECT icon, wettbewerb_kurzbz FROM kommune.tbl_wettbewerb WHERE icon is not null and icon>''; \n";
if($result = $db->db_query($qry))
$qry = "UPDATE kommune.tbl_wettbewerb SET icon = encode(decode(icon, 'hex'),'base64') WHERE icon is not null AND icon<>''";
if(!$db->db_query($qry))
{
echo "<br>\nRecords...".$db->db_num_rows($result)."<br>\n";
flush();
$i=0;
while($row = $db->db_fetch_object($result))
{
$row->icon=convert($row->icon);
$qry = "UPDATE kommune.tbl_wettbewerb SET icon='".$row->icon."' WHERE wettbewerb_kurzbz='".addslashes($row->wettbewerb_kurzbz)."'; \n";
$res=$db->db_query($qry);
if(!$rows=$db->db_affected_rows($res))
{
$err=$db->db_last_error();
$db->db_query('ROLLBACK');
die("Error :" .$err."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
}
if ($i>0 && !$i%$next_row_counter)
{
echo "<br>\n";
flush();
}
echo $row->wettbewerb_kurzbz.", ";
flush();
$i++;
}
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
#$db->db_free_result($result);
echo "<br>\nkommune.tbl_wettbewerb icon...".date('Y-m-d H:i:s')." ENDE ".date('Y-m-d H:i:s')." ".$db->db_last_error()."<br>\n";
echo "<br>\nkommune.tbl_wettbewerb icon...".date('Y-m-d H:i:s')." ENDE<br>\n";
flush();
echo "<hr>\n";
//Kommune tbl_team
echo "kommune.tbl_wettbewerb logo...".date('Y-m-d H:i:s')."<br>\n";
echo "kommune.tbl_team.logo...".date('Y-m-d H:i:s')."<br>\n";
flush();
$qry = "SELECT logo, team_kurzbz FROM kommune.tbl_team WHERE logo is not null and logo>''; \n";
if($result = $db->db_query($qry))
$qry = "UPDATE kommune.tbl_team SET logo = encode(decode(logo, 'hex'),'base64') WHERE logo is not null AND logo<>''";
if(!$db->db_query($qry))
{
echo "<br>\nRecords...".$db->db_num_rows($result)."<br>\n";
flush();
$i=0;
while($row = $db->db_fetch_object($result))
{
$row->logo=convert($row->logo);
$qry = "UPDATE kommune.tbl_team SET logo='".$row->logo."' WHERE team_kurzbz='".addslashes($row->team_kurzbz)."'";
$res=$db->db_query($qry);
if(!$rows=$db->db_affected_rows($res))
{
$err=$db->db_last_error();
$db->db_query('ROLLBACK');
die("Error :" .$err."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
}
if ($i>0 && !$i%$next_row_counter)
{
echo "<br>\n";
flush();
}
echo $row->team_kurzbz.", ";
flush();
$i++;
}
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
echo "<br>\nkommune.tbl_wettbewerb logo...".date('Y-m-d H:i:s')." ENDE ".$db->db_last_error()."<br>\n";
echo "<br>\nkommune.tbl_team logo...".date('Y-m-d H:i:s')." ENDE<br>\n";
flush();
echo "<hr>\n";
@@ -307,36 +160,13 @@ echo "<hr>\n";
echo "public.tbl_sprache flagge ...".date('Y-m-d H:i:s')."<br>\n";
flush();
$qry = "SELECT flagge, sprache FROM public.tbl_sprache WHERE flagge is not null and flagge>''; \n";
if($result = $db->db_query($qry))
$qry = "UPDATE public.tbl_sprache SET flagge = encode(decode(flagge, 'hex'),'base64') WHERE flagge is not null AND flagge<>''";
if(!$db->db_query($qry))
{
echo "<br>\nRecords...".$db->db_num_rows($result)."<br>\n";
flush();
$i=0;
while($row = $db->db_fetch_object($result))
{
$row->flagge=convert($row->flagge);
$qry = "UPDATE public.tbl_sprache SET flagge='".$row->flagge."' WHERE sprache='".addslashes($row->sprache)."'; \n";
$res=$db->db_query($qry);
if(!$rows=$db->db_affected_rows($res))
{
$err=$db->db_last_error();
$db->db_query('ROLLBACK');
die("Error :" .$err."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
}
if ($i>0 && !$i%$next_row_counter)
{
echo "<br>\n";
flush();
}
echo $row->sprache.", ";
flush();
$i++;
}
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
echo "<br>\npublic.tbl_sprache flagge...".date('Y-m-d H:i:s')." ENDE ".$db->db_last_error()."<br>\n";
echo "<br>\npublic.tbl_sprache flagge...".date('Y-m-d H:i:s')." ENDE<br>\n";
flush();
echo "<hr>\n";
@@ -345,69 +175,25 @@ echo "<hr>\n";
echo "public.tbl_erhalter logo ...".date('Y-m-d H:i:s')."<br>\n";
flush();
$qry = "SELECT logo, erhalter_kz FROM public.tbl_erhalter WHERE logo is not null and logo>''; \n";
if($result = $db->db_query($qry))
$qry = "UPDATE public.tbl_erhalter SET logo = encode(decode(logo, 'hex'),'base64') WHERE logo is not null AND logo<>''";
if(!$db->db_query($qry))
{
echo "<br>\nRecords...".$db->db_num_rows($result)."<br>\n";
flush();
$i=0;
while($row = $db->db_fetch_object($result))
{
$row->logo=convert($row->logo);
$qry = "UPDATE public.tbl_erhalter SET logo='".$row->logo."' WHERE erhalter_kz='".addslashes($row->erhalter_kz)."'";
$res=$db->db_query($qry);
if(!$rows=$db->db_affected_rows($res))
{
$err=$db->db_last_error();
$db->db_query('ROLLBACK');
die("Error :" .$err."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
}
if ($i>0 && !$i%$next_row_counter)
{
echo "<br>\n";
flush();
}
echo $row->erhalter_kz.", ";
flush();
$i++;
}
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
echo "<br>\npublic.tbl_erhalter logo...".date('Y-m-d H:i:s')." ENDE ".$db->db_last_error()."<br>\n";
echo "<br>\npublic.tbl_erhalter logo...".date('Y-m-d H:i:s')."<br>\n";
flush();
echo "<hr>\n";
$qry = "SELECT bild, veranstaltungskategorie_kurzbz FROM campus.tbl_veranstaltungskategorie WHERE bild is not null and bild>''; \n";
if($result = $db->db_query($qry))
$qry = "UPDATE campus.tbl_veranstaltungskategorie SET bild = encode(decode(bild, 'hex'),'base64') WHERE bild is not null AND bild<>''";
if(!$db->db_query($qry))
{
echo "<br>\nRecords...".$db->db_num_rows($result)."<br>\n";
flush();
$i=0;
while($row = $db->db_fetch_object($result))
{
$row->bild=convert($row->bild);
$qry = "UPDATE campus.tbl_veranstaltungskategorie SET bild='".$row->bild."' WHERE veranstaltungskategorie_kurzbz='".addslashes($row->veranstaltungskategorie_kurzbz)."'";
$res=$db->db_query($qry);
if(!$rows=$db->db_affected_rows($res))
{
$err=$db->db_last_error();
$db->db_query('ROLLBACK');
die("Error :" .$err."<br>\n".$qry."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__);
}
if ($i>0 && !$i%$next_row_counter)
{
echo "<br>\n";
flush();
}
echo $row->veranstaltungskategorie_kurzbz.", ";
flush();
$i++;
}
$db->db_query('ROLLBACK');
die('Fehler:'.$db->db_last_error());
}
echo "<br>\npublic.tbl_erhalter logo...".date('Y-m-d H:i:s')." ENDE ".$db->db_last_error()."<br>\n";
echo "<br>\ncampus.tbl_veranstaltungskategorie bild...".date('Y-m-d H:i:s')." ENDE<br>\n";
flush();
echo "<hr>\n";
@@ -415,8 +201,5 @@ echo "<hr>\n";
if(!$db->db_query('COMMIT'))
echo "<br>\n".date('Y-m-d H:i:s')." ERROR :".$db->db_last_error()."<br>\n".' line '. __LINE__ .' ; file ' . __FILE__;
else
echo "<br>\n<b>Aktualisierung abgeschlossen ".date('Y-m-d H:i:s')."</b>";
#$db->db_query('ROLLBACK');
echo "<br>\n<b>Aktualisierung abgeschlossen ".date('Y-m-d H:i:s')."</b>";
?>