Changeset 3849
- Timestamp:
- May 5, 2005, 11:11:39 AM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 2 edited
-
dataIO/psDB.c (modified) (8 diffs)
-
db/psDB.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataIO/psDB.c
r3671 r3849 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-0 4-06 01:12:58$14 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-05-05 21:11:39 $ 16 16 * 17 17 * Copyright 2005 Joshua Hoblitt, University of Hawaii … … 625 625 } else { 626 626 column = psDBSelectColumnNum(dbh, tableName, field[i].name, pType, 0); 627 if (pType == PS_META_S32) { 628 psMetadataAddS32(table, 0, field[i].name, "", (psS32)atoll(column)); 629 } else if (pType == PS_META_F32) { 630 psMetadataAddF32(table, 0, field[i].name, "", (psF32)atof(column)); 631 } else if (pType == PS_META_F64) { 632 psMetadataAddF64(table, 0, field[i].name, "", (psF64)atof(column)); 633 } 627 psMetadataAddVector(table, 0, field[i].name, "", column); 634 628 psFree(column); 635 629 } … … 814 808 // convert NaNs to NULL and set the buffer_length for strings 815 809 //} else if ((item->type == PS_META_STR) && (item->pType == PS_TYPE_PTR)) { 816 } else if ((item->type == PS_META_STR) || (item->type == PS_META_VEC) || 817 (item->type == PS_META_IMG) || (item->type == PS_META_HASH) || 818 (item->type == PS_META_LOOKUPTABLE) || (item->type == PS_META_JPEG) || 819 (item->type == PS_META_PNG) || (item->type == PS_META_ASTROM) || 820 (item->type == PS_META_UNKNOWN)) { 810 } else if (item->type == PS_META_STR) { 821 811 822 812 bind[i].buffer_length = (unsigned long)strlen((char *)item->data.V); … … 828 818 } else { 829 819 psError(PS_ERR_BAD_PARAMETER_TYPE , true, 830 "FIXME: Only type of PS_TYPE_S32, PS_TYPE_F32, PS_TYPE_F64, " 831 "and PS_TYPE_PTR are supported."); 820 "FIXME: Only type of PS_TYPE_S32 (PS_META_S32), " 821 "PS_TYPE_F32 (PS_META_F32), PS_TYPE_F64 (PS_META_F64), " 822 "and PS_META_STR are supported."); 832 823 833 824 psFree(cursor); … … 874 865 psStringAppend(&query, "%s %s", item->name, colType); 875 866 psFree(colType); 876 } else if ((item->type == PS_META_STR) || (item->type == PS_META_VEC) || 877 (item->type == PS_META_IMG) || (item->type == PS_META_HASH) || 878 (item->type == PS_META_LOOKUPTABLE) || (item->type == PS_META_JPEG) || 879 (item->type == PS_META_PNG) || (item->type == PS_META_ASTROM) || 880 (item->type == PS_META_UNKNOWN)) { 867 } else if (item->type == PS_META_STR) { 881 868 // + column name + _ + varchar( + length + ) 882 869 psStringAppend(&query, "%s VARCHAR(%s)", item->name, item->data.V); … … 884 871 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 885 872 "FIXME: Only type of PS_META_S32, PS_META_F32, PS_META_F64, " 886 "and PS_META_ * pointer typesare supported, (not %d).", item->type);873 "and PS_META_STR are supported, (not %d).", item->type); 887 874 888 875 psFree(query); … … 1268 1255 psDBAddToLookupTable(lookupTable, PS_TYPE_C64, "PS_TYPE_C64 is not supported"); 1269 1256 psDBAddToLookupTable(lookupTable, PS_TYPE_BOOL,"BOOLEAN"); 1270 psDBAddToLookupTable(lookupTable, PS_META_STR, " BLOB");1257 psDBAddToLookupTable(lookupTable, PS_META_STR, "VARCHAR"); 1271 1258 } 1272 1259 … … 1306 1293 while ((key = psListGetAndIncrement(cursor))) { 1307 1294 value = psHashLookup(psToSQLTable, key); 1308 if (!strcmp(value, "BLOB")) {1309 continue; // ignore reverse BLOB mapping, fill in below1310 }1311 1295 // switch key and value 1312 1296 psHashAdd(lookupTable, value, key); 1313 1297 } 1314 1298 1299 // Add BLOB & TEXT reverse mappings 1315 1300 value = psDBIntToString((psU64)PS_META_STR); 1316 psHashAdd(lookupTable, "VARCHAR", value);1317 1301 psHashAdd(lookupTable, "BLOB", value); 1318 1302 psHashAdd(lookupTable, "TEXT", value); -
trunk/psLib/src/db/psDB.c
r3671 r3849 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-0 4-06 01:12:58$14 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-05-05 21:11:39 $ 16 16 * 17 17 * Copyright 2005 Joshua Hoblitt, University of Hawaii … … 625 625 } else { 626 626 column = psDBSelectColumnNum(dbh, tableName, field[i].name, pType, 0); 627 if (pType == PS_META_S32) { 628 psMetadataAddS32(table, 0, field[i].name, "", (psS32)atoll(column)); 629 } else if (pType == PS_META_F32) { 630 psMetadataAddF32(table, 0, field[i].name, "", (psF32)atof(column)); 631 } else if (pType == PS_META_F64) { 632 psMetadataAddF64(table, 0, field[i].name, "", (psF64)atof(column)); 633 } 627 psMetadataAddVector(table, 0, field[i].name, "", column); 634 628 psFree(column); 635 629 } … … 814 808 // convert NaNs to NULL and set the buffer_length for strings 815 809 //} else if ((item->type == PS_META_STR) && (item->pType == PS_TYPE_PTR)) { 816 } else if ((item->type == PS_META_STR) || (item->type == PS_META_VEC) || 817 (item->type == PS_META_IMG) || (item->type == PS_META_HASH) || 818 (item->type == PS_META_LOOKUPTABLE) || (item->type == PS_META_JPEG) || 819 (item->type == PS_META_PNG) || (item->type == PS_META_ASTROM) || 820 (item->type == PS_META_UNKNOWN)) { 810 } else if (item->type == PS_META_STR) { 821 811 822 812 bind[i].buffer_length = (unsigned long)strlen((char *)item->data.V); … … 828 818 } else { 829 819 psError(PS_ERR_BAD_PARAMETER_TYPE , true, 830 "FIXME: Only type of PS_TYPE_S32, PS_TYPE_F32, PS_TYPE_F64, " 831 "and PS_TYPE_PTR are supported."); 820 "FIXME: Only type of PS_TYPE_S32 (PS_META_S32), " 821 "PS_TYPE_F32 (PS_META_F32), PS_TYPE_F64 (PS_META_F64), " 822 "and PS_META_STR are supported."); 832 823 833 824 psFree(cursor); … … 874 865 psStringAppend(&query, "%s %s", item->name, colType); 875 866 psFree(colType); 876 } else if ((item->type == PS_META_STR) || (item->type == PS_META_VEC) || 877 (item->type == PS_META_IMG) || (item->type == PS_META_HASH) || 878 (item->type == PS_META_LOOKUPTABLE) || (item->type == PS_META_JPEG) || 879 (item->type == PS_META_PNG) || (item->type == PS_META_ASTROM) || 880 (item->type == PS_META_UNKNOWN)) { 867 } else if (item->type == PS_META_STR) { 881 868 // + column name + _ + varchar( + length + ) 882 869 psStringAppend(&query, "%s VARCHAR(%s)", item->name, item->data.V); … … 884 871 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 885 872 "FIXME: Only type of PS_META_S32, PS_META_F32, PS_META_F64, " 886 "and PS_META_ * pointer typesare supported, (not %d).", item->type);873 "and PS_META_STR are supported, (not %d).", item->type); 887 874 888 875 psFree(query); … … 1268 1255 psDBAddToLookupTable(lookupTable, PS_TYPE_C64, "PS_TYPE_C64 is not supported"); 1269 1256 psDBAddToLookupTable(lookupTable, PS_TYPE_BOOL,"BOOLEAN"); 1270 psDBAddToLookupTable(lookupTable, PS_META_STR, " BLOB");1257 psDBAddToLookupTable(lookupTable, PS_META_STR, "VARCHAR"); 1271 1258 } 1272 1259 … … 1306 1293 while ((key = psListGetAndIncrement(cursor))) { 1307 1294 value = psHashLookup(psToSQLTable, key); 1308 if (!strcmp(value, "BLOB")) {1309 continue; // ignore reverse BLOB mapping, fill in below1310 }1311 1295 // switch key and value 1312 1296 psHashAdd(lookupTable, value, key); 1313 1297 } 1314 1298 1299 // Add BLOB & TEXT reverse mappings 1315 1300 value = psDBIntToString((psU64)PS_META_STR); 1316 psHashAdd(lookupTable, "VARCHAR", value);1317 1301 psHashAdd(lookupTable, "BLOB", value); 1318 1302 psHashAdd(lookupTable, "TEXT", value);
Note:
See TracChangeset
for help on using the changeset viewer.
