Changeset 3137
- Timestamp:
- Feb 4, 2005, 2:57:49 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/archive/psdb/psDB.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/psdb/psDB.c
r3135 r3137 8 8 * @author Joshua Hoblitt 9 9 * 10 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-02-05 00: 49:51$10 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-02-05 00:57:49 $ 12 12 * 13 13 * Copyright 2005 Joshua Hoblitt, University of Hawaii … … 228 228 } 229 229 230 // a = assign too, b = source psArray, c = conversion function, d = type to cast to 231 #define STRINGARRAYTOPTYPE(a, b, c, d )for (i = 0; i < b->n; i++) { \232 a = (d)(strlen(b->data[i]) \233 ? atoi(b->data[i]) \234 : *(d *)p_psDBGetPTypeNull(pType)); \235 }230 // a = assign too, b = source psArray, c = conversion function, d = type to cast to, e = psElemType 231 #define STRINGARRAYTOPTYPE(a, b, c, d, e) for (i = 0; i < b->n; i++) { \ 232 a = (d)(strlen(b->data[i]) \ 233 ? atoi(b->data[i]) \ 234 : *(d *)p_psDBGetPTypeNull(e)); \ 235 } 236 236 237 237 psVector *psDBSelectColumnNum(psDB *dbh, const char *tableName, const char *col, psElemType pType, const psU64 limit) … … 253 253 switch (pType) { 254 254 case PS_TYPE_S8: 255 STRINGARRAYTOPTYPE(column->data.S8[i], stringColumn, atoi, psS8 );255 STRINGARRAYTOPTYPE(column->data.S8[i], stringColumn, atoi, psS8, PS_TYPE_S8); 256 256 break; 257 257 case PS_TYPE_S16: 258 STRINGARRAYTOPTYPE(column->data.S16[i], stringColumn, atoi, psS16 );258 STRINGARRAYTOPTYPE(column->data.S16[i], stringColumn, atoi, psS16, PS_TYPE_S16); 259 259 break; 260 260 case PS_TYPE_S32: 261 STRINGARRAYTOPTYPE(column->data.S32[i], stringColumn, atoi, psS32 );261 STRINGARRAYTOPTYPE(column->data.S32[i], stringColumn, atoi, psS32, PS_TYPE_S32); 262 262 break; 263 263 case PS_TYPE_S64: 264 STRINGARRAYTOPTYPE(column->data.S64[i], stringColumn, atoll, psS64 );264 STRINGARRAYTOPTYPE(column->data.S64[i], stringColumn, atoll, psS64, PS_TYPE_S64); 265 265 break; 266 266 case PS_TYPE_U8: 267 267 // missing from psVector in SDRS 268 STRINGARRAYTOPTYPE(column->data.U8[i], stringColumn, atoi, psU8 );268 STRINGARRAYTOPTYPE(column->data.U8[i], stringColumn, atoi, psU8, PS_TYPE_U8); 269 269 break; 270 270 case PS_TYPE_U16: 271 STRINGARRAYTOPTYPE(column->data.U16[i], stringColumn, atoi, psU16 );271 STRINGARRAYTOPTYPE(column->data.U16[i], stringColumn, atoi, psU16, PS_TYPE_U16); 272 272 break; 273 273 case PS_TYPE_U32: 274 STRINGARRAYTOPTYPE(column->data.U32[i], stringColumn, atoi, psU32 );274 STRINGARRAYTOPTYPE(column->data.U32[i], stringColumn, atoi, psU32, PS_TYPE_U32); 275 275 break; 276 276 case PS_TYPE_U64: 277 STRINGARRAYTOPTYPE(column->data.U64[i], stringColumn, atoll, psU64 );277 STRINGARRAYTOPTYPE(column->data.U64[i], stringColumn, atoll, psU64, PS_TYPE_U64); 278 278 break; 279 279 case PS_TYPE_F32: 280 STRINGARRAYTOPTYPE(column->data.F32[i], stringColumn, atof, psF32 );280 STRINGARRAYTOPTYPE(column->data.F32[i], stringColumn, atof, psF32, PS_TYPE_F32); 281 281 break; 282 282 case PS_TYPE_F64: 283 STRINGARRAYTOPTYPE(column->data.F64[i], stringColumn, atof, psF64 );283 STRINGARRAYTOPTYPE(column->data.F64[i], stringColumn, atof, psF64, PS_TYPE_F64); 284 284 break; 285 285 case PS_TYPE_C32: 286 286 // this is a bogus SQL type 287 STRINGARRAYTOPTYPE(column->data.C32[i], stringColumn, atof, psC32 );287 STRINGARRAYTOPTYPE(column->data.C32[i], stringColumn, atof, psC32, PS_TYPE_C32); 288 288 break; 289 289 case PS_TYPE_C64: 290 290 // this is a bogus SQL type 291 STRINGARRAYTOPTYPE(column->data.C64[i], stringColumn, atof, psC64 );291 STRINGARRAYTOPTYPE(column->data.C64[i], stringColumn, atof, psC64, PS_TYPE_C64); 292 292 break; 293 293 case PS_TYPE_BOOL:
Note:
See TracChangeset
for help on using the changeset viewer.
