public Task Write(NpgsqlTsQueryEmpty value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async) => Write((NpgsqlTsQuery)value, buf, lengthCache, parameter, async);
public bool Read(out NpgsqlTsQuery result) { result = null; if (_tokenPos == -1) { if (_buf.ReadBytesLeft < 4) { return(false); } _numTokens = _buf.ReadInt32(); _bytesLeft -= 4; _tokenPos = 0; } if (_numTokens == 0) { result = new NpgsqlTsQueryEmpty(); _buf = null; _nodes = null; return(true); } for (; _tokenPos < _numTokens; _tokenPos++) { if (_buf.ReadBytesLeft < Math.Min(_bytesLeft, MaxSingleTokenBytes)) { return(false); } int readPos = _buf.ReadPosition; bool isOper = _buf.ReadByte() == 2; if (isOper) { NpgsqlTsQuery.NodeKind operKind = (NpgsqlTsQuery.NodeKind)_buf.ReadByte(); if (operKind == NpgsqlTsQuery.NodeKind.Not) { var node = new NpgsqlTsQueryNot(null); InsertInTree(node); _nodes.Push(new Tuple <NpgsqlTsQuery, int>(node, 0)); } else { NpgsqlTsQuery node = null; if (operKind == NpgsqlTsQuery.NodeKind.And) { node = new NpgsqlTsQueryAnd(null, null); } else if (operKind == NpgsqlTsQuery.NodeKind.Or) { node = new NpgsqlTsQueryOr(null, null); } else { PGUtil.ThrowIfReached(); } InsertInTree(node); _nodes.Push(new Tuple <NpgsqlTsQuery, int>(node, 2)); _nodes.Push(new Tuple <NpgsqlTsQuery, int>(node, 1)); } } else { NpgsqlTsQueryLexeme.Weight weight = (NpgsqlTsQueryLexeme.Weight)_buf.ReadByte(); bool prefix = _buf.ReadByte() != 0; string str = _buf.ReadNullTerminatedString(); InsertInTree(new NpgsqlTsQueryLexeme(str, weight, prefix)); } _bytesLeft -= _buf.ReadPosition - readPos; } if (_nodes.Count != 0) { PGUtil.ThrowIfReached(); } result = _value; _buf = null; _nodes = null; _value = null; return(true); }
public int ValidateAndGetLength(NpgsqlTsQueryEmpty value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter) => ValidateAndGetLength((NpgsqlTsQuery)value, ref lengthCache, parameter);