List:MySQL++« Previous MessageNext Message »
From:Bassam A. Al-Khaffaf Date:February 27 2007 9:59am
Subject:RE: How to overcome a runtime error when there is no matching in database
View as plain text  
I am sorry for the shortage of the provided information. However, a partial
code snippet is shown below, take note that the "attributesList" container
is always containing records:

------------------------------------------------------
Structures.h file contains the following SSQLS:

sql_create_5(_ATTRIBUTES_LIST, 2, 0,
			sql_smallint_unsigned, attribute_id,
			sql_int_unsigned, vendor_id,
			sql_varchar, vendor_name,
			sql_varchar, attribute_name,
			sql_smallint_unsigned, type_id);
------------------------------------------------------

Configurations.h files contains the following data members and member
functions:

#include "Structures.h"

Class Configurations.h
{
public:
   Configurations(Query *configurationsQuery, const bool *debugMode)
   {
	populateAttributesInformation(configurationsQuery, debugMode);
   }

   string getAttributeName(unsigned short attribute_id, unsigned short
vendor_id)
   {
      /////Run time error occurs in the following step when
      /////there is no match found. It is similar to the SQL
      /////command "SELECT attribute_name FROM attributes_tabel
      /////WHERE attribute_id = somevalue AND vendor_id = othervalue
      /////It has to return a NULL or zero when there is no data are
     ////// found.
      return attributesList.lower_bound(_ATTRIBUTES_LIST(attribute_id,
vendor_id))->attribute_name;
	
   }

private:
   static set<_ATTRIBUTES_LIST> attributesList;

   void populateAttributesInformation(Query *attributesQuery, const bool
*debugMode)
   {
	attributesQuery->reset();
	*attributesQuery << "SELECT a.attribute_id, a.vendor_id,
v.vendor_name, a.attribute_name, a.type_id\nFROM attributes_table AS a INNER
JOIN vendors_table AS v\nON a.vendor_id = v.vendor_id\nORDER BY a.vendor_id
ASC, a.attribute_id ASC";
	if (*debugMode)
	{
		cout << "\n\nQuerying Radius database for attributes data
and populate into memory" << endl << endl;
		cout << attributesQuery->preview() << endl << endl;
	}
	attributesQuery->storein(attributesList);
   }
};







-----Original Message-----
From: Warren Young [mailto:mysqlpp@stripped] 
Sent: Tuesday, February 27, 2007 5:15 PM
To: MySQL++ Mailing List
Subject: Re: How to overcome a runtime error when there is no matching in
database

Bassam A. Al-Khaffaf wrote:
> Your solution doesn't work with my case. The "attributeList" is always
fill
> with data, 

Please provide a more detailed example.  Ideally, it should compile and 
run against the MySQL++ sample database.

We don't even know what data type attributeList is, or how it gets 
filled.  It's awfully hard to guess at solutions with such limited 
information.

-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:
http://lists.mysql.com/plusplus?unsub=1

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.4/703 - Release Date: 2/26/2007
2:56 PM
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.4/703 - Release Date: 2/26/2007
2:56 PM
 

Thread
How to overcome a runtime error when there is no matching in databaseBassam A. Al-Khaffaf26 Feb
  • Re: How to overcome a runtime error when there is no matching indatabaseWarren Young27 Feb
    • RE: How to overcome a runtime error when there is no matching in databaseBassam A. Al-Khaffaf27 Feb
      • Re: How to overcome a runtime error when there is no matching indatabaseWarren Young27 Feb
        • RE: How to overcome a runtime error when there is no matching in databaseBassam A. Al-Khaffaf27 Feb
          • Re: How to overcome a runtime error when there is no matching indatabaseWarren Young28 Feb