Initial commit

This commit is contained in:
2026-09-03 11:24:19 +02:00
commit 6ed3153f36
1897 changed files with 538007 additions and 0 deletions
+114
View File
@@ -0,0 +1,114 @@
<?php
$db_connection = array(
'host' => 'localhost',
'username' => 'root',
'password' => 'Mikronika123',
'db_name' => 'softspm',
);
$db_connection_ext = array(
'host' => '172.21.11.101',
'username' => 'slave_user',
'password' => 'slave_user',
'db_name' => 'softspm',
);
// funkcja zwraca zaytanie SQL do tablicy
// ========================================================== //
function sqlGetResAsArray($query)
{
$res=null;
$res = array();
if(!$results = mysql_query($query)){
echo mysql_error();
return false;
}
for($i=0; $row=mysql_fetch_assoc($results); $i++)
$res[$i]=$row;
return $res;
}
// ========================================================== //
function getFloatValue($inParam)
{
unset($outParam);
if (!empty($inParam) || strlen($inParam)>0)
{
$inParam = str_replace(array('\'', '\"'), array('', ''), $inParam);
$inParam = (float)str_replace(',', '.', $inParam);
$outParam = round($inParam, 2);
}
else
$outParam = null;
return $outParam;
}
// ==================================================================================================================== //
// ==================================================================================================================== //
$loc = mysql_connect($db_connection['host'], $db_connection['username'], $db_connection['password']) or die ('cannot connect to db');
mysql_select_db($db_connection['db_name']);
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER_SET utf8_general_ci");
unset($maxRHD_ID);
$maxRHD_ID = sqlGetResAsArray("select max(DRD_ID) DRD_ID from seg_dev_resources_det");
echo $maxRHD_ID[0]['RHD_ID'];
echo'<br/>';
mysql_close($loc);
// ==================================================================================================================== //
// naza zewnętrzna
// ==================================================================================================================== //
$ext = mysql_connect($db_connection_ext['host'], $db_connection_ext['username'], $db_connection_ext['password']) or die ('cannot connect to db');
mysql_select_db($db_connection_ext['db_name']);
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER_SET utf8_general_ci");
unset($ext_seg_dev_resources_det);
$ext_seg_dev_resources_det = sqlGetResAsArray("select * from seg_dev_resources_det where DRD_ID>".$maxRHD_ID[0]['DRD_ID']." limit 5000");
mysql_close($ext);
// ==================================================================================================================== //
// ==================================================================================================================== //
$loc = mysql_connect($db_connection['host'], $db_connection['username'], $db_connection['password']) or die ('cannot connect to db');
mysql_select_db($db_connection['db_name']);
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER_SET utf8_general_ci");
for($i=0; $i<count($ext_seg_dev_resources_det); $i++)
{
//INSERT INTO seg_dev_resources_det SET DRD_ID=1,DRD_DRS_ID=1,DRD_RESOURCES_DETAIL=1,DRD_VALUE='1',DRD_DESCRIPTION='1',DRD_EXPORT_SEGAP='1',DRD_AUDIT_USR='1',DRD_AUDIT_DATE='2010-01-01';
unset($query);
$query = "INSERT INTO seg_dev_resources_det SET DRD_ID=".$ext_seg_dev_resources_det[$i]['DRD_ID'].",DRD_DRS_ID=".$ext_seg_dev_resources_det[$i]['DRD_DRS_ID'];
if (strlen($ext_seg_dev_resources_det[$i]['DRD_RESOURCES_DETAIL']>0)) $query .= ",DRD_RESOURCES_DETAIL='".$ext_seg_dev_resources_det[$i]['DRD_RESOURCES_DETAIL']."'";
if (strlen($ext_seg_dev_resources_det[$i]['DRD_VALUE']>0)) $query .= ",DRD_VALUE='".$ext_seg_dev_resources_det[$i]['DRD_VALUE']."'";
if (strlen($ext_seg_dev_resources_det[$i]['DRD_DESCRIPTION']>0)) $query .= ",DRD_DESCRIPTION='".$ext_seg_dev_resources_det[$i]['DRD_DESCRIPTION']."'";
if (strlen($ext_seg_dev_resources_det[$i]['DRD_EXPORT_SEGAP']>0)) $query .= ",DRD_EXPORT_SEGAP='".$ext_seg_dev_resources_det[$i]['DRD_EXPORT_SEGAP']."'";
if (strlen($ext_seg_dev_resources_det[$i]['DRD_AUDIT_USR']>0)) $query .= ",DRD_AUDIT_USR='".$ext_seg_dev_resources_det[$i]['DRD_AUDIT_USR']."'";
if (strlen($ext_seg_dev_resources_det[$i]['DRD_AUDIT_DATE']>0)) $query .= ",DRD_AUDIT_DATE='".$ext_seg_dev_resources_det[$i]['DRD_AUDIT_DATE']."'";
echo $query;
mysql_query($query);
echo'<br/>';
}
mysql_close($loc);
// ==================================================================================================================== //
?>