pike.git / lib / modules / Sql.pmod / rsql.pike

version» Context lines:

pike.git/lib/modules/Sql.pmod/rsql.pike:9:   #define LOCK object key=mutex->lock()   #define UNLOCK destruct(key)   protected private object(Thread.Mutex) mutex = Thread.Mutex();   #else   #define LOCK   #define UNLOCK   #endif      #define ERROR(X ...) predef::error(X)    + inherit __builtin.Sql.Connection; +    protected object(Stdio.File) sock;   protected int seqno = 0;      protected private string host, user, pw;   protected private int port;   protected private mapping options;      protected private string db;      protected void low_reconnect()
pike.git/lib/modules/Sql.pmod/rsql.pike:34: Inside #if defined(ENABLE_SPAWN_RSQLD)
  #ifdef ENABLE_SPAWN_RSQLD    Process.spawn_pike(({ "-x", "rsqld", "--stdin" }), ([    "stdin":losock->pipe(),    ]));   #else /* !ENABLE_SPAWN_RSQLD */    ERROR("Automatic spawning of rsqld not enabled.\n");   #endif /* ENABLE_SPAWN_RSQLD */    } else {    if(!losock->connect(host, port||RSQL_PORT))    ERROR("Can't connect to "+host+(port? ":"+port:"")+": "+ -  strerror(losock->errno())+"\n"); +  strerror(losock->errno())+".\n");    }    if(8!=losock->write("RSQL%4c", RSQL_VERSION) ||    losock->read(4) != "SQL!") {    destruct(losock);    ERROR("Initial handshake error on "+host+(port? ":"+port:"")+"\n");    }    sock = losock;    // FIXME: Propagate options?    if(!do_request('L', ({user,pw}), 1)) {    sock = 0;
pike.git/lib/modules/Sql.pmod/rsql.pike:182:    return do_request('t', wild);   }      array(mapping(string:mixed)) list_fields(string ... args)   {    return do_request('f', args);   }      string quote(string s)   { -  return do_request('q'); +  return do_request('q', s);   }      protected class RemoteResult(protected function(int,mixed:mixed) do_request,    protected mixed qid)   { -  void destroy() +  inherit __builtin.Sql.Result; +  +  protected void _destruct()    {    do_request('Z', qid);    }       int|array(string|int) fetch_row()    {    return do_request('R', qid);    }       array(mapping(string:mixed)) fetch_fields()
pike.git/lib/modules/Sql.pmod/rsql.pike:224:    {    return do_request('e', qid);    }       void seek(int skip)    {    do_request('S', ({qid,skip}));    }   }    - int|object big_query(object|string q, mapping(string|int:mixed)|void bindings) + variant RemoteResult big_query(object|string q)   { -  if(bindings) -  q=.sql_util.emulate_bindings(q,bindings,this); -  +     mixed qid = do_request('Q', q);    return qid && RemoteResult(do_request, qid);   }    - int|object big_typed_query(object|string q, -  mapping(string|int:mixed)|void bindings) + variant RemoteResult big_typed_query(object|string q)   { -  if(bindings) -  q=.sql_util.emulate_bindings(q,bindings,this); -  +     mixed qid = do_request('Q', ({ "big_typed_query", q }));    return qid && RemoteResult(do_request, qid);   }    - int|object streaming_query(object|string q, -  mapping(string|int:mixed)|void bindings) + variant RemoteResult streaming_query(object|string q)   { -  if(bindings) -  q=.sql_util.emulate_bindings(q,bindings,this); -  +     mixed qid = do_request('Q', ({ "streaming_query", q }));    return qid && RemoteResult(do_request, qid);   }    - int|object streaming_typed_query(object|string q, -  mapping(string|int:mixed)|void bindings) + variant RemoteResult streaming_typed_query(object|string q)   { -  if(bindings) -  q=.sql_util.emulate_bindings(q,bindings,this); -  +     mixed qid = do_request('Q', ({ "streaming_typed_query", q }));    return qid && RemoteResult(do_request, qid);   }      array(mapping(string:mixed)) query(mixed ... args)   {    return do_request('@', args);   }      int insert_id()