User Defined Routine (UDR) example required - OSAD Array
Posted in 2020
Hugo Zambrano needed an example C UDR to implement Optimal String Alignment Distance with a 121 by 121 array on Informix 12.1. Andreas Legner pointed to the demo/checksum example, Hal Maner offered Java UDR material. Hugo fixed crashes by registering with STACK=65536, PARALLELIZABLE and HANDLESNULLS, and tested thousands of rows without problems.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: Stored Procedures & SPL
I need your guidance, please. I am looking for an example code for a User Define Routine (UDR) made in C or C++ in order for me to create one to be used in stored procedures and SQL statements. I've found none in the internet and none in github. I need to implement the Optimal String Alignment Distance (osad) routine that even though is a small routine, it requires to create a 121 by 121 array of integers. I am desperate to find an example so I can achieve my work task that seems almost impossible without that routine. Any help or guidance is greatly appreciated. We are using Informix 12.1 at work. ------------------------------ Hugo Zambrano zambranoh@ottawapolice.ca hugoezam@yahoo.com ------------------------------ #Informix
Look for Jacques Le Roy book on EBay - it will tell you everything you need If you can't find it ping me and I dig out the ISBN Cheers Paul Paul Watson Oninit LLC +1-913-387-7529 www.oninit.com Oninit® is a registered trademark of Oninit LLC ------Original Message------ I need your guidance, please. I am looking for an example code for a User Define Routine (UDR) made in C or C++ in order for me to create one to be used in stored procedures and SQL statements. I've found none in the internet and none in github. I need to implement the Optimal String Alignment Distance (osad) routine that even though is a small routine, it requires to create a 121 by 121 array of integers. I am desperate to find an example so I can achieve my work task that seems almost impossible without that routine. Any help or guidance is greatly appreciated. We are using Informix 12.1 at work. ------------------------------ Hugo Zambrano zambranoh@ottawapolice.ca hugoezam@yahoo.com ------------------------------ #Informix
Maybe what's in $INFORMIXDIR/demo/checksum can serve as a template for what you'd like to achieve? ------------------------------ Andreas Legner ------------------------------
Thank Andreas for your answer. I did not realized there was already an example quite close to me in the informixdir. I'll check it out and work from there. Thanks a lot. I will leave this Thread open in case I have problems. ------------------------------ [Zambrano] [Hugo] [Informix DBA] [Ottawa Police] [Ottawa] [ON] [(613)236-1222, 5575] ------------------------------
Not C++ but, Java UDR examples, I have some. I attached a presentation of mine. Spent quite a bit of time writing Java UDR's in Informix in the last decade. Jean Georges Perrin and I also had a more in depth version of my presentation in IBM Developerworks but after a brief search I could not find it – if I can, I will send that link also. Good luck with this powerful feature! Hal Maner M Systems International, Inc. ------Original Message------ Thank Andreas for your answer. I did not realized there was already an example quite close to me in the informixdir. I'll check it out and work from there. Thanks a lot. I will leave this Thread open in case I have problems. ------------------------------ [Zambrano] [Hugo] [Informix DBA] [Ottawa Police] [Ottawa] [ON] [(613)236-1222, 5575] ------------------------------ #Informix
Hi Paul, I just changed the FUNCTION registration adding STACK=65536 and PARALLELIZABLE (I remember you suggested that in an email), and I am also now running the SQL statement after ISOLATION DIRTY READ as I had the filling the engine is trying to put that huge SELECT as a transaction and perhaps filling up the physical log. So far is good, but it is too soon to sing victory. WITH (HANDLESNULLS, PARALLELIZABLE, STACK=65536) Update: All indicates that adding a size to the stack using STACK=65536 did the job. I just finished testing the osad UDR with this option for thousands of records and the engine did not complained. The option PARALLELIZABLE may have helped to speeded up. and since the routine handles null I included that flag too. I want to thanks all of you, and specially Paul Watson, for your tips and help. -- Hugo ------Original Message------ I need your guidance, please. I am looking for an example code for a User Define Routine (UDR) made in C or C++ in order for me to create one to be used in stored procedures and SQL statements. I've found none in the internet and none in github. I need to implement the Optimal String Alignment Distance (osad) routine that even though is a small routine, it requires to create a 121 by 121 array of integers. I am desperate to find an example so I can achieve my work task that seems almost impossible without that routine. Any help or guidance is greatly appreciated. We are using Informix 12.1 at work. ------------------------------ Hugo Zambrano zambranoh@ottawapolice.ca hugoezam@yahoo.com ------------------------------ #Informix
Select as a transaction sounds weird, unless your default ISO level is ANSI or repeatable read ? Anyway you look to be on the right path Crossing fingers .... Eric Vercelletto Data Management Architect and Owner / Begooden IT Consulting Board of Directors, International Informix Users group IBM Champion 2013,2014,2015,2016,2017,2018,2019,2020 Tel: +33(0) 298 51 3210 Mob : +33(0)626 52 50 68 skype: begooden-it Google Hangout: eric.vercelletto@begooden-it.com Email: eric.vercelletto@begooden-it.com www : http://www.vercelletto.com www https://kandooerp.org ------Original Message------ Hi Paul, I just changed the FUNCTION registration adding STACK=65536 and PARALLELIZABLE (I remember you suggested that in an email), and I am also now running the SQL statement after ISOLATION DIRTY READ as I had the filling the engine is trying to put that huge SELECT as a transaction and perhaps filling up the physical log. So far is good, but it is too soon to sing victory. WITH (HANDLESNULLS, PARALLELIZABLE, STACK=65536) -- Hugo #Informix