Пример #1
0
function tableHandler()
{
    $opspec = getOpspec();
    switch ($opspec['action']) {
        case 'INSERT':
            switch ($opspec['table']) {
                case 'Attribute':
                    $realm = 'attr';
                    break;
                case 'Chapter':
                    $realm = 'chapter';
                    break;
                case 'Dictionary':
                    $realm = 'dict';
                    break;
                case 'TagTree':
                    $realm = 'tag';
                    break;
                case 'VLANSwitchTemplate':
                    $realm = 'vst';
                    break;
                default:
                    $realm = NULL;
            }
            usePreparedInsertBlade($opspec['table'], buildOpspecColumns($opspec, 'arglist'));
            if (isset($realm)) {
                lastCreated($realm, lastInsertID());
            }
            $retcode = 48;
            break;
        case 'DELETE':
            usePreparedDeleteBlade($opspec['table'], buildOpspecColumns($opspec, 'arglist'), array_fetch($opspec, 'conjunction', 'AND'));
            $retcode = 49;
            break;
        case 'UPDATE':
            usePreparedUpdateBlade($opspec['table'], buildOpspecColumns($opspec, 'set_arglist'), buildOpspecColumns($opspec, 'where_arglist'), array_fetch($opspec, 'conjunction', 'AND'));
            $retcode = 51;
            break;
        default:
            throw new InvalidArgException('opspec/action', $opspec['action']);
    }
    showOneLiner($retcode);
}
Пример #2
0
function commitCreateRSPool($name = '', $vsconfig = '', $rsconfig = '', $tagidlist = array())
{
    usePreparedInsertBlade('IPv4RSPool', array('name' => !strlen($name) ? NULL : $name, 'vsconfig' => !strlen($vsconfig) ? NULL : $vsconfig, 'rsconfig' => !strlen($rsconfig) ? NULL : $rsconfig));
    $new_pool_id = lastInsertID();
    lastCreated('ipv4rspool', $new_pool_id);
    produceTagsForNewRecord('ipv4rspool', $tagidlist, $new_pool_id);
    return $new_pool_id;
}