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

version» Context lines:

pike.git/lib/modules/Sql.pmod/rsql.pike:14:   #define UNLOCK   #endif      #define ERROR(X ...) predef::error(X)      protected object(Stdio.File) sock;   protected int seqno = 0;      protected private string host, user, pw;   protected private int port; + protected private mapping options;      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(),
pike.git/lib/modules/Sql.pmod/rsql.pike:39:    if(!losock->connect(host, port||RSQL_PORT))    ERROR("Can't connect to "+host+(port? ":"+port:"")+": "+    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;    if(losock)    destruct(losock);    ERROR("Login refused on "+host+(port? ":"+port:"")+"\n");    }   }      protected void low_connect(string the_host, int the_port, string the_user, -  string the_pw) +  string the_pw, mapping the_options)   {    host = the_host;    port = the_port;    user = the_user;    pw = the_pw; -  +  options = the_options;    low_reconnect();   }      protected mixed do_request(int cmd, mixed|void arg, int|void noreconnect)   {    LOCK;    if(!sock)    if(noreconnect) {    UNLOCK;    ERROR("No connection\n");
pike.git/lib/modules/Sql.pmod/rsql.pike:217:    }       }(do_request, qid);   }      array(mapping(string:mixed)) query(mixed ... args)   {    return do_request('@', args);   }    - void create(string|void host, string|void db, string|void user, string|void _pw) + void create(string|void host, string|void db, string|void user, +  string|void _pw, mapping|void options)   {    string pw = _pw;    _pw = "CENSORED";       // Reconstruct the original URL (minus rsql://)       if(!host) {    destruct(this);    return;    }
pike.git/lib/modules/Sql.pmod/rsql.pike:257:    user = arr[..<1]*"@";    host = arr[-1];    arr = user/":";    if(sizeof(arr)>1) {    pw = arr[1..]*":";    user = arr[0];    }    }    int port = 0;    sscanf(host, "%s:%d", host, port); -  low_connect(host, port, user, pw); +  low_connect(host, port, user, pw, options);    select_db(db);   }