Beispiel #1
0
 internal override PBTerm[] fastWritePrefix(FastWriter writer)
 {
     // [PM] 4.3.2 FIXME: it would be better to always write a string prefix (writeCharList) if possible, and then write the remainder regardless of whether the remainder is NIL or not.
     if (TrueString)
     {
         writer.writeString(getString());
         return(PBTerm.NO_TERMS);
     }
     else
     {
         return(base.fastWritePrefix(writer));
     }
 }
Beispiel #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();
                }
            }
        }