function _dataAccess()
{
  /**
   *  Propriedades da Classe
   *  ======================================================================= //
   */
  this.buffer = '';
  this.root = _getPathUnit("rpcStudio.js");
  this.path = this.root.substr(0, this.root.indexOf('lib_JS') ) + 'core/';

  this.addBuffer = function( txt )
  {
    this.buffer += txt;
  }
  this.echo = function( nObj )
  {
    var objDOM = findDOM( nObj, 0 );

    objDOM.innerHTML = this.buffer;
    this.buffer = '';
  }

  this.send = function( txt )
  {
    var callId = jsrsCall( this.path + "rpcServer.dataAccess.php",
                           "dataAccess._send",
                           "dataAccess.set_path",
                           this.path,
                           false );
    alert('send[ ' + this.path + ' ]');
  }
  this._send = function( txt, callId  )
  {
    alert('send: OK ret: ' + txt);
  }
  this.teste1 = function( txt )
  {
    var callId = jsrsCall( "core/rpcServer.dataAccess.php",
                           "dataAccess._teste",
                           "dataAccess.get_fields",
                           txt,
                           false );
    //alert('teste ['+this.path+'] 1: ' + txt);
  }
  this._teste = function( text, callId )
  {
    alert( 'ret: ' + text );
  }

/**
 *  Atualiza o Registro Corrente
 */
  this.upDate = function( txt )
  {
    var callId = jsrsCall( this.path + "rpcServer.dataAccess.php",
                           "dataAccess._upDate",
                           "dataAccess.up_date",
                           txt,
                           false);
//    alert('tst 2: ' + this.path );
//    alert('send cmd[ ' + txt + ' ]');
  }
  this._upDate = function( text, callId )
  {
    alert( 'ret2: ' + text );
  }


  this.getResult = function( txt )
  {
    //alert('getFields' + this.path );
    var callId = jsrsCall( this.path + "rpcServer.dataAccess.php",
                           "dataAccess._getResult",
                           "dataAccess.get_result",
                           txt,
                           false);
    //alert('tst 1: ' + this.path );
//    alert('send cmd[ ' + txt + ' ]');
  }
  this._getResult = function( list, callId )
  {
    //alert( 'ret: '+ list );
    nrLine = list.length;
    nObj   = list[0];

    if( nObj.substr( 0, 4 ) == 'erro' )
    {
      alert( 'ret2: ' + nObj );
    }else
    {
      var objDOM = findDOM( nObj, 0 );
      var tmp = '  <tbody>';
      
      for( nlin_ = 1; nlin_ < nrLine; nlin_ ++ )
      {
        linha = list[ nlin_ ];
        arrLinha = linha.split( '*' );
        nrField = arrLinha.length;

        tmp += '  <tr id="' + nObj + '_tit">';

        tmp += '    <th id="' + nObj + '_th_' + nlin_ + '" class="' + nObj + '_tit">';
        tmp += '      <span id="' + nObj + '_num_' + nlin_ + '"';
        tmp += '            class="' + nObj + '_col">' + nlin_ + '</span>';
        tmp += '    </th>';
        
        ixx = 0;
        for( ix = 0; ix < nrField; ix++ )
        {
          ixx ++;
          tmp += '    <td id="' + nObj + '_td_' + nlin_ + '_' + ixx + '">';
          tmp += '      <input id="' + nObj + '_col_' + nlin_ + '_' + ixx + '"';
          tmp += '             type="text" readOnly="true"';
          tmp += '             class="' + nObj + '_col_' + ixx + '"';
          tmp += '             value="'+arrLinha[ix] + '" />';
          tmp += '    </td>';
        }// End for( ix = 0; ix < nrField; ix++ )
        tmp += '  </tr>';
      }// End
      tmp += '  </tbody>';
      tmp += '</table>';

      this.addBuffer( tmp );
      this.echo( nObj );



    }// End if( nObj.substr( 0, 4 ) == 'erro' )
  }// End this._getResult = function( list, callId )






/**
 *  Solicita a lista de Campos
 */
  this.getFields = function( txt )
  {
    //alert('getFields' + this.path );
    var callId = jsrsCall( this.path + "rpcServer.dataAccess.php",
                           "dataAccess._getFields",
                           "dataAccess.get_fields",
                           txt,
                           false);
    //alert('tst 1: ' + this.path );
//    alert('send cmd[ ' + txt + ' ]');
  }
  this._getFields = function( field, callId )
  {
    var tmp = '';
    nrField = field.length;
    nObj  = field[0];

    if( nObj.substr( 0, 4 ) == 'erro' )
    {
      alert( 'ret2: ' + nObj );
    }else
    {
      var objDOM = findDOM( nObj, 0 );
      var tmp = '';
  
      tmp += '<table id="' + nObj + '_table" cellpadding="2" cellspacing="1">';
      tmp += '  <thead>';
      tmp += '  <tr id="' + nObj + '_tit">';
      tmp += '    <th id="' + nObj + '_th" class="' + nObj + '_tit">';
      tmp += '      <span id="' + nObj + '_num" class="' + nObj + '_col">';
      tmp += '        &nbsp; &nbsp; ';
      tmp += '      </span>';
      tmp += '    </th>';

      for( ix = 1; ix < nrField; ix++ )
      {
        tmp += '    <th id="' + nObj + '_th_' + ix + '" class="' + nObj + '_tit">';
        tmp += '      <input id="' + nObj + '_tit_' + ix+'" type="text" readOnly="true"';
        tmp += '             value="'+field[ix] + '" class="' + nObj + '_col_' + ix+'">';
        tmp += '    </th>';
      }
      tmp += '  </tr>';
      tmp += '</thead>';
//      tmp += '';
//      tmp += '';
//      tmp += '';
//      tmp += '</table>';
  
      this.addBuffer( tmp );
      //this.echo( nObj );
    }// End



  }

}// End function _dataAccess()


var dataAccess = new _dataAccess(); // Pseudo static
