gehe zur Dokumentation dieser Datei
2 include_once(
'../adodb.inc.php');
3 include_once(
'adodb-replicate.inc.php');
9 if (strlen($idxname) > 28) $idxname = substr($idxname,0,24).rand(1000,9999);
20 return "nvl($fld, $val)";
26 $uf = strtoupper($fld);
35 if ($mode ==
'SELECT') $fld =
'"Group"';
38 if ($mode ==
'SELECT') $fld =
'"Size"';
46 $table = trim($table);
47 if (strlen($table) == 0)
return false;
48 if (strpos($table,
'#') !==
false) {
49 $at = strpos($table,
'#');
50 $table = trim(substr($table,0,$at));
51 if (strlen($table) == 0)
return false;
54 $tabarr = explode(
',',$table);
55 if (
sizeof($tabarr) == 1) {
58 echo
"No primary key for $table **** **** <br>";
60 $table = trim($tabarr[0]);
61 $pkey = trim($tabarr[1]);
62 if (strpos($pkey,
' ') !==
false) echo
"Bad PKEY for $table $pkey<br>";
74 if (empty($TARR)) $TARR = array();
75 $cnt =
$rep->connSrc->GetOne(
"select count(*) from $table");
76 if (isset($TARR[$table])) echo
"<h1>Table $table repeated twice</h1>";
80 $ok =
$rep->connSrc->SelectLimit(
"select $pkey from $table",1);
81 if (!
$ok) echo
"<h1>$table: $pkey does not exist</h1>";
83 echo
"<h1>$table: no primary key</h1>";
89 #$DB2->Execute("drop table $table");
92 $ok =
$rep->CopyTableStruct($table);
93 if (
$ok) echo
"Table Created<br>\n";
95 echo
"<hr>Error: Cannot Create Table<hr>\n";
104 $rep->execute =
true;
105 $rep->deleteFirst =
true;
108 $rows =
$rep->ReplicateData($table,$dtable,array($pkey));
109 $secs = time() - $secs;
110 if (!$rows || !$rows[0] || !$rows[1] || $rows[1] != $rows[2]+$rows[3]) {
111 echo
"<hr>Error: "; var_dump($rows); echo
" (secs=$secs) <hr>\n";
113 echo
date(
'H:i:s'),
': ',$rows[1],
" record(s) copied, ",$rows[2],
" inserted, ",$rows[3],
" updated (secs=$secs)<br>\n";
122 $rep->oracleSequence =
'LGBSEQUENCE';
124 # $rep->MergeSrcSetup($table, array($pkey),'UpdatedOn','CopiedFlag');
125 if (strpos(
$rep->connDest->databaseType,
'mssql') !==
false) { # oracle ==> mssql
126 $ignoreflds = array($pkey);
127 $ignoreflds[] =
'MSSQL_ID';
128 $set =
'MSSQL_ID=nvl($INSERT_ID,MSSQL_ID)';
129 $pkeyarr = array(array($pkey),
false,array(
'MSSQL_ID'));# array(
'MSSQL_ID',
'ORA_ID'));
130 }
else { # mssql ==> oracle
131 $ignoreflds = array($pkey);
132 $ignoreflds[] =
'ORA_ID';
134 #$set = 'ORA_ID=isnull($INSERT_ID,ORA_ID)';
135 $pkeyarr = array(array($pkey),array(
'MSSQL_ID'));
137 $rep->execute =
true;
138 #$rep->updateFirst = false;
139 $ok =
$rep->Merge($table, $dtable, $pkeyarr, $ignoreflds, $set,
'UpdatedOn',
'CopiedFlag',array(
'Y',
'N',
'P',
'='),
'CopyDate');
142 #$rep->connSrc->Execute("update JohnTest set name='Apple' where id=4");
145 $DB = ADONewConnection(
'odbtp');
146 #$ok = $DB->Connect('localhost','root','','northwind');
147 $ok =
$DB->Connect(
'192.168.0.1',
'DRIVER={SQL Server};SERVER=(local);UID=sa;PWD=natsoft;DATABASE=OIR;',
'',
'');
148 $DB->_bindInputArray =
false;
150 $DB2 = ADONewConnection(
'oci8');
151 $ok2 =
$DB2->Connect(
'192.168.0.2',
'tnb',
'natsoft',
'RAPTOR',
'');
153 if (!
$ok || !
$ok2) die(
"Failed connection DB=$ok DB2=$ok2<br>");
160 # net* are ERMS, need last updated field from LGBnet
161 # tblRep* are tables insert or update from Juris, need last updated field also
162 # The rest are lookup tables, can copy all from LGBnet
167 # Lookup table for Restoration Details screen
168 sysefi,ID # (not identity)
169 sysgenkva,ID #(not identity)
170 sysrestoredby,ID #(not identity)
171 # Sel* table added on 24 Oct
175 SelArchingHornSize,ID
178 SelBatteryType,ID #(not identity)
179 SelBreakerCapacity,ID
180 SelBreakerType,ID #(not identity)
182 SelCTRatio,ID #(not identity)
185 SelCableSizeLV,ID # (not identity)
189 SelCombineSealingChamberSize,ID
192 SelConductorSizeLV,ID
193 SelConductorSizeMV,ID
198 SelDeadEndClampBrand,ID
199 SelDeadEndClampSize,ID
213 SelJunctionBoxBrand,ID
218 SelLightningArresterBrand,ID
219 SelLightningShieldwireSize,ID
223 SelMidSpanConnectorsSize,ID
224 SelMidSpanJointSize,ID
230 SelPoleConcreteSize,ID
232 SelPoleSpunConcreteSize,ID
236 SelPorcelainFuseSize,ID
237 SelRatedFaultCurrentBreaker,ID
238 SelRatedVoltageSG,ID #(not identity)
239 SelRelayType,ID # (not identity)
240 SelResistanceValue,ID
241 SelSGEquipmentType,ID # (not identity)
242 SelSGInsulationType,ID # (not identity)
244 SelStayInsulatorSize,ID
245 SelSuspensionClampBrand,ID
246 SelSuspensionClampSize,ID
249 SelTransformerCapacity,ID
250 SelTransformerManuf,ID
251 SelTransformerType,ID #(not identity)
252 SelTypeOfArchingHorn,ID
253 SelTypeOfCable,ID #(not identity)
254 SelTypeOfConductor,ID # (not identity)
255 SelTypeOfInsulationCB,ID # (not identity)
256 SelTypeOfMidSpanJoint,ID
259 SelUGVoltage,ID # (not identity)
265 # Net* tables added on 24 Oct
267 NetBatteryBank,Idx # identity, FunctLocation Pri
270 NetCable,Idx # identity, FunctLocation Pri
271 NetCapacitorBank,Idx # identity, FunctLocation Pri
272 NetCircuitBreaker,Idx # identity, FunctLocation Pri
273 NetCombineSealingChamber,Idx
280 NetFaultIndicator,Idx
281 NetFeederPillar,Idx # identity, FunctLocation Pri
282 NetGenCable,Idx # identity , FunctLocation Not Null
285 NetHVOverhead,Idx #identity, FunctLocation Pri
286 NetHVUnderground,Idx #identity, FunctLocation Pri
292 NetLVDB,Idx #identity, FunctLocation Pri
294 NetLVUnderground,Idx # identity, FunctLocation Not Null
295 NetLightningArrester,Idx
297 NetMidSpanConnectors,Idx
299 NetNER,Idx # identity , FunctLocation Pri
301 NetOtherComponent,Idx
303 NetRMU,Idx # identity, FunctLocation Pri
306 NetSuspensionClamp,Idx
307 NetSwitchGear,Idx # identity, FunctLocation Pri
315 netRelay,Idx # identity, FunctLocation Pri
318 sysRestoration,ID_SRE
319 sysRepairMethod,ID_SRM # (not identity)
321 sysInterruptionType,ID_SIN
322 netTransformer,Idx # identity, FunctLocation Pri
326 sysCodecibs #-- no idea, UpdatedOn(the only column is unique),Ermscode,Cibscode is unique but got null value
330 sysAddress #-- no idea, ID_SAD(might be auto gen No)
334 sysFailureCause,ID_SFC
335 sysFailureMode,ID_SFM
336 SysSchOutageMode,ID_SSM
338 SysInstallation,ID_SI
339 SysInstallationCat,ID_SIC
340 SysInstallationType,ID_SIT
341 SysFaultCategory,ID_SF #(not identity)
343 SysProtectionOperation,ID_SPO #(not identity)
344 netCodename,CodeNo #(not identity)
345 netSubstation,Idx #identity, FunctLocation Pri
346 netLvFeeder,Idx # identity, FunctLocation Pri
350 tblRepRestoration,ID_RR
351 tblRepResdetail,ID_RRD
352 tblRepFailureMode,ID_RFM
353 tblRepFailureCause,ID_RFC
354 tblRepRepairMethod,ReportNo # (not identity)
355 tblInterruptionType,ID_TIN
356 tblProtType,ID_PT #--capital letter
357 tblRepProtection,ID_RP
358 tblRepComponent,ID_RC
360 tblRepEnvironment,ID_RE
361 tblRepSubstation,ID_RSS
362 tblInstallationType,ID_TIT
363 tblInstallationCat,ID_TIC
364 tblFailureCause,ID_TFC
365 tblFailureMode,ID_TFM
368 tblProtdetail,Id # (Id)--capital letter for I
369 tblInstallation,ID_TI
377 $rep->fieldFilter =
'FieldFilter';
379 $rep->indexFilter =
'IndexFilter';
390 foreach(
$tables as $k => $table) {
394 #######################
397 echo
"<h1>($kcnt/$cnt) $table -- $pkey</h1>\n";
421 echo
"<hr>",
date(
'H:i:s'),
": Done</hr>";
Sie sind hier: Home » MyOOS Benutzerhandbuch » ADOdb
Korrekturen, Hinweise und Ergänzungen
Bitte scheuen Sie sich nicht und melden Sie, was auf dieser Seite sachlich falsch oder irreführend ist, was ergänzt werden sollte, was fehlt usw. Dazu bitte oben aus dem Menü Seite den Eintrag
Support Forum wählen. Es ist eine kostenlose Anmeldung erforderlich, um Anmerkungen zu posten. Unpassende Postings, Spam usw. werden kommentarlos entfernt.