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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:647: Inside #if defined(PG_DEBUG)
  #ifdef PG_DEBUG    showportal(msgtype);   #endif    }    int msglen=cr->read_int32();    _msgsreceived++;    _bytesreceived+=1+msglen;    int errtype=NOERROR;    PD("%d<",ci->socket->query_fd());    switch(msgtype) { -  array(mapping) getcols() { +  array getcols() {    int bintext=cr->read_int8();    int cols=cr->read_int16();   #ifdef PG_DEBUG    array a;    msglen-=4+1+2+2*cols;    foreach(a=allocate(cols,([]));;mapping m)    m.type=cr->read_int16();   #else    cr->consume(cols<<1);   #endif // Discard column info, and make it line oriented -  return ({(["type":bintext?BYTEAOID:TEXTOID,"name":"line"])}); +  return ({ ({(["name":"line"])}), ({bintext?BYTEAOID:TEXTOID}) });    };    array(string) reads() {   #ifdef PG_DEBUG    if(msglen<1)    errtype=PROTOCOLERROR;   #endif    array ret=({}),aw=({0});    do {    string w=cr->read_cstring();    msglen-=sizeof(w)+1; aw[0]=w; ret+=aw;
pike.git/lib/modules/Sql.pmod/pgsql.pike:822:    destruct(waitforauthready);    break;    case '1':   #ifdef PG_DEBUG    PD("ParseComplete\n");    msglen-=4;   #endif    break;    case 't': {    array a; -  int cols=cr->read_int16(); +    #ifdef PG_DEBUG -  +  int cols=cr->read_int16();    PD("%O ParameterDescription %d values\n",portal._query,cols);    msglen-=4+2+4*cols; -  +  a=cr->read_ints(cols,4); + #else +  a=cr->read_ints(cr->read_int16(),4);   #endif -  foreach(a=allocate(cols);int i;) -  a[i]=cr->read_int32(); +    #ifdef PG_DEBUGMORE    PD("%O\n",a);   #endif    if(portal._tprepared)    portal._tprepared.datatypeoid=a;    Thread.Thread(portal->_preparebind,a);    break;    }    case 'T': { -  array a; - #ifdef PG_DEBUG +  array a,at;    int cols=cr->read_int16(); -  + #ifdef PG_DEBUG    PD("RowDescription %d columns %O\n",cols,portal._query);    msglen-=4+2; -  foreach(a=allocate(cols);int i;) - #else -  foreach(a=allocate(cr->read_int16());int i;) +    #endif -  +  at=allocate(cols); +  foreach(a=allocate(cols);int i;)    {    string s=cr->read_cstring();    mapping(string:mixed) res=(["name":s]);   #ifdef PG_DEBUG    msglen-=sizeof(s)+1+4+2+4+2+4+2;    res.tableoid=cr->read_int32()||UNDEFINED;    res.tablecolattr=cr->read_int16()||UNDEFINED;   #else    cr->consume(6);   #endif -  res.type=cr->read_int32(); +  at[i]=cr->read_int32();   #ifdef PG_DEBUG    {    int len=cr->read_sint(2);    res.length=len>=0?len:"variable";    }    res.atttypmod=cr->read_int32();    /* formatcode contains just a zero when Bind has not been issued    * yet, but the content is irrelevant because it's determined    * at query time    */    res.formatcode=cr->read_int16();   #else    cr->consume(8);   #endif    a[i]=res;    }   #ifdef PG_DEBUGMORE    PD("%O\n",a);   #endif    if(portal._forcetext) -  portal->_setrowdesc(a); // Do not consume queued portal +  portal->_setrowdesc(a,at); // Do not consume queued portal    else { -  portal->_processrowdesc(a); +  portal->_processrowdesc(a,at);    portal=0;    }    break;    }    case 'n': {   #ifdef PG_DEBUG    msglen-=4;    PD("NoData %O\n",portal._query);   #endif    portal._fetchlimit=0; // disables subsequent Executes -  portal->_processrowdesc(({})); +  portal +  ->_processrowdesc(.pgsql_util.emptyarray,.pgsql_util.emptyarray);    portal=0;    break;    }    case 'H': -  portal->_processrowdesc(getcols()); +  portal->_processrowdesc(@getcols());    PD("CopyOutResponse %O\n",portal._query);    break;    case '2': {    mapping tp;   #ifdef PG_DEBUG    msglen-=4;    PD("%O BindComplete\n",portal._portalname);   #endif    if(tp=portal._tprepared) {    int tend=gethrtime();
pike.git/lib/modules/Sql.pmod/pgsql.pike:990: Inside #if defined(PG_DEBUG)
  #ifdef PG_DEBUG    if(msglen<0)    errtype=PROTOCOLERROR;   #endif    portal->_processdataready(({cr->read(msglen)}),msglen);   #ifdef PG_DEBUG    msglen=0;   #endif    break;    case 'G': -  portal->_setrowdesc(getcols()); +  portal->_setrowdesc(@getcols());    PD("%O CopyInResponse\n",portal._portalname);    portal._state=COPYINPROGRESS;    break;    case 'c':   #ifdef PG_DEBUG    PD("%O CopyDone\n",portal._portalname);    msglen-=4;   #endif    portal=0;    break;
pike.git/lib/modules/Sql.pmod/pgsql.pike:1279:    big_query("CLOSE ALL");    big_query("DISCARD TEMP");   }      private void resync_cb() {    switch(backendstatus) {    case 'T':case 'E':    foreach(_prepareds;;mapping tp) {    m_delete(tp,"datatypeoid");    m_delete(tp,"datarowdesc"); +  m_delete(tp,"datarowtypes");    }    Thread.Thread(reset_dbsession); // Urgently and deadlockfree    }   }      private void sendsync() {    _readyforquerycount++;    c->start()->sendcmd(SYNCSEND);   }   
pike.git/lib/modules/Sql.pmod/pgsql.pike:1908:    if(!tp || !tp.datatypeoid) {    PD("Describe statement %O\n",preparedname);    (plugbuffer||c->start())->add_int8('D')    ->add_hstring(({'S',preparedname,0}),4,4)->sendcmd(FLUSHSEND,portal);    } else {    if(plugbuffer)    plugbuffer->sendcmd(KEEP);   #ifdef PG_STATS    skippeddescribe++;   #endif -  portal->_setrowdesc(tp.datarowdesc); +  portal->_setrowdesc(tp.datarowdesc,tp.datarowtypes);    }    if((portal._tprepared=tp) && tp.datatypeoid) {    mixed e=catch(portal->_preparebind(tp.datatypeoid));    if(e && !portal._delayederror)    throw(e);    }    }    throwdelayederror(portal);    return portal;   }