// Generated by CoffeeScript 1.7.1
var metadataParse, parser, valueParse;

metadataParse = require('../metadata-parser');

valueParse = require('../value-parser');

parser = function(buffer, colMetadata, options) {
  var metadata, paramName, paramOrdinal, status, token, value;
  paramOrdinal = buffer.readUInt16LE();
  paramName = buffer.readBVarchar();
  status = buffer.readUInt8();
  metadata = metadataParse(buffer, options);
  value = valueParse(buffer, metadata, options);
  if (paramName.charAt(0) === '@') {
    paramName = paramName.slice(1);
  }
  return token = {
    name: 'RETURNVALUE',
    event: 'returnValue',
    paramOrdinal: paramOrdinal,
    paramName: paramName,
    metadata: metadata,
    value: value
  };
};

module.exports = parser;
