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

version» Context lines:

pike.git/lib/modules/Sql.pmod/tds.pike:1:   /* -  * $Id: tds.pike,v 1.7 2006/02/10 16:03:52 grubba Exp $ +  * $Id: tds.pike,v 1.8 2006/02/10 16:28:31 grubba Exp $    *    * A Pike implementation of the TDS protocol.    *    * Henrik Grubbström 2006-02-08.    */      #define TDS_DEBUG      #ifdef TDS_DEBUG   #define TDS_WERROR(X...) werror("TDS:" + X)
pike.git/lib/modules/Sql.pmod/tds.pike:446:    return sprintf("%-4c%s", sizeof(res)+4, res);    }    }       InPacket send_packet(Packet p, int flag, int|void last)    {    if (busy) {    tds_error("Sending packet on busy connection!\n");    }    -  string packet = (string) p; -  foreach(packet/512.0, string raw) { +  array(string) packets = ((string) p)/512.0; +  foreach(packets; int i; string raw) {    // NOTE: Network byteorder!!    raw = sprintf("%1c%1c%2c\0\0%1c\0%s", -  flag, last, +  flag, (i == (sizeof(packets)-1)) && last,    sizeof(raw) + 8,    1, /* TDS 7 or 8. */    raw);    TDS_WERROR("Wrapped packet: %O\n%s\n", raw, hex_dump(raw));    if (socket->write(raw) != sizeof(raw)) {    socket->close();    socket = 0;    tds_error("Failed to send packet.\n"    "raw: %O\n", raw);    }