IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3849


Ignore:
Timestamp:
May 5, 2005, 11:11:39 AM (21 years ago)
Author:
asc
Message:

bugfix 344, 345, 346

Location:
trunk/psLib/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataIO/psDB.c

    r3671 r3849  
    1212 *  @author Joshua Hoblitt
    1313 *
    14  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-04-06 01:12:58 $
     14 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-05-05 21:11:39 $
    1616 *
    1717 *  Copyright 2005 Joshua Hoblitt, University of Hawaii
     
    625625        } else {
    626626            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);
    634628            psFree(column);
    635629        }
     
    814808            // convert NaNs to NULL and set the buffer_length for strings
    815809            //} 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) {
    821811
    822812            bind[i].buffer_length = (unsigned long)strlen((char *)item->data.V);
     
    828818        } else {
    829819            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.");
    832823
    833824            psFree(cursor);
     
    874865            psStringAppend(&query, "%s %s", item->name, colType);
    875866            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) {
    881868            // + column name + _ + varchar( + length + )
    882869            psStringAppend(&query, "%s VARCHAR(%s)", item->name, item->data.V);
     
    884871            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    885872                    "FIXME: Only type of PS_META_S32, PS_META_F32, PS_META_F64, "
    886                     "and PS_META_* pointer types are supported, (not %d).", item->type);
     873                    "and PS_META_STR are supported, (not %d).", item->type);
    887874
    888875            psFree(query);
     
    12681255        psDBAddToLookupTable(lookupTable, PS_TYPE_C64, "PS_TYPE_C64 is not supported");
    12691256        psDBAddToLookupTable(lookupTable, PS_TYPE_BOOL,"BOOLEAN");
    1270         psDBAddToLookupTable(lookupTable, PS_META_STR, "BLOB");
     1257        psDBAddToLookupTable(lookupTable, PS_META_STR, "VARCHAR");
    12711258    }
    12721259
     
    13061293        while ((key = psListGetAndIncrement(cursor))) {
    13071294            value = psHashLookup(psToSQLTable, key);
    1308             if (!strcmp(value, "BLOB")) {
    1309                 continue; // ignore reverse BLOB mapping, fill in below
    1310             }
    13111295            // switch key and value
    13121296            psHashAdd(lookupTable, value, key);
    13131297        }
    13141298
     1299        // Add BLOB & TEXT reverse mappings
    13151300        value = psDBIntToString((psU64)PS_META_STR);
    1316         psHashAdd(lookupTable, "VARCHAR", value);
    13171301        psHashAdd(lookupTable, "BLOB",    value);
    13181302        psHashAdd(lookupTable, "TEXT",    value);
  • trunk/psLib/src/db/psDB.c

    r3671 r3849  
    1212 *  @author Joshua Hoblitt
    1313 *
    14  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-04-06 01:12:58 $
     14 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-05-05 21:11:39 $
    1616 *
    1717 *  Copyright 2005 Joshua Hoblitt, University of Hawaii
     
    625625        } else {
    626626            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);
    634628            psFree(column);
    635629        }
     
    814808            // convert NaNs to NULL and set the buffer_length for strings
    815809            //} 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) {
    821811
    822812            bind[i].buffer_length = (unsigned long)strlen((char *)item->data.V);
     
    828818        } else {
    829819            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.");
    832823
    833824            psFree(cursor);
     
    874865            psStringAppend(&query, "%s %s", item->name, colType);
    875866            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) {
    881868            // + column name + _ + varchar( + length + )
    882869            psStringAppend(&query, "%s VARCHAR(%s)", item->name, item->data.V);
     
    884871            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    885872                    "FIXME: Only type of PS_META_S32, PS_META_F32, PS_META_F64, "
    886                     "and PS_META_* pointer types are supported, (not %d).", item->type);
     873                    "and PS_META_STR are supported, (not %d).", item->type);
    887874
    888875            psFree(query);
     
    12681255        psDBAddToLookupTable(lookupTable, PS_TYPE_C64, "PS_TYPE_C64 is not supported");
    12691256        psDBAddToLookupTable(lookupTable, PS_TYPE_BOOL,"BOOLEAN");
    1270         psDBAddToLookupTable(lookupTable, PS_META_STR, "BLOB");
     1257        psDBAddToLookupTable(lookupTable, PS_META_STR, "VARCHAR");
    12711258    }
    12721259
     
    13061293        while ((key = psListGetAndIncrement(cursor))) {
    13071294            value = psHashLookup(psToSQLTable, key);
    1308             if (!strcmp(value, "BLOB")) {
    1309                 continue; // ignore reverse BLOB mapping, fill in below
    1310             }
    13111295            // switch key and value
    13121296            psHashAdd(lookupTable, value, key);
    13131297        }
    13141298
     1299        // Add BLOB & TEXT reverse mappings
    13151300        value = psDBIntToString((psU64)PS_META_STR);
    1316         psHashAdd(lookupTable, "VARCHAR", value);
    13171301        psHashAdd(lookupTable, "BLOB",    value);
    13181302        psHashAdd(lookupTable, "TEXT",    value);
Note: See TracChangeset for help on using the changeset viewer.