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

version» Context lines:

pike.git/lib/modules/Sql.pmod/rsql.pike:1:   // Remote SQL server interface      #pike __REAL_VERSION__      #define RSQL_PORT 3994   #define RSQL_VERSION 1      #if constant(thread_create)   #define LOCK object key=mutex->lock()   #define UNLOCK destruct(key) - static private object(Thread.Mutex) mutex = Thread.Mutex(); + protected private object(Thread.Mutex) mutex = Thread.Mutex();   #else   #define LOCK   #define UNLOCK   #endif      #define ERROR(X ...) predef::error(X)    - static object(Stdio.File) sock; - static int seqno = 0; + protected object(Stdio.File) sock; + protected int seqno = 0;    - static private string host, user, pw; - static private int port; + protected private string host, user, pw; + protected private int port;    - static void low_reconnect() + protected void low_reconnect()   {    object losock = Stdio.File();    if(sock)    destruct(sock);    if (host == "") {   #ifdef ENABLE_SPAWN_RSQLD    Process.spawn_pike(({ "-x", "rsqld", "--stdin" }), ([    "stdin":losock->pipe(),    ]));   #else /* !ENABLE_SPAWN_RSQLD */
pike.git/lib/modules/Sql.pmod/rsql.pike:47:    }    sock = losock;    if(!do_request('L', ({user,pw}), 1)) {    sock = 0;    if(losock)    destruct(losock);    ERROR("Login refused on "+host+(port? ":"+port:"")+"\n");    }   }    - static void low_connect(string the_host, int the_port, string the_user, + protected void low_connect(string the_host, int the_port, string the_user,    string the_pw)   {    host = the_host;    port = the_port;    user = the_user;    pw = the_pw;    low_reconnect();   }    - static mixed do_request(int cmd, mixed|void arg, int|void noreconnect) + protected mixed do_request(int cmd, mixed|void arg, int|void noreconnect)   {    LOCK;    if(!sock)    if(noreconnect) {    UNLOCK;    ERROR("No connection\n");    } else    low_reconnect();    arg = (arg? encode_value(arg) : "");    sock->write("?<%c>%4c%4c%s", cmd, ++seqno, sizeof(arg), arg);
pike.git/lib/modules/Sql.pmod/rsql.pike:165:   }      int|object big_query(object|string q, mapping(string|int:mixed)|void bindings)   {    if(bindings)    q=.sql_util.emulate_bindings(q,bindings,this);       mixed qid = do_request('Q', q);    return qid && class {    -  static function(int,mixed:mixed) do_request; -  static mixed qid; +  protected function(int,mixed:mixed) do_request; +  protected mixed qid;       void destroy()    {    do_request('Z', qid);    }       int|array(string|int) fetch_row()    {    return do_request('R', qid);    }