예제 #1
0
 internal virtual void  fastWrite(FastWriter writer)
 {
     foreach (string key in bindings.Keys)
     {
         PBTerm value = (PBTerm)bindings [key];
         writer.writeList();
         writer.writeCompound("=", 2);
         // Arg 1
         writer.writeAtom(key);
         // Arg 2
         writer.writeTerm(value);
     }
     writer.writeNIL();
 }
예제 #2
0
        PBTerm send(string query, Bindings bindings, string sessionID)
        {
            lock (this) {
                if (parentSession != null)
                {
                    return(parentSession.send(query, bindings, sessionID));
                }
                // [PM] 4.1.3 Moved check to before I/O
                if (!is_valid_latin1(query))
                {
                    throw new ArgumentException("Non ISO-8859-1 character in query: " + query);
                }
                try {
                    initSend();

                    int len = sessionID == null ? 2 : 3;

                    output.writeCompound("query", len);
                    // [PD] Quintus 3.5; read in Quintus can be confused unless there
                    // is whitespace after the full stop.
                    output.writeString(query + ". ");
                    if (bindings == null)
                    {
                        output.writeNIL();
                    }
                    else
                    {
                        bindings.fastWrite(output);
                    }
                    if (sessionID != null)
                    {
                        output.writeAtom(sessionID);
                    }
                    output.commit();
                    return(parser.parseProlog(input));
                } catch (System.IO.IOException e) {
                    close();
                    throw e;
                } finally {
                    finishSend();
                }
            }
        }