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.2 2006/02/10 09:54:33 grubba Exp $ +  * $Id: tds.pike,v 1.3 2006/02/10 10:27:43 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:868:    case TDS_INFO_TOKEN:    case TDS_EED_TOKEN:    process_msg(token_type);    return;    case TDS_ENVCHANGE_TOKEN:    process_env_chg();    return;    case TDS7_RESULT_TOKEN:    tds7_process_result();    break; +  case TDS5_DYNAMIC_TOKEN: +  case TDS_LOGINACK_TOKEN: +  case TDS_ORDERBY_TOKEN: +  case TDS_CONTROL_TOKEN: +  case TDS_TABNAME_TOKEN: +  TDS_WERROR("Skipping token: %d\n", token_type); +  get_raw(get_smallint()); +  break; +  default: +  TDS_WERROR("FIXME: Got unknown token in process_default_tokens: %d\n", +  token_type); +  break;    }    }       int process_result_tokens()    {    if (!busy) {    //return TDS_NO_MORE_RESULTS;    }    while (1) {    int token_type = peek_byte();
pike.git/lib/modules/Sql.pmod/tds.pike:944:    }    break;    case 2:    colsize = get_smallint();    if (!colsize) {    // Empty string.    return "";    }    if (colsize == 0xffff) colsize = 0;    break; +  case 1: +  colsize = get_byte(); +  break;    case 0:    colsize = get_size_by_type(info->cardinal_type);    break;    }    TDS_WERROR("Column size is %d\n", colsize);    if (!colsize) return 0; // NULL.    if (is_numeric_type(info->cardinal_type)) {    // NUMERIC    string arr = get_raw(colsize);    TDS_WERROR("NUMERIC: %O\n", arr);
pike.git/lib/modules/Sql.pmod/tds.pike:993:    if (info->cardinal_type == SYBDATETIME4) {    TDS_WERROR("Datetime4:%{ %d}\n", (array)raw);    }    TDS_WERROR("ROW: %O\n", raw);    return raw;    }    }       static string|int convert(string|int raw, mapping(string:mixed) info)    { +  if (!raw) return raw; /* NULL */    switch(info->cardinal_type) {    case SYBCHAR:    case SYBVARCHAR:    case SYBTEXT:    case XSYBCHAR:    case XSYBVARCHAR:    case SYBNVARCHAR:    case SYBNTEXT:    case SYBLONGBINARY:    case SYBBINARY:
pike.git/lib/modules/Sql.pmod/tds.pike:1089:    int j = (l * 80)/2447;    int mday = l - (j * 2447)/80;    l = j/11;    int mon = j + 1 - l*12;    year += (century + 15)*100 + l;    if (!l && !(year & 3) && ((year % 100) || !(year % 400)))    yday++;    return sprintf("%04d-%02d-%02dT%02d:%02d:%02d",    year, mon, mday, hour, min, sec);    } + #if 0 +  case SYBDATETIMN: +  +  break; + #endif /* 0 */    } -  +  return raw;    }       static array(string|int) process_row()    {    if (!column_info) return 0;    array(string|int) res = allocate(sizeof(column_info));    foreach(column_info; int i; mapping(string:mixed) info) {    res[i] = convert(get_data(info, i), info);    }    return res;