Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 4 of 4 total |
External Modules and functions |
Fri, Feb 8 2008 11:17 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
Prepare thyself for a deluge of questions - I'm starting my attempts to write a function in an external module. I thought I'd start with something simple (see below). In the dll the function is SpacelessCompare(const FldStr, CompStr: string): boolean; Initially I added it to EDBManager CREATE FUNCTION "SpaceLess" (IN "Fld" VARCHAR COLLATE ANSI, IN "Against" VARCHAR COLLATE ANSI) RETURNS BOOLEAN EXTERNAL NAME "nlhFunctions" and tried select * from companies where Spaceless(_Name,'A F N Ltd') - no rows returned, tried adding =True and =False to the end and still no result. Then thought "hmm I don't know what name gets passed so I'll set the name to the same one as in the dll and trying select * from companies where SpacelessCompare(_Name,'A F N Ltd') I get ElevateDB Error #202 An error occurred with the module nlhFunctions (Access violation at address 01A8A54F in module 'nlhFunctions.dll'. Read of address 00000030) Off now to add debugging code to my dll Roy Lambert unit nlhFuncs; interface uses SysUtils, Classes, DB, edbextmodule; type TEDBExternalModule1 = class(TEDBExternalModule) procedure EDBExternalModuleRoutine(const RoutineName: string); private { Private declarations } public { Public declarations } end; var EDBExternalModule1: TEDBExternalModule1; implementation {$R *.dfm} function SpacelessCompare(const FldStr, CompStr: string): boolean; begin Result := StringReplace(FldStr, ' ', '', [rfReplaceAll]) = StringReplace(CompStr, ' ', '', [rfReplaceAll]); end; procedure TEDBExternalModule1.EDBExternalModuleRoutine( const RoutineName: string); begin if LowerCase(RoutineName) = 'spacelesscompare' then Params.FindParam('Result').AsBoolean := SpacelessCompare(Params.FindParam('Phone').AsString, Params.FindParam('TestAgainst').AsString); end; end. |
Fri, Feb 8 2008 11:52 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | And just for a change - its me <vbg>. The function name has to match, and you need to get the parameter names right - makes sense.
Roy Lambert |
Fri, Feb 8 2008 12:55 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< And just for a change - its me <vbg>. The function name has to match, and you need to get the parameter names right - makes sense. >> So, the AV was in your code ? -- Tim Young Elevate Software www.elevatesoft.com |
Fri, Feb 8 2008 1:02 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
Yup, caused by trying to find a parameter that doesn't exist I think. eg Params.FindParam('Phone').AsString when I'm passing 'FldCmp'. I'm assuming this because the showmessages I added didn't enter the function itself. Roy Lambert |
This web page was last updated on Monday, April 29, 2024 at 05:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |