Esempio n. 1
0
// Reads TSV line by line and extracts fields
Rows SheetReader::ParseTSV(std::string fname)
{
    Rows rows;

    std::ifstream file(fname);
    std::string line;

    std::string tab = "\t";

    while (std::getline(file, line))
    {
        rows.push_back(Rows::value_type());
        
        int tab_pos = -1; 
        int last_tab_pos = -1;

        do
        {
            last_tab_pos = tab_pos + 1;
            tab_pos = line.find(tab, tab_pos + 1);

            std::size_t start = last_tab_pos;
            std::size_t count = tab_pos - last_tab_pos;
            std::string field = line.substr(start, count);

            rows.back().push_back(field);
        }
        while (tab_pos != std::string::npos);

    }

    return std::move(rows);
}
Esempio n. 2
0
int isCitySaverZone(U8_t zoneId)
{
	if ( !g_citySaverZonesRetrieved )
	{
		DbAccess 	*m_dbAccess;
		Rows rows;

		m_dbAccess =  getDBAccess();
        
        if(m_dbAccess==NULL)
            return false;

		char s_query[200];
		sprintf(s_query, "SELECT logical FROM ZoneRecord where is_city_saver='true' AND %s", getCurrentCDVersionWhere());
		m_dbAccess->executeSqlQuery(s_query, rows);

		for ( Rows::iterator row = rows.begin(); row != rows.end(); row++ )
		{
			g_citySaverZones.insert(U8_t(atoi(row->begin()->second)));
		}

		g_citySaverZonesRetrieved = true;
	}

	if ( g_citySaverZones.find(zoneId) != g_citySaverZones.end() )
	{
		return true;
	}
    
	return false;
}
Esempio n. 3
0
YBORM_DECL ElementTree::ElementPtr
xmlize_rows(const Rows &rows, const String &entries_name, const String &entry_name)
{
    ElementTree::ElementPtr entries = ElementTree::new_element(entries_name);
    Rows::const_iterator it = rows.begin(), end = rows.end();
    for (; it != end; ++it)
        entries->children_.push_back(xmlize_row(*it, entry_name));
    return entries;
}
Esempio n. 4
0
void
DLargestCommonSubSequence::distributedInit() {
    

    // allocate storage for rows before
    int rowsToExportPerProc = (0 == chunkStride_%n_) ? chunkStride_/n_ :
                                                     chunkStride_/n_+1;  
    //std::cout << "rowsToExportPerProc "
    //          << rowsToExportPerProc << std::endl;

    for(int i = 0; i < rowsToExportPerProc; ++i) {
        Row curr;
        curr.resize(chunkLength_);
        over_.push_back(curr);
        bsp_push_reg(over_.back().data(), sizeof(int)*chunkLength_);
        //std::cout << "Proc " << id_ << 
        //                    " Last Row index " << i <<  " addr: ";
        //                std::cout << over_.back().data()
        //                    << std::endl << std::flush;
    }

    for(int i = 0; i < chunkStride_; ++i) {
        for(int j = 0; j < chunkStride_; ++j) {
            if(id_ != i % n_)
                continue;
            // allocate L 
            L_[getCPair(i,j)] = new int*[chunkLength_];
            for(int k = 0; k < chunkLength_; ++k) {
                L_[getCPair(i,j)][k] = new int [chunkLength_];
                memset(L_[getCPair(i,j)][k], 0, chunkLength_*sizeof(int));
            }

            //allocate chunks for lastRow
            if(i > 0) {
                L_[getCPair(i-1,j)] = new int*[chunkLength_];
                for(int k = 0; k < chunkLength_; ++k) {
                    if(k < chunkLength_-1) {
                        L_[getCPair(i-1,j)][k] = NULL;
                    } else {
                        L_[getCPair(i-1,j)][k] = new int[chunkLength_];
                        memset(L_[getCPair(i-1,j)][k],
                               0, chunkLength_*sizeof(int));
                    }
                }
            }
        }
    }
}
Esempio n. 5
0
File: main.cpp Progetto: CCJY/coliru
int main()
{
    std::vector<std::string> words = {
        "Hello", "from", "GCC", __VERSION__, "!"
    };
    
    
    Row row;
    //row["value"] = std::string("Hello");
    row["value"] = boost::optional<std::string>("Hello");
    
    Rows rows;
    rows.push_back(row);
    
    //std::cout << "row[\"value\"] " << boost::any_cast<std::string>( row["value"] ) << "\n";
    //std::cout << "rows[0][\"value\"] " << boost::any_cast<std::string>(  rows[0]["value"] ) << "\n";
    //std::cout << "row[\"value\"] " << row["value"] << "\n";
    //std::cout << "rows[0][\"value\"] " << rows[0]["value"] << "\n";
    
    boost::optional<std::string> blah = rows[0]["value"];
    
    
    std::cout << words << std::endl;
}
Esempio n. 6
0
int getLinesByStation(U16_t stationId, MYKI_CD_LinesByStation_t &linesByStation, MYKI_CD_U16Array_t &lines)
{
    int returnValue=false;
    bool isNull=false;

    LinesByStationItem cacheItem;
    if (g_linesByStationCache.getCacheValue(stationId, cacheItem, isNull))
    {
        if ( !isNull )
        {
            linesByStation = cacheItem.linesByStation;
            lines = cacheItem.lines;
        }
        returnValue = !isNull;
        CsDebug(CD_DEBUG, (CD_DEBUG, "MYKI_CD:getLinesByStation: Return Cache lines by station record found for id %d.", int(stationId)));
    }
    else
    {
        DbAccess 	*m_dbAccess;

        Rows rows;

        m_dbAccess =  getDBAccess();
        if(m_dbAccess==NULL)
            return false;
        char s_query[256];
        sprintf(s_query, "SELECT line FROM StationLineRecord WHERE station='%d' AND %s ORDER BY line ASC", int(stationId), getCurrentCDVersionWhere());

        m_dbAccess->executeSqlQuery(s_query, rows);

        Rows::const_iterator itr;

        lines.arraySize = rows.size();
        if (lines.arraySize > 0)
            lines.arrayOfU16 = (U16_t*)malloc(int(lines.arraySize) * sizeof(U16_t));
        else
            lines.arrayOfU16 = NULL;
        linesByStation.station = stationId;

        int i = 0;
        for(itr = rows.begin(); itr != rows.end(); ++itr) {
            const ColumnValue& cv = *itr;
            lines.arrayOfU16[i]=convertStringToU16(cv["line"]);
            i++;
        }

        // TEST: Print out results
        if(rows.empty())
        {
            //std::cout << "\nNo Station record found for Station id " << stationId <<".\n";
            CsDebug(CD_DEBUG, (CD_DEBUG, "MYKI_CD:getServiceProviders: No Station record found for Station id %d.", stationId));
        }
        else
        {
            returnValue = true;
            //printStationLinesMap(rows);
            //testPrintLinesByStationResult(stationId, linesByStation, lines);
        }
        cacheItem.linesByStation = linesByStation;
        cacheItem.lines = lines;
        g_linesByStationCache.addCacheValue(stationId, cacheItem, !returnValue);
    }

    return returnValue;
}
Esempio n. 7
0
int  getStationsByLine(U16_t lineId, MYKI_CD_StationsByLine_t &stationsByLine, MYKI_CD_U16Array_t &stations)
{
    int returnValue=false;
    bool isNull=false;

    StationsByLineItem cacheItem;
    if (g_stationsByLineCache.getCacheValue(lineId, cacheItem, isNull))
    {
        if (!isNull)
        {
            stationsByLine = cacheItem.stationsByLine;
            stations = cacheItem.stations;
        }
        returnValue = !isNull;
        CsDebug(CD_DEBUG, (CD_DEBUG, "MYKI_CD:getStationsByLine: Return Cache stations by line record found for id %d.", int(lineId)));
    }
    else
    {
        DbAccess 	*m_dbAccess=NULL;

        Rows rows;

        m_dbAccess =  getDBAccess();
        if(m_dbAccess==NULL)
            return false;
        char s_query[256];
        sprintf(s_query, "SELECT station FROM StationLineRecord WHERE line='%d' AND %s ORDER BY station DESC", int(lineId), getCurrentCDVersionWhere());

        m_dbAccess->executeSqlQuery(s_query, rows);

        Rows::const_iterator itr;

        stations.arraySize = rows.size();
        if (stations.arraySize > 0)
            stations.arrayOfU16 = (U16_t*)malloc(int(stations.arraySize) * sizeof(U16_t));
        else
            stations.arrayOfU16 = NULL;
        stationsByLine.line = lineId;

        int i = 0;
        for(itr = rows.begin(); itr != rows.end(); ++itr) {
            const ColumnValue& cv = *itr;
            stations.arrayOfU16[i]=convertStringToU16(cv["station"]);
            i++;
        }

        // TEST: Print out results
        if(rows.empty())
        {
            //std::cout << "\nNo Line record found for Line id " << lineId <<".\n";
            CsDebug(CD_DEBUG, (CD_DEBUG, "MYKI_CD:getStationsByLine: No Line record found for Line id %d.", lineId));
        }
        else
        {
            returnValue=true;
            //printStationLinesMap(rows);
            //testPrintStationsByLineResult(lineId, stationsByLine, stations);
        }
        cacheItem.stationsByLine = stationsByLine;
        cacheItem.stations = stations;
        g_stationsByLineCache.addCacheValue(lineId, cacheItem, !returnValue);
    }

    return returnValue;
}
Esempio n. 8
0
    /**
     *  @brief  Retrieves saleable product details given search
     *          criteria.
     *  This (C++) function returns saleable product details that
     *  satisfy the specified search criteria.
     *  @note   Products with product price of zero are excluded
     *          from the saleable product list.
     *  @param  products returned Json:Value object containing
     *          saleable product details. The returned JSON object
     *          has the following format,
     *  @code
     *  {
     *    "products":
     *    [
     *      {
     *        "GSTApplicable":false,
     *        "PLU":"4. myki Child",
     *        "Price":50,
     *        "id":46,
     *        "issuer_id":1,
     *        "long_desc":"GTS Timetable",
     *        "short_desc":"GTS Timetable",
     *        "subtype":"None",
     *        "type":"ThirdParty"
     *      },
     *      { ... },
     *      null
     *    ]
     *  }
     *  @endcode
     *  where,
     *  @li     @c id is the product id (1-255).
     *  @li     @c issuer_id is the product issuer/owner id.
     *  @li     @c type is the product type, eg. "ThirdParty", "PremiumSurcharge".
     *  @li     @c subtype is the product sub-type, eg. "None".
     *  @li     @c long_desc is the product long description.
     *  @li     @c short_desc is the product short description.
     *  @li     @c Price is the product price in lowest denomination (cents).
     *  @li     @c GSTApplicable is true if GTS is applicable, false otherwise.
     *  @li     @c PLU is (optional) 'Price Lookup Unit' uniquely identifies product.
     *  @param  zone zone to validate against sales zones.
     *  @param  productType product type to search for (eg. "ThirdParty").
     *  @param  time time to validate against.
     *  @param  serviceProviderId service provider id.
     *  @param  deviceType device type (eg. "BDC").
     *  @return true if successful; false otherwise.
     */
int
getProducts(
    Json::Value    &products,
    int             zone,
    const char     *productType,
    Time_t          time,
    int             serviceProviderId,
    const char     *deviceType )
{
    #define MYKI_CD_DOW_SUNDAY      7

    int             returnValue     = false;
    DateC19_t       date            = 0;
    int             dayOfWeek       = 0;
    Time_t          timeHHMM        = 2400;
    struct tm       localTm         = { 0 };

    CsDbg( CD_DEBUG, "MYKI_CD:getProducts" );

    if ( time == TIME_NOT_SET )
    {
        CsErrx( "MYKI_CD:getProducts : time not set" );
        return  false;
    }

    /*  Creates an empty "products" array */
    products[ "products" ]  = Json::Value( Json::arrayValue );

    localtime_r( (time_t*)&time, &localTm );
    date        = mkdate( &localTm );
    dayOfWeek   = ( localTm.tm_wday == 0 /*SUNDAY*/ ? MYKI_CD_DOW_SUNDAY : localTm.tm_wday );
    timeHHMM    = ( localTm.tm_hour * 100 ) + localTm.tm_min;

    try
    {
        std::stringstream   query1;
        std::string         query;
        const char         *pQuery          = NULL;
        Rows                productRecords;
        DbAccess           *m_dbAccess      = getDBAccess();

        if ( m_dbAccess == NULL )
        {
            /*  Failed opening Tariff database */
            throw   __LINE__;
        }

        /*  Retrieves all products matching given product type */
        query1  << "SELECT  * "
                   "FROM    ProductRecord "
                   "WHERE   ProductRecord.fk_major_version= " << getCurrentCDMajorVersion() << " "
                       "AND ProductRecord.fk_minor_version= " << getCurrentCDMinorVersion() << " ";
        if ( productType != NULL )
        {
            query1  << "AND ProductRecord.type LIKE '" << productType << "' ";
        }
        query   = query1.str();
        pQuery  = query.c_str();
        if ( m_dbAccess->executeSqlQuery( pQuery, productRecords ) != SQLITE_OK )
        {
            /*  Failed executing query */
            throw   __LINE__;
        }

        for ( Rows::const_iterator itrProduct = productRecords.begin();
                itrProduct != productRecords.end();
                ++itrProduct )
        {
            const ColumnValue  &productRecord           = *itrProduct;
            std::string         productPK               = productRecord[ "PrimaryKey" ];
            std::string         productType             = productRecord[ "type"       ];
            std::stringstream   query2;
            Rows                attrRecords;
            bool                allowSalesChannel       = false;
            bool                allowServiceProvider    = false;
            bool                allowStartDate          = productType == "ThirdParty" ? true : false;
            bool                allowEndDate            = productType == "ThirdParty" ? true : false;
            bool                allowDayOfWeek          = false;
            bool                allowTime               = false;
            bool                allowSaleZone           = false;
            std::string         PLU;
            U32_t               productPrice            = 0;
            bool                GSTApplicable           = false;

            /*  Retrieves all default and specific attribute name/value pairs */
            query2  << "SELECT      1 AS is_default, name, value "
                       "FROM        ProductDefaultAttribute "
                       "WHERE       ProductDefaultAttribute.FK_ProductRecord=" << productPK << " "
                       "UNION "
                       "SELECT      0 AS is_default, name, value "
                       "FROM        ProductAttribute "
                       "WHERE       ProductAttribute.FK_ProductRecord=" << productPK << " "
                       "ORDER   BY  name, is_default DESC ";
            query   = query2.str();
            pQuery  = query.c_str();
            if ( m_dbAccess->executeSqlQuery( pQuery, attrRecords ) != SQLITE_OK )
            {
                /*  Failed executing query */
                throw   __LINE__;
            }

            /*  Performs validity check on saleable product */
            for ( Rows::const_iterator itrAttr = attrRecords.begin();
                    itrAttr != attrRecords.end();
                    ++itrAttr )
            {
                const ColumnValue  &attrRecord  = *itrAttr;
                std::string         attrName    = attrRecord[ "name"  ];
                std::string         attrValue   = attrRecord[ "value" ];
                const char         *pAttrName   = attrName.c_str();
                const char         *pAttrValue  = attrValue.c_str();

                if      ( attrName == "SalesChannel"    )   { checkProductIncluded(          allowSalesChannel,    deviceType,        attrValue ); }
                else if ( attrName == "ServiceProvider" )   { checkProductIncluded(          allowServiceProvider, serviceProviderId, attrValue ); }
                else if ( attrName == "SalesZone"       )   { checkProductIncluded(          allowSaleZone,        zone,              attrValue ); }
                else if ( attrName == "StartDate"       )   { checkProductIncludedStartDate( allowStartDate,       date,              attrValue ); }
                else if ( attrName == "EndDate"         )   { checkProductIncludedEndDate(   allowEndDate,         date,              attrValue ); }
                else if ( attrName == "DayOfWeek"       )   { checkProductIncluded(          allowDayOfWeek,       dayOfWeek,         attrValue ); }
                else if ( attrName == "TimeOfDay"       )   { checkProductIncludedTime(      allowTime,            timeHHMM,          attrValue ); }
                else if ( attrName == "PLU"             )   { PLU           =                                                         attrValue  ; }
                else if ( attrName == "Price"           )   { productPrice  = convertStringToU32(                                     attrValue ); }
                else if ( attrName == "GSTApplicable"   )   { GSTApplicable = convertStringToBool(                                    attrValue ); }
            }

            if      ( allowSalesChannel    == false ) { CsDbg( CD_DEBUG, "MYKI_CD:getProducts : excluded device type"       ); }
            else if ( allowServiceProvider == false ) { CsDbg( CD_DEBUG, "MYKI_CD:getProducts : excluded service provider"  ); }
            else if ( allowSaleZone        == false ) { CsDbg( CD_DEBUG, "MYKI_CD:getProducts : excluded sales zone"        ); }
            else if ( allowStartDate       == false ) { CsDbg( CD_DEBUG, "MYKI_CD:getProducts : not yet available"          ); }
            else if ( allowEndDate         == false ) { CsDbg( CD_DEBUG, "MYKI_CD:getProducts : no longer available"        ); }
            else if ( allowDayOfWeek       == false ) { CsDbg( CD_DEBUG, "MYKI_CD:getProducts : not available on this day"  ); }
            else if ( allowTime            == false ) { CsDbg( CD_DEBUG, "MYKI_CD:getProducts : not available at this time" ); }
            else if ( productPrice         == 0     ) { CsDbg( CD_DEBUG, "MYKI_CD:getProducts : zero product price"         ); }
            else
            {
                Json::Value     productValue;
                std::string     productId           = productRecord[ "id" ];
                std::string     productShortDesc    = productRecord[ "short_desc" ];

                CsDbg( CD_DEBUG, "MYKI_CD:getProducts : Add '%d-%s'",
                        productId.c_str(),
                        productShortDesc.c_str() );

                /*  Creates saleable product object */
                productValue[ "id"            ] = convertStringToU32( productRecord[ "id"        ] );
                productValue[ "issuer_id"     ] = convertStringToU32( productRecord[ "issuer_id" ] );
                productValue[ "type"          ] = productRecord[ "type"       ];
                productValue[ "subtype"       ] = productRecord[ "subtype"    ];
                productValue[ "short_desc"    ] = productRecord[ "short_desc" ];
                productValue[ "long_desc"     ] = productRecord[ "long_desc"  ];
                if ( PLU.empty() == false )
                {
                    productValue[ "PLU"       ] = PLU;
                }
                productValue[ "Price"         ] = productPrice;
                productValue[ "GSTApplicable" ] = GSTApplicable;

                /*  And adds to saleable product list */
                products[ "products" ].append( productValue );
            }
        }
        returnValue = true;
    }
    catch ( int e )
    {
        /*  Failed accessing Tariff database */
        returnValue = false;
    }

    CsDbg( CD_DEBUG, "MYKI_CD:getProducts returns %s", returnValue == false ? "FALSE" : "TRUE" );
    return  returnValue;
}
Esempio n. 9
0
int processProductsSubtableXML(pugi::xpath_node node, int recordPK, std::vector<int>& subtablePKs)
{
	DbAccess* m_dbAccess = getDBAccess();
    if(m_dbAccess==NULL)
        return 2;      
	int ret = 0;

	// Get the Attribute Element Child belonging to each Record
	bool needPrimaryKeys = false;
	if (subtablePKs.empty())
	{
		needPrimaryKeys = true;
		subtablePKs.push_back(0);
		subtablePKs.push_back(0);
	}
	int& attributePK = subtablePKs[0];
	int& defaultAttributePK = subtablePKs[1];
	if (needPrimaryKeys)
	{
		Rows rows;
		m_dbAccess->executeSqlQuery("SELECT MAX(PrimaryKey) AS PrimaryKey FROM ProductAttribute", rows);
		if (!rows.empty())
			attributePK = convertStringToU32(rows.front()["PrimaryKey"]);
		rows.clear();
		m_dbAccess->executeSqlQuery("SELECT MAX(PrimaryKey) AS PrimaryKey FROM ProductDefaultAttribute", rows);
		if (!rows.empty())
			defaultAttributePK = convertStringToU32(rows.front()["PrimaryKey"]);
	}

	for (pugi::xml_node tool = node.node().first_child(); tool; tool = tool.next_sibling())
	{
		std::string childName(tool.name());

		if (childName.compare("Attribute") == 0)
		{
			std::string s_queryAttribute = "";
			std::string s_queryColumn = "";
			std::string s_queryValue = "";

			attributePK++;
			int attributeCount = 0;
			for (pugi::xml_attribute attr = tool.first_attribute(); attr; attr = attr.next_attribute())
			{
				if(attributeCount > 0)
				{
					s_queryColumn += ",";
					s_queryValue += ",";
				}
				s_queryColumn.append("'");
				s_queryColumn += attr.name();
				s_queryColumn.append("'");
				s_queryValue += sqlify(attr.value());
				attributeCount++;
			}
			s_queryAttribute = "INSERT INTO ProductAttribute('PrimaryKey',";
			s_queryAttribute += s_queryColumn;
			s_queryAttribute += ",'FK_ProductRecord') VALUES ('";
			s_queryAttribute += static_cast<std::ostringstream*>( &(std::ostringstream() << attributePK) )->str(); // PK for Device Parameter Attribute
			s_queryAttribute += "',";
			s_queryAttribute += s_queryValue;
			s_queryAttribute += ",'";
			s_queryAttribute += static_cast<std::ostringstream*>( &(std::ostringstream() << recordPK) )->str(); // FK to Device Parameter Record
			s_queryAttribute += "'";
			s_queryAttribute += ")";

			// std::cout << "\n" << s_queryDeviceParameterAttribute;
		    if ( m_dbAccess->executeSqlInsert(s_queryAttribute) != 0 )
			{
				CsErrx("Query '%s' failed", s_queryAttribute.c_str());
				ret = 2;
			}
		}
		else if (childName.compare("DefaultAttribute") == 0)
		{
			std::string s_queryDefaultAttribute = "";
			std::string s_queryColumn = "";
			std::string s_queryValue = "";

			defaultAttributePK++;
			int attributeCount = 0;
			for (pugi::xml_attribute attr = tool.first_attribute(); attr; attr = attr.next_attribute())
			{
				if(attributeCount > 0)
				{
					s_queryColumn += ",";
					s_queryValue += ",";
				}
				s_queryColumn.append("'");
				s_queryColumn += attr.name();
				s_queryColumn.append("'");
				s_queryValue += sqlify(attr.value());
				attributeCount++;
			}
			s_queryDefaultAttribute = "INSERT INTO ProductDefaultAttribute('PrimaryKey',";
			s_queryDefaultAttribute += s_queryColumn;
			s_queryDefaultAttribute += ",'FK_ProductRecord') VALUES ('";
			s_queryDefaultAttribute += static_cast<std::ostringstream*>( &(std::ostringstream() << defaultAttributePK) )->str(); // PK for Device Parameter Attribute
			s_queryDefaultAttribute += "',";
			s_queryDefaultAttribute += s_queryValue;
			s_queryDefaultAttribute += ",'";
			s_queryDefaultAttribute += static_cast<std::ostringstream*>( &(std::ostringstream() << recordPK) )->str(); // FK to Device Parameter Record
			s_queryDefaultAttribute += "'";
			s_queryDefaultAttribute += ")";

			// std::cout << "\n" << s_queryDeviceParameterAttribute;
		    if ( m_dbAccess->executeSqlInsert(s_queryDefaultAttribute) != 0 )
			{
				CsErrx("Query '%s' failed", s_queryDefaultAttribute.c_str());
				ret = 2;
			}
		}
	}

	return ret;
}
Esempio n. 10
0
int getProduct(U8_t id, MYKI_CD_Product_t &product)
{
    int returnValue=false;
	DbAccess 	*m_dbAccess;
	Rows rows;
    
    CsDebug(CD_DEBUG, (CD_DEBUG, "MYKI_CD:getProduct %d", id));

	bool isNull = false;
    if(g_productCache.getCacheValue(id, product, isNull))
    {
        returnValue = !isNull;
		CsDebug(CD_DEBUG, (CD_DEBUG, "MYKI_CD:getProduct: Return Cache Product record found for id %d.", int(id)));
    }
	else
    {    
        m_dbAccess =  getDBAccess();
        if(m_dbAccess==NULL)
            return false;  
        char s_query[200];
        sprintf(s_query, "SELECT * FROM ProductRecord WHERE id='%d' AND %s", int(id), getCurrentCDVersionWhere());

        m_dbAccess->executeSqlQuery(s_query, rows);

        Rows::const_iterator itr1;
        for(itr1 = rows.begin(); itr1 != rows.end(); ++itr1){
            const ColumnValue& cv = *itr1;
            product.issuer_id = convertStringToU8(cv["issuer_id"]);
            product.id = convertStringToU8(cv["id"]);
            stringCopy(product.type, cv["type"], LEN_20_t);
            stringCopy(product.subtype, cv["subtype"], LEN_20_t);
            stringCopy(product.short_desc, cv["short_desc"], LEN_Short_Description_t);
            stringCopy(product.long_desc, cv["long_desc"], LEN_Long_Description_t);
        }



        // TEST: Print out results
        if(rows.empty())
        {
            //std::cout << "\nNo Product record found for id " << (int)id <<".\n";
            CsDebug(CD_DEBUG, (CD_DEBUG, "MYKI_CD:getProduct %d - no product exists", id));
        }
        else
        {
            CsDebug(CD_DEBUG, (CD_DEBUG, "MYKI_CD:getProduct %d - Get Attributes", id));
            // Get the product default attributes             // Get the product attributes
/*            if(getProductDefaultAttribute(id, product) && getProductAttribute(id, product))
            {
                CsDebug(CD_DEBUG, (CD_DEBUG, "MYKI_CD:getProduct %d - Return true", id));
                returnValue = true;
                //printProductMap(rows);
                //testPrintProductResult(id, product);
            }*/
            returnValue = true;
        }
        g_productCache.addCacheValue(id, product, !returnValue);
    }
    
    return returnValue;
}