Esempio n. 1
0
   INT32 upAAttrByFieldAlias( qgmDbAttr & attr,
                              const qgmOPFieldPtrVec & fieldAlias )
   {
      PD_TRACE_ENTRY( SDB__QGMUPAATTRBYFIELDALIAS ) ;
      INT32 rc = SDB_OK ;
      qgmOPFieldPtrVec::const_iterator cit = fieldAlias.begin() ;
      while ( cit != fieldAlias.end() )
      {
         if ( attr == (*cit)->value )
         {
            if ( (*cit)->alias.empty() )
            {
               attr.relegation().clear() ;
            }
            else
            {
               attr.attr() = (*cit)->alias ;
            }
            break ;
         }
         ++cit ;
      }

      PD_TRACE_EXITRC( SDB__QGMUPAATTRBYFIELDALIAS, rc ) ;
      return rc ;
   }
Esempio n. 2
0
   // PD_TRACE_DECLARE_FUNCTION( SDB__QGMPTRTABLE_GETOWNATTR, "_qgmPtrTable::getOwnAttr" )
   INT32 _qgmPtrTable::getOwnAttr( const CHAR *begin,
                                   UINT32 size,
                                   qgmDbAttr &attr )
   {
      INT32 rc = SDB_OK ;

      PD_TRACE_ENTRY( SDB__QGMPTRTABLE_GETOWNATTR ) ;

      UINT32 pos = 0 ;
      BOOLEAN hasDot = qgmUtilFirstDot( begin, size, pos ) ;
      if ( hasDot && ( 0 == pos || size - 1 == pos ) )
      {
         PD_LOG( PDERROR,
                 "the first char and the last char can not be '.'" ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }

      if ( hasDot )
      {
         rc = getOwnField( begin, pos, attr.relegation() ) ;
         if ( SDB_OK != rc )
         {
            goto error ;
         }
         ++pos ;
      }

      rc = getOwnField( begin + pos, size - pos, attr.attr() ) ;
      if ( SDB_OK != rc )
      {
         goto error ;
      }

   done:
      PD_TRACE_EXITRC( SDB__QGMPTRTABLE_GETOWNATTR, rc ) ;
      return rc ;
   error:
      goto done ;
   }
Esempio n. 3
0
   INT32 _qgmPtrTable::getAttr( const CHAR *begin, UINT32 size,
                                qgmDbAttr &attr )
   {
      PD_TRACE_ENTRY( SDB__QGMPTRTABLE_GETATTR ) ;
      INT32 rc = SDB_OK ;
      UINT32 num = 0 ;
      BOOLEAN hasDot = qgmUtilFirstDot( begin, size, num ) ;
      if ( 1 == num || size == num )
      {
         PD_LOG( PDERROR,
                 "the first char and the last char can not be '.'" ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }

      if ( hasDot )
      {
         rc = getField( begin, num - 1, attr.relegation() ) ;
         if ( SDB_OK != rc )
         {
            goto error ;
         }
      }

      rc = getField( begin + num, size - num, attr.attr() ) ;
      if ( SDB_OK != rc )
      {
         goto error ;
      }

   done:
      PD_TRACE_EXITRC( SDB__QGMPTRTABLE_GETATTR, rc ) ;
      return rc ;
   error:
      goto done ;
   }