Esempio n. 1
0
function Users_INSERT($ins)
{
    $query = 'INSERT INTO "Users"';
    $query .= genInsert($ins);
    $result = PQuery($query);
    return $result;
}
Esempio n. 2
0
function OpticalFiberJoin_INSERT($ins)
{
    $query = 'INSERT INTO "OpticalFiberJoin"';
    $query .= genInsert($ins);
    $result = PQuery($query);
    loggingIs(2, 'OpticalFiberJoin', $ins, '');
    return $result;
}
Esempio n. 3
0
function NetworkBoxType_INSERT($ins)
{
    $query = 'INSERT INTO "NetworkBoxType"';
    $query .= genInsert($ins);
    $result = PQuery($query);
    loggingIs(2, 'NetworkBoxType', $ins, '');
    return $result;
}
Esempio n. 4
0
function FSOT_INSERT($ins)
{
    $query = 'INSERT INTO "FiberSpliceOrganizerType"';
    $query .= genInsert($ins);
    $result = PQuery($query);
    loggingIs(2, 'FiberSpliceOrganizerType', $ins, '');
    return $result;
}
Esempio n. 5
0
function OpticalFiberSplice_INSERT($ins)
{
    if (isset($ins['attenuation'])) {
        $attenuation = str_replace(',', '.', $ins['attenuation']);
        if (is_numeric($attenuation)) {
            $ins['attenuation'] = floatval($attenuation) * 100;
        } else {
            $ins['attenuation'] = 'NULL';
        }
    }
    $query = 'INSERT INTO "OpticalFiberSplice"';
    $query .= genInsert($ins);
    $query .= ' RETURNING id';
    $result = PQuery($query);
    loggingIs(2, 'OpticalFiberSplice', $ins, '');
    return $result;
}
Esempio n. 6
0
function divCableLine1($coors, $CableLineId, $nodeInfo, $tmpT = FALSE)
{
    $OpenGIS = "(" . $coors[0]->lon . "," . $coors[0]->lat . ")";
    $wr['id'] = $CableLineId;
    $res = CableLine_SELECT(0, $wr, $tmpT);
    $CableLine = $res['rows'][0];
    unset($wr);
    $wr['CableLine'] = $CableLineId;
    $query = 'SELECT * FROM "' . tmpTable('CableLinePoint', $tmpT) . '"' . genWhere($wr) . 'ORDER BY "sequence"';
    $res2 = PQuery($query);
    $CableLinePoints = $res2['rows'];
    for ($i = 0; $i < count($CableLinePoints); $i++) {
        $point = $CableLinePoints[$i];
        if ($point['OpenGIS'] == $OpenGIS) {
            $name = $nodeInfo['name'];
            $NetworkBoxId = $nodeInfo['NetworkBoxId'];
            $note = $nodeInfo['note'];
            $SettlementGeoSpatial = "NULL";
            $building = $nodeInfo['building'];
            $apartment = $nodeInfo['apartment'];
            $res3 = NetworkNode_Add($name, $NetworkBoxId, $note, $OpenGIS, $SettlementGeoSpatial, $building, $apartment, $tmpT);
            $NetworkNodeId = $res3['rows'][0]['id'];
            $seq = $point['sequence'];
            $wr['sequence'] = $seq;
            $upd['OpenGIS'] = "NULL";
            $upd['NetworkNode'] = $NetworkNodeId;
            CableLinePoint_UPDATE($upd, $wr, $tmpT);
            $wr1 = array('sequence' => array('val' => $seq, 'sign' => '>'));
            error_log(genWhere($wr1));
            $ins = array();
            $ins['CableType'] = $CableLine['CableType'];
            $ins['name'] = $CableLine['name'] . "_div";
            $ins['comment'] = $CableLine['comment'];
            $query = 'INSERT INTO "' . tmpTable('CableLine', $tmpT) . '"' . genInsert($ins) . ' RETURNING id';
            error_log($query);
            $res4 = PQuery($query);
            $NCableLineId = $res4['rows'][0]['id'];
            $ins = array();
            foreach ($point as $key => $value) {
                if ($key != "id" && $key != "sequence") {
                    if ($value != "") {
                        $ins[$key] = $value;
                    } else {
                        $ins[$key] = "NULL";
                    }
                }
            }
            $ins['CableLine'] = $NCableLineId;
            $ins['sequence'] = 1;
            $ins['OpenGIS'] = 'NULL';
            $ins['NetworkNode'] = $NetworkNodeId;
            $query = 'INSERT INTO "' . tmpTable('CableLinePoint', $tmpT) . '"' . genInsert($ins);
            error_log($query);
            PQuery($query);
            $query = 'UPDATE "' . tmpTable('CableLinePoint', $tmpT) . '" SET "CableLine" = ' . $NCableLineId . ', sequence = sequence + 1 - ' . $seq . ' WHERE "sequence" > ' . $seq . ' AND "CableLine" = ' . $CableLineId;
            error_log($query);
            PQuery($query);
            break;
        }
    }
}
Esempio n. 7
0
<?php

require_once 'backend/CableType.php';
print '<meta charset="UTF-8">';
if (isset($_GET['CableLine']) && ctype_digit($_GET['CableLine'])) {
    $CableLine = $_GET['CableLine'];
    $wr['id'] = $CableLine;
    $cl = CableLine_SELECT(-1, $wr);
    $CableType = $cl['rows'][0]['CableType'];
    $wr['id'] = $CableType;
    $ct = CableType_SELECT(-1, $wr);
    $fibersCount = $ct['rows'][0]['tubeQuantity'] * $ct['rows'][0]['fiberPerTube'];
    for ($i = 1; $i <= $fibersCount; $i++) {
        print "Добавляем волокно #" . $i . "...<br/>";
        $ins['CableLine'] = $CableLine;
        $ins['fiber'] = $i;
        $query = 'INSERT INTO "OpticalFiber"' . genInsert($ins);
        PQuery($query);
    }
    print "Добавление волокон завершено!";
}
Esempio n. 8
0
function CableLinePoint_INSERT($ins, $tmpT = FALSE)
{
    $query = 'INSERT INTO "' . tmpTable('CableLinePoint', $tmpT) . '"';
    $query .= genInsert($ins);
    $query .= ' RETURNING id';
    $result = PQuery($query);
    loggingIs(2, 'CableLinePoint', $ins, '');
    return $result;
}