コード例 #1
0
    def export_insert(self, table, params):
        '''
    This method is a bridge to access :class:`ResourceManagementDB` remotely. It
    does not add neither processing nor validation. If you need to know more
    about this method, you must keep reading on the database documentation.

    :Parameters:
      **table** - `string` or `dict`
        should contain the table from which querying
        if it's a `dict` the query comes from a client prior to v6r18

      **params** - `dict`
        arguments for the mysql query. Currently it is being used only for column selection.
        For example: meta = { 'columns' : [ 'Name' ] } will return only the 'Name' column.

    :return: S_OK() || S_ERROR()
    '''

        if isinstance(table,
                      dict):  #for backward compatibility: conversion is needed
            params, table = convert(table, params)

        gLogger.info('insert: %s %s' % (table, params))

        # remove unnecessary key generated by locals()
        del params['self']

        res = db.insert(table, params)
        self.__logResult('insert', res)

        return res
コード例 #2
0
  def export_insert( self, table, params ):
    '''
    This method is a bridge to access :class:`ResourceManagementDB` remotely. It
    does not add neither processing nor validation. If you need to know more
    about this method, you must keep reading on the database documentation.

    :Parameters:
      **table** - `string` or `dict`
        should contain the table from which querying
        if it's a `dict` the query comes from a client prior to v6r18

      **params** - `dict`
        arguments for the mysql query. Currently it is being used only for column selection.
        For example: meta = { 'columns' : [ 'Name' ] } will return only the 'Name' column.

    :return: S_OK() || S_ERROR()
    '''

    if isinstance(table, dict): #for backward compatibility: conversion is needed
      params, table = convert(table, params)

    gLogger.info( 'insert: %s %s' % ( table, params ) )


    # remove unnecessary key generated by locals()
    del params['self']

    res = db.insert( table, params )
    self.__logResult( 'insert', res )

    return res