| Author | Message | 
		
		  | matuwe | 
			  
				|  Posted: Fri Nov 16, 2012 12:52 am    Post subject: SHARED ROW CLEARING |   |  | 
		
		  |  Master
 
 
 Joined: 05 Dec 2007Posts: 296
 
 
 | 
			  
				| HI  I have followed the Routing sample and I am getting my data from database into a shared row variable. Next time I just read from shared row and not from Database. 
 My question is, if the data is changed on the databse I just refresh cache by setting my variable to null and reload from database, but the problem now is. My database table structure has changed. I keep on refreshing the cache but I do not get the new columns. The onlyway to resolve this was by renaming my variables and it worked.. But strange enough during debug I can still see the old variable name. Restarting the broker also didnt help. Is there any command I can run to clear all global variables..
 
 I tried restarting reload and setting the variable to null.
 
 
   
	| Code: |  
	| SET CacheEvents = NULL;
 
 also trid
 SET CacheEvents .valid = TRUE;
 
 |  
 
  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | visasimbu | 
			  
				|  Posted: Fri Nov 16, 2012 1:06 am    Post subject: |   |  | 
		
		  |  Disciple
 
 
 Joined: 06 Nov 2009Posts: 171
 
 
 | 
			  
				| Hi matuwe, 
 Row variable will hold more number of rows. So when you want to refresh introduce one more intemediate hirerachy like below.
 
 CacheEvents.temp.valid
 
 Here temp is intermediate hirerachy. Then try to set
 
 SET CacheEvents.temp = NULL;
 
 Try the above option.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | MBMQDeveloper | 
			  
				|  Posted: Fri Nov 16, 2012 1:07 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 02 Jul 2012Posts: 19
 
 
 | 
			  
				| When you say that the database structure has changed, do you mean the column names have also changed? If so, is the query being used in the code still valid? 
 Data would be fetched from database only if the query returns one.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | matuwe | 
			  
				|  Posted: Fri Nov 16, 2012 2:31 am    Post subject: |   |  | 
		
		  |  Master
 
 
 Joined: 05 Dec 2007Posts: 296
 
 
 | 
			  
				| Hi the database query is select * which is fine. Looking at the cache variable at runtime, I can see the new column being added. But the problem is when I then do a select from cache... The new columns don't show 
 
 
   
	| Code: |  
	| DECLARE CacheMessageCategory SHARED ROW;
 
 Load from DB
 SET CacheMessageCategory.DestinationData[] = PASSTHRU( 'SELECT T.* FROM V_MESSAGECATEGORY T ORDER BY  Datatype desc,PRIORITY,SEQUENCENO  desc,ITEM desc' );
 
 load  from Cache
 
 SET Environment.XML.Category.MechanismPROP[] = (SELECT * FROM CacheMessageCategory .DestinationData[] AS S                                             WHERE S.MESSAGECATEGORYID = InputRoot.XMLNSC.messageCategoryID);
 
 
 |  
 The problem is the new column is not showing on Environment.XML.Category.MechanismPROP[]
 
 Thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | visasimbu | 
			  
				|  Posted: Fri Nov 16, 2012 3:19 am    Post subject: |   |  | 
		
		  |  Disciple
 
 
 Joined: 06 Nov 2009Posts: 171
 
 
 | 
			  
				| Please try the below snippet. 
 
 
   
	| Code: |  
	| DECLARE CacheMessageCategory SHARED ROW; 
 clear the shared row
 SET CacheMessageCategory.InterMed = NULL;
 
 Load from DB
 SET CacheMessageCategory.InterMed.DestinationData[] = PASSTHRU( 'SELECT T.* FROM V_MESSAGECATEGORY T ORDER BY  Datatype desc,PRIORITY,SEQUENCENO  desc,ITEM desc' );
 
 clear the Environment variable
 SET Environment.XML.InterMed = NULL;
 
 
 load  from Cache
 
 SET Environment.XML.InterMed .Category.MechanismPROP[] = (SELECT * FROM CacheMessageCategory .DestinationData[] AS S                                             WHERE S.MESSAGECATEGORYID = InputRoot.XMLNSC.messageCategoryID);
 
 |  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | MBMQDeveloper | 
			  
				|  Posted: Sun Nov 18, 2012 10:03 pm    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 02 Jul 2012Posts: 19
 
 
 | 
			  
				| Can you confirm if the above suggestion has worked? |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | matuwe | 
			  
				|  Posted: Sun Nov 18, 2012 11:16 pm    Post subject: |   |  | 
		
		  |  Master
 
 
 Joined: 05 Dec 2007Posts: 296
 
 
 | 
			  
				| Hi 
 Thanks, I will try this right away.
 
 Thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |