IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 20, 2006, 10:57:51 AM (20 years ago)
Author:
Paul Price
Message:

Cause of problem in p0tool was found in psDB. psDBMySQLToPType was
looking for type "UNSIGNED BIGINT", while it's stored under "BIGINT
UNSIGNED" in the mysqlToSQLTable. Also note that since sqlType is a
value stored in a hash, it shouldn't be modified directly. Added a
fix to put "UNSIGNED" at the end of the string instead of the start,
and copy the string in the process.

File:
1 edited

Legend:

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

    r10044 r10108  
    1212 *  @author Joshua Hoblitt
    1313 *
    14  *  @version $Revision: 1.114 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-11-17 22:06:57 $
     14 *  @version $Revision: 1.115 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-11-20 20:57:51 $
    1616 *
    1717 *  Copyright (C) 2005-2006  Joshua Hoblitt, University of Hawaii
     
    17841784    char            *key;               // hash tmp value
    17851785    char            *value;             // hash tmp value
    1786     char            *sqlType;           // copy of lookup table result
     1786    psString        sqlType;            // copy of lookup table result
    17871787    psU32           pType;              // psElemType of a field
    17881788
     
    17911791    // lookup MySQL column type
    17921792    key     = psDBIntToString((psU64)type);
    1793     sqlType = psHashLookup(mysqlToSQLTable, key);
     1793    sqlType = psMemIncrRefCounter(psHashLookup(mysqlToSQLTable, key));
    17941794    psFree(key);
    17951795
     
    18041804    // mysql -> ascii -> ptype
    18051805    if (flags & UNSIGNED_FLAG) {
    1806         psStringPrepend(&sqlType, "UNSIGNED ");
    1807     }
    1808 
    1809     //psLogMsg( __func__, PS_LOG_INFO, "sqlType=[%s]\n", sqlType );
     1806        psString new = NULL;
     1807        psStringAppend(&new, "%s UNSIGNED", sqlType);
     1808        psFree(sqlType);
     1809        sqlType = new;
     1810    }
     1811
     1812    //psTrace("psLib.db", 9, "sqlType=[%s]\n", sqlType );
    18101813
    18111814    // convert MySQL type to PS type
     
    18141817
    18151818    if (!value) {
    1816         psError(PS_ERR_UNEXPECTED_NULL, true, "type lookup failed.");
    1817 
     1819        psError(PS_ERR_UNEXPECTED_NULL, true, "type lookup of %s failed.", sqlType);
     1820        psFree(sqlType);
    18181821        return 0;
    18191822    }
     1823    psFree(sqlType);
    18201824
    18211825    pType = (psU32)atol(value);
Note: See TracChangeset for help on using the changeset viewer.