예제 #1
0
        public TextResultSet Query(string query)
        {
            var stream = client.GetStream();

            var readWriteBuffer = InternalMemoryPool.GetBuffer();
            var writer          = PacketWriter.Create(readWriteBuffer);

            ProtocolWriter.WriteQuery(ref writer, query);

            var reader = SyncWriteAndRead(ref writer, 0, stream);

            // TODO: Ok or ResultSet?
            var set = ProtocolReader.ReadTextResultSet(ref reader);

            return(set);
        }
예제 #2
0
        public TextResultSet Query(FormattableString query)
        {
            if (query.ArgumentCount == 0)
            {
                return(Query(query.Format));
            }

            var stream = client.GetStream();

            var readWriteBuffer = InternalMemoryPool.GetBuffer();
            var writer          = PacketWriter.Create(readWriteBuffer);

            var charBuffer  = InternalMemoryPool.GetCharBuffer();
            var stringCount = FastQueryParser.Parse(ref charBuffer, query);

            ProtocolWriter.WriteQuery(ref writer, charBuffer, stringCount);

            var reader = SyncWriteAndRead(ref writer, 0, stream);

            // TODO: Ok or ResultSet?
            var set = ProtocolReader.ReadTextResultSet(ref reader);

            return(set);
        }