[firebird-support] UDF written in Visual Studio C giving "malformed string" on accents in characters
I have a UDF that needs to takes a couple of CSTRING(255) arguments and returns CSTRING(8000), but it needs to be able to handle accented characters like in French.. The UDF is written in C and compiled in MS Visual Studio, using the normal "char" character type. I tried changing that to wchar_t but that just completely broke it - you could call it successfully, but the result was wrong. (I also changed the data type definitions in the external function declaration when I did that to "CSTRING(len) CHARACTER SET UTF8" but that didn't help.) Any suggestions of how to change the C code and/or the compiler options and/or the external function declaration to make this all work? Our DB is all UTF8 data, though in fact that UDF doesn't access the data in the DB. Thank you.
Re: [firebird-support] udf dll
Stackoverflow.com ;-) but do you think that it's time to upgrade? Regards,Karol Bieniaszewski Oryginalna wiadomość Od: "Robert Tulloch tult...@hughes.net [firebird-support]" Data: 12.12.2018 21:34 (GMT+01:00) Do: firebird-support@yahoogroups.com Temat: Re: [firebird-support] udf dll On 12/12/2018 2:04 PM, Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: 12.12.2018 19:26, Robert Tulloch tult...@hughes.net [firebird-support] wrote: Not using firebird at all. In this case you are in wrong support list. There is no other support list
Re: [firebird-support] udf dll
On 12/12/2018 2:04 PM, Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: 12.12.2018 19:26, Robert Tulloch tult...@hughes.net [firebird-support] wrote: Not using firebird at all. In this case you are in wrong support list. There is no other support list
Re: [firebird-support] udf dll
On 12/12/2018 2:04 PM, Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: 12.12.2018 19:26, Robert Tulloch tult...@hughes.net [firebird-support] wrote: Not using firebird at all. In this case you are in wrong support list. Hi: Never mind the dll/udf Statement: SELECT cast (RDB$RELATION_NAME as varchar(32)) AS TABLE_NAME,cast (RDB$INDEX_NAME as varchar(32)) AS INDEX_NAME, RDB$STATISTICS from rdb$indices WHERE rdb$system_flag = 0 order by RDB$STATISTICS rdb$system_flag is 0 for user defind indexes and 1 and greater for system indexes. If I code WHERE 0 = 0 order by RDB$STATISTICS I get everything in result set but with WHERE rdb$system_flag = 0 I get nothing. Why would that be since rdb$system_flag should return 0 or 1 Thanks from out lander. Robert
Re: [firebird-support] udf dll
12.12.2018 19:26, Robert Tulloch tult...@hughes.net [firebird-support] wrote: > Not using firebird at all. In this case you are in wrong support list. -- WBR, SD. ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
Re: [firebird-support] udf dll
On 12/12/2018 12:34 PM, Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: 12.12.2018 18:05, Robert Tulloch tult...@hughes.net [firebird-support] wrote: Error message when run from program in IDE First chance exception at $7C812FD3 . Exception class EIBInterBaseError with message 'Unable to complete network request to host "ws1". Error writing data to the connection. Your UDF crashed server most likely. An established connection was aborted by the software in your host machine. 10053? Wow... What is exact version of client library was in use? '. Process IBConsole.exe ($A54) This is an Interbase client tool, not Firebird one. Do you by chance try to use Interbase client library to access Firebird server? This is no-go. Explain: Not using firebird at all. Used IB 6 (6.0.2.0) for many years. Old apps D5/BCB5 (hobby). Installed BCB5 app I did in 2000 on Win10. All worked fine.Went to githgub and downloaded source for console and decided to put it back together with enhancements (hobby like model airplanes). Integrating Planalyzer into IBConsole. 50% there maybe. Did not have COELESCE() in IB 6 so wrote new UDF to perform function thus the crash. As I said in previous post: Stepped to error block function TIBTransaction.Call(ErrCode: ISC_STATUS; RaiseError: Boolean): ISC_STATUS; var i: Integer; begin result := ErrCode; for i := 0 to FDatabases.Count - 1 do if FDatabases[i] <> nil then Databases[i].FCanTimeout := False; FCanTimeout := False; {*Handle when the Error is due to a Database disconnect*. Pass it on to FDatabase so it can handle this} if CheckStatusVector([isc_lost_db_connection]) then FDefaultDatabase.Call(ErrCode, RaiseError) else if RaiseError and (result > 0) then IBDataBaseError; end; Why it disconnects? Who knows but I will track it down.
Re: [firebird-support] udf dll
On 12/12/2018 12:17 PM, Robert Tulloch tult...@hughes.net [firebird-support] wrote: On 12/12/2018 12:05 PM, Robert Tulloch wrote: On 12/12/2018 11:00 AM, Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: 12.12.2018 16:45, Robert tullochtult...@hughes.net [firebird-support] wrote: Interesting last message. Binaries are not allowed in this list. Use Ctrl-C to copy error message text and Ctrl-V to paste it into mail directly. If you use Windows command-line console, "select" and "copy" commands are in system menu. Code calling your SQL is useless for diagnostic UDF errors (unless this query is executed in isql w/o error). UDF code and its declaration are useful. I did execute the statement in ISQL for testing (outside of my program) and got the error messages the image of which were deleted. Error message when run from program in IDE First chance exception at $7C812FD3 . Exception class EIBInterBaseError with message 'Unable to complete network request to host "ws1". Error writing data to the connection. An established connection was*aborted by the software in your host machine*. '. Process IBConsole.exe ($A54) Stepped to error block function TIBTransaction.Call(ErrCode: ISC_STATUS; RaiseError: Boolean): ISC_STATUS; var i: Integer; begin result := ErrCode; for i := 0 to FDatabases.Count - 1 do if FDatabases[i] <> nil then Databases[i].FCanTimeout := False; FCanTimeout := False; {Handle when the Error is due to a Database disconnect. Pass it on to FDatabase so it can handle this} if CheckStatusVector([isc_lost_db_connection]) then FDefaultDatabase.Call(ErrCode, RaiseError) else if RaiseError and (result > 0) then IBDataBaseError; end;
Re: [firebird-support] udf dll
12.12.2018 18:05, Robert Tulloch tult...@hughes.net [firebird-support] wrote: > Error message when run from program in IDE > First chance exception at $7C812FD3 . Exception class EIBInterBaseError with > message > 'Unable to complete network request to host "ws1". > Error writing data to the connection. Your UDF crashed server most likely. > An established connection was aborted by the software in your host machine. 10053? Wow... What is exact version of client library was in use? > '. Process IBConsole.exe ($A54) This is an Interbase client tool, not Firebird one. Do you by chance try to use Interbase client library to access Firebird server? This is no-go. -- WBR, SD. ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
ODP: [firebird-support] udf dll
I suppose you do some wrong things like: 1. Wrong calling convention – should by „cdecl” not „stdcall” 2. You allocate strings locally and return it to the engine but you should allocate it by „ib_util_malloc”. 3. Your declaration of udf is wrong. 4. You raise some exceptions inside your udf ….. regards, Karol Bieniaszewski
Re: [firebird-support] udf dll
On 12/12/2018 12:05 PM, Robert Tulloch wrote: On 12/12/2018 11:00 AM, Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: 12.12.2018 16:45, Robert tullochtult...@hughes.net [firebird-support] wrote: Interesting last message. Binaries are not allowed in this list. Use Ctrl-C to copy error message text and Ctrl-V to paste it into mail directly. If you use Windows command-line console, "select" and "copy" commands are in system menu. Code calling your SQL is useless for diagnostic UDF errors (unless this query is executed in isql w/o error). UDF code and its declaration are useful. I did execute the statement in ISQL for testing (outside of my program) and got the error messages the image of which were deleted. Error message when run from program in IDE First chance exception at $7C812FD3 . Exception class EIBInterBaseError with message 'Unable to complete network request to host "ws1". Error writing data to the connection. An established connection was*aborted by the software in your host machine*. '. Process IBConsole.exe ($A54) Obviously something I cannot expect help with based on my emails. Best regards The statement do prepare Statement: SELECT cast (RDB$RELATION_NAME as varchar(32)) AS TABLE_NAME, cast (RDB$INDEX_NAME as varchar(32)) AS INDEX_NAME, RDB$STATISTICS from rdb$indices WHERE sNullIf( cast( rdb$system_flag as VARCHAR(32) ), cast( 0 as VARCHAR (32) ) ) = 0 order by RDB$STATISTICS PLAN SORT ((RDB$INDICES NATURAL))
Re: [firebird-support] udf dll
On 12/12/2018 11:00 AM, Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: 12.12.2018 16:45, Robert Tulloch tult...@hughes.net [firebird-support] wrote: Interesting last message. Binaries are not allowed in this list. Use Ctrl-C to copy error message text and Ctrl-V to paste it into mail directly. If you use Windows command-line console, "select" and "copy" commands are in system menu. Code calling your SQL is useless for diagnostic UDF errors (unless this query is executed in isql w/o error). UDF code and its declaration are useful. I did execute the statement in ISQL for testing (outside of my program) and got the error messages the image of which were deleted. Error message when run from program in IDE First chance exception at $7C812FD3 . Exception class EIBInterBaseError with message 'Unable to complete network request to host "ws1". Error writing data to the connection. An established connection was*aborted by the software in your host machine*. '. Process IBConsole.exe ($A54) Obviously something I cannot expect help with based on my emails. Best regards
Re: [firebird-support] udf dll
12.12.2018 16:45, Robert Tulloch tult...@hughes.net [firebird-support] wrote: > Interesting last message. Binaries are not allowed in this list. Use Ctrl-C to copy error message text and Ctrl-V to paste it into mail directly. If you use Windows command-line console, "select" and "copy" commands are in system menu. Code calling your SQL is useless for diagnostic UDF errors (unless this query is executed in isql w/o error). UDF code and its declaration are useful. -- WBR, SD. ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
[firebird-support] udf dll
Hi My udf is not working. Very strange error message. Exciting challenges I execute any old SQL statement and Ok. Run this and not ok. SELECT cast (RDB$RELATION_NAME as varchar(32)) AS TABLE_NAME, cast (RDB$INDEX_NAME as varchar(32)) AS INDEX_NAME, RDB$STATISTICS from rdb$indices WHERE sNullIf( cast( rdb$system_flag as VARCHAR(32) ), cast( 0 as VARCHAR(32) ) ) = 0 order by RDB$STATISTICS This sNullIf( cast( rdb$system_flag as VARCHAR(32) ), cast( 0 as VARCHAR(32) ) ) = 0 is calling my udf dll code: setStatisticsStatement := 'SELECT cast (RDB$RELATION_NAME as varchar(32)) AS TABLE_NAME, ' + 'cast (RDB$INDEX_NAME as varchar(32)) AS INDEX_NAME, ' + 'RDB$STATISTICS from rdb$indices ' + 'WHERE sNullIf( cast( rdb$system_flag as VARCHAR(32) ), cast( 0 as VARCHAR(32) ) ) = 0 order by RDB$STATISTICS'; dmQuery.sqlSetStatistics.SQL.Text := setStatisticsStatement; dmQuery.sqlSetStatistics.ExecQuery; *dmQuery.trxIndices.Commit; <* dmQuery.trxIndices.Active := false; When I click prepare in SQL, no errors. No result in SQL from execute. 2 error messages from execute after prepare Ok. Had to shut down with task manager. Transaction active. I issue commit and it won't shut the process down. Interesting last message. Perhaps commit while long process executing? Stepping through code now. A long process. Any insight based on error messages appreciated. Robert [Non-text portions of this message have been removed]
[firebird-support] UDF library not working on VPS
Hello: I am hoping someone can help me out with this. We recently set up a VPS for use for a remote Firebird database to use in our desktop application for user authorization. The VPS is a Windows Server 2008. Initially, I loaded FB 3.0.3, both 64bit and 32 bit versions. The 32 bit for access by IBExperts. I have added a couple of functions to the source code for FreeUDFLib.dll and recompiled that in Delphi 10.2 for both 32 and 64 bit. On my local machine those functions in FreeUDFLib.dll work fine. (F_STR2STR) They work fine also when testing on an older remote server that we have been using for FTP. But when I try to do a SELECT F_STR2STR() on the VPS database, I am getting the error message: "Invalid Token Invalid request BLR at offset 60 Function F_STR2STR is not defined Module Name or entry point could not be found" I get this error whether I am trying to access via my application (remotely to the VPS), or using IBExpert on my local machine and making a remote query to the VPS, or connecting via Remote Desktop to the VPS and making a local connection via IBExpert. To simplify things I uninstalled the FB 3 64 bit server and reinstalled just the 32 bit server. Same issue. Confirmed that the firebird.conf points to the UDF folder (I tried explicitly pointing to the directory, too) and that the same FreeUDFLib.dll is there as I have on my local development computer, where it works as expected. I double checked that indeed the entry point Str2Str is correct in the code. Also, to add to this mystery, I tried using another function for another commonly supplied UDF dll, RTRIM(). What happened consistently is that by calling this function in a SELECT statement from IBExpert crashed IBExpert, as in it would just close without error. At this point I am completely at a loss about what is going on here. Although, it seems like there is something about the VPS setup that is an issue. Can anyone help? Thank you! Chuck Belanger --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Re: [firebird-support] UDF "returning" BLOB slow after first call
23.04.2018 16:18, tvd...@ymail.com [firebird-support] wrote: > It seems to be that call to blob_put_segment that becomes slow. At first > usage of the UDF > it's almost instant, and after that it takes 15ms for every invocation. > > What causes this and can I avoid it? Data, returned from UDF as a BLOB, are stored in database and kept there until end of transaction where UDF has been called. More returned data - bigger database, slower access to it. Think twice if you really need return BLOB from UDF. Commit the transaction as soon as possible. -- WBR, SD. ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
[firebird-support] UDF "returning" BLOB slow after first call
Hi all, I'm using Firebird 2.5.8 and wrote a UDF that "returns" a large (~60MB) BLOB via an output parameter that's a pointer to a blobcallback by repeatedly calling blob_put_segment. The instructions for doing so I took from: https://www.ibphoenix.com/files/Writing-External-Functions.pdf https://www.ibphoenix.com/files/Writing-External-Functions.pdf. The first time I call this function from any connected client, it returns fast (~80ms). Every time after that, it's many times slower (~15s). Only when all clients have disconnected, the server seems to reset in a way, after which a single next call is fast again. It seems to be that call to blob_put_segment that becomes slow. At first usage of the UDF it's almost instant, and after that it takes 15ms for every invocation. What causes this and can I avoid it? Thanks!
[firebird-support] UDF in C language using ib_util_malloc
Hello! How can i use ib_util in my UDF written is C language if ib_util is written in C++? (i need ib_util_malloc from there)Is there also a C version available?Or do i have to write my UDF in C++? (i'm not good in that language) Thank you!
Re: [firebird-support] UDF or/and maybe Charset problem
24.08.2017 15:07, Rudi Feijó rudi.fe...@multidadosti.com.br [firebird-support] wrote: > is there any problems if I just declare all UDF's with FREE IT? Yes, server will have problems trying to free memory that wasn't allocated. -- WBR, SD.
RE: [firebird-support] UDF or/and maybe Charset problem
>You must use ib_util_malloc() to allocate memory in UDF and don't forget >FREE_IT in declaration to avoid memory leak. Dimitry, on a similar question, is there any problems if I just declare all UDF's with FREE IT? We use dozens of UDF's, but only half of them are declared as FREE IT, and I have no way of knowing which ones should be freeing memory or not
Re: [firebird-support] UDF or/and maybe Charset problem
24.08.2017 12:00, Nagy Szilveszter nagy_szilvesz...@yahoo.com [firebird-support] wrote: > out = (char*)calloc(strlen(str), sizeof(char)); > result = (char*)calloc(j, sizeof(char)); Besides, here and there you forgot about space for terminating null char. -- WBR, SD. ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
Re: [firebird-support] UDF or/and maybe Charset problem
No, it has value of TRX12270 On Thursday, August 24, 2017, 12:56:09 PM GMT+3, Antônio Gomes acgomes2...@yahoo.com.br [firebird-support] wrote: there no a null string? De: "Nagy Szilveszter nagy_szilvesz...@yahoo.com [firebird-support]" Para: Firebird-support Enviadas: Quinta-feira, 24 de Agosto de 2017 6:41 Assunto: [firebird-support] UDF or/and maybe Charset problem Hi, i have an UDF function that runs perfectly on Linux 64 bit systems. I wanted to port it to Windows 32 bit, but i'm having problems there. The UDF was written in C (not C++), compiled on Linux with gcc, everything works fine. I compiled the same C file on Windows with MinGW Developer Studio (using MinGW compiler) Here is the function with problems (the functions returns the same string but deletes every non alphanumerical character): char *strpeel(char *str){ unsigned int i = 0, j = 0; char *out; str = strupr(str); out = (char*)calloc(strlen(str), sizeof(char)); for (i=0; i= 'A' && str[i] <= 'Z') || (str[i] >= '0' && str[i] <= '9')) { out[j++] = str[i]; } } char * result; result = (char*)calloc(j, sizeof(char)); strcpy(result, out); return result; } This is the declaration of UDF in Firebird: DECLARE EXTERNAL FUNCTION STRPEEL CSTRING(255) RETURNS CSTRING(255) ENTRY_POINT 'strpeel' MODULE_NAME 'utils-udf'; When i test this function it runs correctly: select strpeel('ABC - 123') from rdb$database > returns: 'ABC123' But when i run it on my PRODUCTS table, there are some rows where this function crashes: select product_code, strpeel(product_code) from products The field PRODUCT_CODE is Varchar(30) charset UTF8 collate UTF8 At row 51 the string must have some invisible characters that makes the UDF to crash. The firebird.log says: The user defined function: STRPEEL referencing entrypoint: strpeel in module: utils-udf caused the fatal exception: Access violation. The code attempted to access a virtual address without privilege to do so. This exception will cause the Firebird server to terminate abnormally. Shutting down the server with 2 active connection(s) to 2 database(s), 0 active service(s) Firebird shutdown is still in progress after the specified timeout Operating system call ReleaseSemaphore failed. Error code 6 Operating system call ReleaseSemaphore failed. Error code 6 That code in that line is TRX12270 If i run select strpeel('TRX12270') from rdb$database - it works fine If i copy that string from table and replace the above string then it crashes again. So there must be something wrong in that field. Also if i edit the table and rewrite the code then it works fine. I also checked the characters with ASCII_VAL but i can see nothing strange. As the UDF, there are 2 memory allocations for strings and no freeing it, neither FREE_IT was used. I dont know if this is a problem since other strings work well with this UDF. Please help me detect and correct this issue! Thank you! #yiv5987566480 #yiv5987566480 -- #yiv5987566480ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv5987566480 #yiv5987566480ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv5987566480 #yiv5987566480ygrp-mkp #yiv5987566480hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv5987566480 #yiv5987566480ygrp-mkp #yiv5987566480ads {margin-bottom:10px;}#yiv5987566480 #yiv5987566480ygrp-mkp .yiv5987566480ad {padding:0 0;}#yiv5987566480 #yiv5987566480ygrp-mkp .yiv5987566480ad p {margin:0;}#yiv5987566480 #yiv5987566480ygrp-mkp .yiv5987566480ad a {color:#ff;text-decoration:none;}#yiv5987566480 #yiv5987566480ygrp-sponsor #yiv5987566480ygrp-lc {font-family:Arial;}#yiv5987566480 #yiv5987566480ygrp-sponsor #yiv5987566480ygrp-lc #yiv5987566480hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv5987566480 #yiv5987566480ygrp-sponsor #yiv5987566480ygrp-lc .yiv5987566480ad {margin-bottom:10px;padding:0 0;}#yiv5987566480 #yiv5987566480actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv5987566480 #yiv5987566480activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv5987566480 #yiv5987566480activity span {font-weight:700;}#yiv5987566480 #yiv5987566480activity span:first-child {text-transform:uppercase;}#yiv5987566480 #yiv5987566480activity span a {color:#5085b6;text-decoration:none;}#yiv5987566480 #yiv5987566480activity span span {color:#ff7900;}#yiv5987566480 #yiv5987566480activity span .yiv5987566480underline {text-decoration:underline;}#yiv5987566480 .yiv5987566480attach {cl
Re: [firebird-support] UDF or/and maybe Charset problem
there no a null string? De: "Nagy Szilveszter nagy_szilvesz...@yahoo.com [firebird-support]" Para: Firebird-support Enviadas: Quinta-feira, 24 de Agosto de 2017 6:41 Assunto: [firebird-support] UDF or/and maybe Charset problem Hi, i have an UDF function that runs perfectly on Linux 64 bit systems. I wanted to port it to Windows 32 bit, but i'm having problems there. The UDF was written in C (not C++), compiled on Linux with gcc, everything works fine. I compiled the same C file on Windows with MinGW Developer Studio (using MinGW compiler) Here is the function with problems (the functions returns the same string but deletes every non alphanumerical character): char *strpeel(char *str){ unsigned int i = 0, j = 0; char *out; str = strupr(str); out = (char*)calloc(strlen(str), sizeof(char)); for (i=0; i= 'A' && str[i] <= 'Z') || (str[i] >= '0' && str[i] <= '9')) { out[j++] = str[i]; } } char * result; result = (char*)calloc(j, sizeof(char)); strcpy(result, out); return result; } This is the declaration of UDF in Firebird: DECLARE EXTERNAL FUNCTION STRPEEL CSTRING(255) RETURNS CSTRING(255) ENTRY_POINT 'strpeel' MODULE_NAME 'utils-udf'; When i test this function it runs correctly: select strpeel('ABC - 123') from rdb$database > returns: 'ABC123' But when i run it on my PRODUCTS table, there are some rows where this function crashes: select product_code, strpeel(product_code) from products The field PRODUCT_CODE is Varchar(30) charset UTF8 collate UTF8 At row 51 the string must have some invisible characters that makes the UDF to crash. The firebird.log says: The user defined function: STRPEEL referencing entrypoint: strpeel in module: utils-udf caused the fatal exception: Access violation. The code attempted to access a virtual address without privilege to do so. This exception will cause the Firebird server to terminate abnormally. Shutting down the server with 2 active connection(s) to 2 database(s), 0 active service(s) Firebird shutdown is still in progress after the specified timeout Operating system call ReleaseSemaphore failed. Error code 6 Operating system call ReleaseSemaphore failed. Error code 6 That code in that line is TRX12270 If i run select strpeel('TRX12270') from rdb$database - it works fine If i copy that string from table and replace the above string then it crashes again. So there must be something wrong in that field. Also if i edit the table and rewrite the code then it works fine. I also checked the characters with ASCII_VAL but i can see nothing strange. As the UDF, there are 2 memory allocations for strings and no freeing it, neither FREE_IT was used. I dont know if this is a problem since other strings work well with this UDF. Please help me detect and correct this issue! Thank you! #yiv3803517428 #yiv3803517428 -- #yiv3803517428ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv3803517428 #yiv3803517428ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv3803517428 #yiv3803517428ygrp-mkp #yiv3803517428hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv3803517428 #yiv3803517428ygrp-mkp #yiv3803517428ads {margin-bottom:10px;}#yiv3803517428 #yiv3803517428ygrp-mkp .yiv3803517428ad {padding:0 0;}#yiv3803517428 #yiv3803517428ygrp-mkp .yiv3803517428ad p {margin:0;}#yiv3803517428 #yiv3803517428ygrp-mkp .yiv3803517428ad a {color:#ff;text-decoration:none;}#yiv3803517428 #yiv3803517428ygrp-sponsor #yiv3803517428ygrp-lc {font-family:Arial;}#yiv3803517428 #yiv3803517428ygrp-sponsor #yiv3803517428ygrp-lc #yiv3803517428hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv3803517428 #yiv3803517428ygrp-sponsor #yiv3803517428ygrp-lc .yiv3803517428ad {margin-bottom:10px;padding:0 0;}#yiv3803517428 #yiv3803517428actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv3803517428 #yiv3803517428activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv3803517428 #yiv3803517428activity span {font-weight:700;}#yiv3803517428 #yiv3803517428activity span:first-child {text-transform:uppercase;}#yiv3803517428 #yiv3803517428activity span a {color:#5085b6;text-decoration:none;}#yiv3803517428 #yiv3803517428activity span span {color:#ff7900;}#yiv3803517428 #yiv3803517428activity span .yiv3803517428underline {text-decoration:underline;}#yiv3803517428 .yiv3803517428attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv3803517428 .yiv3803517428attach div a {text-decoration:none;}#yiv3803517428
Re: [firebird-support] UDF or/and maybe Charset problem
24.08.2017 11:37, Nagy Szilveszter nagy_szilvesz...@yahoo.com [firebird-support] wrote: > result = (char*)calloc(j, sizeof(char)); You must use ib_util_malloc() to allocate memory in UDF and don't forget FREE_IT in declaration to avoid memory leak. -- WBR, SD. ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
[firebird-support] UDF or/and maybe Charset problem
Hi, i have an UDF function that runs perfectly on Linux 64 bit systems. I wanted to port it to Windows 32 bit, but i'm having problems there. The UDF was written in C (not C++), compiled on Linux with gcc, everything works fine. I compiled the same C file on Windows with MinGW Developer Studio (using MinGW compiler) Here is the function with problems (the functions returns the same string but deletes every non alphanumerical character): char *strpeel(char *str){ unsigned int i = 0, j = 0; char *out; str = strupr(str); out = (char*)calloc(strlen(str), sizeof(char)); for (i=0; i= 'A' && str[i] <= 'Z') || (str[i] >= '0' && str[i] <= '9')) { out[j++] = str[i]; } } char * result; result = (char*)calloc(j, sizeof(char)); strcpy(result, out); return result; } This is the declaration of UDF in Firebird: DECLARE EXTERNAL FUNCTION STRPEEL CSTRING(255) RETURNS CSTRING(255) ENTRY_POINT 'strpeel' MODULE_NAME 'utils-udf'; When i test this function it runs correctly: select strpeel('ABC - 123') from rdb$database > returns: 'ABC123' But when i run it on my PRODUCTS table, there are some rows where this function crashes: select product_code, strpeel(product_code) from products The field PRODUCT_CODE is Varchar(30) charset UTF8 collate UTF8 At row 51 the string must have some invisible characters that makes the UDF to crash. The firebird.log says: The user defined function: STRPEEL referencing entrypoint: strpeel in module: utils-udf caused the fatal exception: Access violation. The code attempted to access a virtual address without privilege to do so. This exception will cause the Firebird server to terminate abnormally. Shutting down the server with 2 active connection(s) to 2 database(s), 0 active service(s) Firebird shutdown is still in progress after the specified timeout Operating system call ReleaseSemaphore failed. Error code 6 Operating system call ReleaseSemaphore failed. Error code 6 That code in that line is TRX12270 If i run select strpeel('TRX12270') from rdb$database - it works fine If i copy that string from table and replace the above string then it crashes again. So there must be something wrong in that field. Also if i edit the table and rewrite the code then it works fine. I also checked the characters with ASCII_VAL but i can see nothing strange. As the UDF, there are 2 memory allocations for strings and no freeing it, neither FREE_IT was used. I dont know if this is a problem since other strings work well with this UDF. Please help me detect and correct this issue! Thank you!
Re: [firebird-support] UDF not defined error but udf is defined
Check if your DLL is compiled as 32 bit one. 32 bit DLL gives the same error on 64 bit Firebird. Also check if your function names are not mangled in your DLL (check it with this free tool DLLEXP http://www.nirsoft.net/utils/dll_export_viewer.html I'm having similar problemsOn Thursday, August 24, 2017, 12:07:17 AM GMT+3, Rudi Feijó rudi.fe...@multidadosti.com.br [firebird-support] wrote: I’m having a weird error, sometimes the system crashes due to an UDF being not declared properly : “invalid request BLR at offset 877 function F_GFORMATD is not defined module name or entrypoint could not be found” But I can verify it is declared properly. The same query runs without problems a lot of times (it runs every minute), but randomly it will just crash with the UDF error as if it’s non-existent/declared. Firebird-3.0.2.32703_0_x64 on windows 2012 R2 #yiv2748553954 #yiv2748553954 -- #yiv2748553954ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv2748553954 #yiv2748553954ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv2748553954 #yiv2748553954ygrp-mkp #yiv2748553954hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv2748553954 #yiv2748553954ygrp-mkp #yiv2748553954ads {margin-bottom:10px;}#yiv2748553954 #yiv2748553954ygrp-mkp .yiv2748553954ad {padding:0 0;}#yiv2748553954 #yiv2748553954ygrp-mkp .yiv2748553954ad p {margin:0;}#yiv2748553954 #yiv2748553954ygrp-mkp .yiv2748553954ad a {color:#ff;text-decoration:none;}#yiv2748553954 #yiv2748553954ygrp-sponsor #yiv2748553954ygrp-lc {font-family:Arial;}#yiv2748553954 #yiv2748553954ygrp-sponsor #yiv2748553954ygrp-lc #yiv2748553954hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv2748553954 #yiv2748553954ygrp-sponsor #yiv2748553954ygrp-lc .yiv2748553954ad {margin-bottom:10px;padding:0 0;}#yiv2748553954 #yiv2748553954actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv2748553954 #yiv2748553954activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv2748553954 #yiv2748553954activity span {font-weight:700;}#yiv2748553954 #yiv2748553954activity span:first-child {text-transform:uppercase;}#yiv2748553954 #yiv2748553954activity span a {color:#5085b6;text-decoration:none;}#yiv2748553954 #yiv2748553954activity span span {color:#ff7900;}#yiv2748553954 #yiv2748553954activity span .yiv2748553954underline {text-decoration:underline;}#yiv2748553954 .yiv2748553954attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv2748553954 .yiv2748553954attach div a {text-decoration:none;}#yiv2748553954 .yiv2748553954attach img {border:none;padding-right:5px;}#yiv2748553954 .yiv2748553954attach label {display:block;margin-bottom:5px;}#yiv2748553954 .yiv2748553954attach label a {text-decoration:none;}#yiv2748553954 blockquote {margin:0 0 0 4px;}#yiv2748553954 .yiv2748553954bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv2748553954 .yiv2748553954bold a {text-decoration:none;}#yiv2748553954 dd.yiv2748553954last p a {font-family:Verdana;font-weight:700;}#yiv2748553954 dd.yiv2748553954last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv2748553954 dd.yiv2748553954last p span.yiv2748553954yshortcuts {margin-right:0;}#yiv2748553954 div.yiv2748553954attach-table div div a {text-decoration:none;}#yiv2748553954 div.yiv2748553954attach-table {width:400px;}#yiv2748553954 div.yiv2748553954file-title a, #yiv2748553954 div.yiv2748553954file-title a:active, #yiv2748553954 div.yiv2748553954file-title a:hover, #yiv2748553954 div.yiv2748553954file-title a:visited {text-decoration:none;}#yiv2748553954 div.yiv2748553954photo-title a, #yiv2748553954 div.yiv2748553954photo-title a:active, #yiv2748553954 div.yiv2748553954photo-title a:hover, #yiv2748553954 div.yiv2748553954photo-title a:visited {text-decoration:none;}#yiv2748553954 div#yiv2748553954ygrp-mlmsg #yiv2748553954ygrp-msg p a span.yiv2748553954yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv2748553954 .yiv2748553954green {color:#628c2a;}#yiv2748553954 .yiv2748553954MsoNormal {margin:0 0 0 0;}#yiv2748553954 o {font-size:0;}#yiv2748553954 #yiv2748553954photos div {float:left;width:72px;}#yiv2748553954 #yiv2748553954photos div div {border:1px solid #66;min-height:62px;overflow:hidden;width:62px;}#yiv2748553954 #yiv2748553954photos div label {color:#66;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv2748553954 #yiv2748553954reco-category {font-size:77%;}#yiv2748553954 #yiv2748553954reco-desc {font-size:77%;}#yiv2748553954 .yiv2748553954replbq {margin:4px;}#yiv2748553954 #yiv2748553954ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv2748553954 #yiv2748553954ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv2748553954 #yiv2748553954ygrp-mlmsg
[firebird-support] UDF not defined error but udf is defined
I’m having a weird error, sometimes the system crashes due to an UDF being not declared properly : “invalid request BLR at offset 877 function F_GFORMATD is not defined module name or entrypoint could not be found” But I can verify it is declared properly. The same query runs without problems a lot of times (it runs every minute), but randomly it will just crash with the UDF error as if it’s non-existent/declared. Firebird-3.0.2.32703_0_x64 on windows 2012 R2
Re: [firebird-support] udf with paramters problem
11.08.2017 11:09, keith prosser prosse...@yahoo.com [firebird-support] wrote: > I'm fairy sure its to with pointers and data. No, it is about calling conventions. UDFs use cdecl, not stdcall. -- WBR, SD. ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
[firebird-support] udf with paramters problem
Has anyone had probems with udfs written in Delphi7? I'm getting serious crashes when I try to pass parameters - but a udf returning an integer with input parameters works fine. I am running 32-bit Firebird on a 64bit win 7 machine.I'm fairy sure its to with pointers and data. The source code is interface function AddFunction(var i: integer):Integer;stdcall;function mynow():Integer;stdcall; implementation function AddFunction(var i: integer): integer; stdcall; begin result:=i+1; // this crashes end; function mynow():Integer;begin result:=; // this works end; and the sql is DECLARE EXTERNAL FUNCTION F_ADDFUNCTION Integer RETURNS Integer BY VALUE ENTRY_POINT 'AddFunction' MODULE_NAME 'FISHYFUNCS.DLL'; DECLARE EXTERNAL FUNCTION MYNOW RETURNS Integer BY VALUE ENTRY_POINT 'mynow' MODULE_NAME 'FISHYFUNCS'; Mynow works, f_addfunction doesn't.
[firebird-support] UDF and server crashes on linux
Tested on FB 2.5.7 and 3.02 ubuntu_x64 14.04 (two different machines); On windows fbx64 works ok. udf return integer by value. scenario: more than 2 connections to db sql : select count(*) from table where validfield(field) = 1 on each connection table with > 2 milions record udf written in object pascal ( no memory leaks and other problems) other implementation this udf in C++ works fine on linux and windows... stacktrace: [Thread 0x7fa737789700 (LWP 28692) exited] [New Thread 0x7fa737789700 (LWP 28693)] [New Thread 0x7fa736dd7700 (LWP 28694)] [New Thread 0x7fa73603f700 (LWP 28698)] An unhandled exception occurred at $7FA736178E2C: EStackOverflow: Stack overflow $7FA736178E2C $7FA7CCFBEC21 $7FA7CCFBF691 $7FA7CD0163BA $7FA7CCFFD252 $7FA7CD136DCB $7FA7CD13712B $7FA7CD131193 $7FA7CD131D9D $7FA7CD13553C $7FA7CD041B47 $7FA7CCEE4C02 $7FA7CCEE5C35 $7FA7CCEE807B $7FA7CCF0310B $7FA7CD087A7E $7FA7CD006289 -- Regards, Michał Kurczabiński
[firebird-support] UDF parameter size mismatch
So, if I've got a UDF which is declared as DECLARE EXTERNAL FUNCTION xxx INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER RETURNS INTEGER BY VALUE ENTRY_POINT 'xxx' MODULE_NAME 'xxx_udf'; these INTEGERs are all 32 bits, right, both on 32 bit and 64 bit versions of Firebird? And if it turns out that the function is declared in C as long xxx(long *elem1, long *elem2, long *elem3, long *elem4, long *elem5, long *elem6, long *elem7, long *elem8, long *elem9, long *elem10) we might expect long to be 32 bits in a 32 bit build and 64 bits in a 64 bit build, yes? Which means that on a 64 bit build there's a mismatch between the parameter and result sizes, yes? Does anyone have the remotest clue what will happen? - this is crypto stuff (it would be), so therefore (as always with crypto stuff) the function churns away and returns some number which you can't tell by looking at it whether it's right or not. -- Tim Ward
[firebird-support] UDF install in FB3.0 RC2
I have a FB 2.5.5 database which I have migrated to FB3 RC2. I use the older FreeUDFLib.dll. All the procedures of this DLL are in the database reported by Database Workbench 5. The restore log for the migration shows no errors. This DLL is in the FB 3 UDF folder. When running a stored procedure that calls F_YEAR I get error message "invalid request BLR at offset 45. function F_YEAR is not defined. module name or entrypoint could not be found." I try to make a simpler test case. I install FreeUDFLib into the Employee DB which comes with FB 3. It seems to install OK. F_YEAR and its companions now show in the UDF list for the Employee DB. Now run a stored procedure "myString = cast(F_YEAR(current_timestamp) as varchar(12)));" I get the same error. It does not seem to be a permission problem with the UDF folder. I am using Win 10 (64) and FB3 (32). Any help will be appreciated.
Re: [firebird-support] UDF for linux 64 bit compiled with Freepascal 2.6.4
[firebird-support] UDF for linux 64 bit compiled with Freepascal 2.6.4
Hello firebird-support@yahoogroups.com! I am migrating my UDF from windows to linux, but all functions using string as output when they are used crashes the server. I suppose it must be related to libib_util.so and its function ib_util_malloc. My declaration is the following: {$IFDEF WINDOWS} function ib_util_malloc(l: integer): pointer; cdecl; external 'ib_util.dll'; {$ELSE} function ib_util_malloc(l: integer): pointer; cdecl; external 'libib_util.so'; {$ENDIF} the same code was built in he past over Freepascal windows and it is in production without errors. Is there anything I need to do different for linux? PS: A piece of pascal code with string function would help. Thanks in advance. -- Best regards, TRoland http://www.rotursoft.sk http://exekutor.rotursoft.sk
[firebird-support] UDF in FB3
Will UDF (User-Defined Functions) as done up to FB 2.5 (based on DLL or SO libraries) on Firebird 3 be considered obsolete or even disappear in future versions since the new features of SQL functions, sub-routines and packages? How will work the external functions, procedures and triggers in C, C++, Pascal and Java? They work similar to FB 2.5 UDFs (DLL / SO libraries)? http://www.slideshare.net/mindthebird/fb2014whatsnew30en http://firebird3.com/en/news/firebird-release-strategy-for-2015-2016/ Thanks for any information. [Non-text portions of this message have been removed]
Re: [firebird-support] Udf returning VARCHAR
Hello, liviuslivius! Friday, January 31, 2014, 12:21:37 PM, you wrote: l> i try to find any example of writing and declaring udf function l> returning varchar instead of Char l> without success. l> Is this possible? yes, but correct way is to use CSTRING. It can be simply used inside udf, and that udf will be 100% compatible with any outside CHAR/VARCHAR variables, fields or literals. -- Dmitry Kuzmenko, www.ib-aid.com
Re: [firebird-support] Udf returning VARCHAR
Hej, liviuslivius wrote: > Hi, > >>Why don`t you use CAST ( var as VARCHAR(NN)) > i use but this is not natural way and i need to know if is possible to > return varchar and how read http://www.firebirdsql.org/en/writing-udfs-in-delphi-for-interbase-firebird/, search for a topic called things. There's a little table describing what you are looking for. hth, marcus > regards, > Karol Bieniaszewski > W dniu 2014-01-31 09:24:20 użytkownik Bogdan Mihalache > napisał: > > Why don`t you use CAST ( var as VARCHAR(NN)) ? > > *Bogdan MIHALACHE* > > *From:*firebird-support@yahoogroups.com > [mailto:firebird-support@yahoogroups.com] *On Behalf Of *liviuslivius > *Sent:* Friday, January 31, 2014 10:22 AM > *To:* firebir d-supp...@yahoogroups.com > *Subject:* [firebird-support] Udf returning VARCHAR > > Hi, > > i try to find any example of writing and declaring udf function > returning varchar instead of Char > > without success. > > Is this possible? > > regards, > > Karol Bieniaszewski > > ~-|**|PrettyHtmlStart|**|-~ > >
Re: RE: [firebird-support] Udf returning VARCHAR
Hi, >>Why don`t you use CAST ( var as VARCHAR(NN)) i use but this is not natural way and i need to know if is possible to return varchar and how regards, Karol Bieniaszewski W dniu 2014-01-31 09:24:20 użytkownik Bogdan Mihalache napisał: Why don`t you use CAST ( var as VARCHAR(NN)) ? Bogdan MIHALACHE From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of liviuslivius Sent: Friday, January 31, 2014 10:22 AM To: firebir d-supp...@yahoogroups.com Subject: [firebird-support] Udf returning VARCHAR Hi, i try to find any example of writing and declaring udf function returning varchar instead of Char without success. Is this possible? regards, Karol Bieniaszewski ~-|**|PrettyHtmlStart|**|-~
RE: [firebird-support] Udf returning VARCHAR
Why don`t you use CAST ( var as VARCHAR(NN)) ? Bogdan MIHALACHE From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of liviuslivius Sent: Friday, January 31, 2014 10:22 AM To: firebird-support@yahoogroups.com Subject: [firebird-support] Udf returning VARCHAR Hi, i try to find any example of writing and declaring udf function returning varchar instead of Char without success. Is this possible? regards, Karol Bieniaszewski
[firebird-support] Udf returning VARCHAR
Hi, i try to find any example of writing and declaring udf function returning varchar instead of Char without success. Is this possible? regards, Karol Bieniaszewski
RE: [firebird-support] UDF and Delphi XE3 Blues
Hi, one trick to debug UDF. Just stop Firebird service, and configure in Delphi for UDF as host application firebird.exe with parameter -a. Next just run UDF (firebird will be started as application), connect from some sql console and call udf. Also you can debug UDF in Delphi debuger as any other dll. In your case, you will probably see the name of missing dll or another exception related UDF loading/startup code. Slavek Ing. Slavomir Skopalik Executive Head Elekt Labs s.r.o. Collection and evaluation of data from machines and laboratories by means of system MASA (http://www.elektlabs.cz/m2demo) - Address: Elekt Labs s.r.o. Chaloupky 158 783 72 Velky Tynec Czech Republic --- Mobile: +420 724 207 851 icq:199 118 333 skype:skopaliks e-mail:skopa...@elektlabs.cz http://www.elektlabs.cz <http://www.elektlabs.cz/> -Original Message- From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of firebirddev firebirddev Sent: Wednesday, October 16, 2013 8:54 PM To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] UDF and Delphi XE3 Blues Hello. I am unable to resolve the issue with UDF. Does anyone have any other suggestions? Thanks in advance. 2013/10/3 firebirddev firebirddev Thanks Sean. The UDF/DLL is in located in the path described in the firebird.conf: UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; Yes, "myDLL.dll' is 32-bit, However my FB installation is 64-bit. I did compile the dll to the 64-bit target and copied into the UDF folder. The problem persists. Any other clues? Thanks. 2013/10/2 Leyne, Sean Are you sure that the UDF/DLL is in the %Firebird%\UDF folder? Are you trying to run a 32bit UDF with a 64 bit version of Firebird? Sean From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of firebirddev firebirddev Sent: Wednesday, October 02, 2013 3:13 PM To: firebird-support@yahoogroups.com Subject: [firebird-support] UDF and Delphi XE3 Blues Hello. If this is not the right group, kindly direct me to the right group. I have created a UDF and I am getting stuck at the following error: Preparing query: select F_MODULO(3, 2) from rdb$database Error: *** IBPP::SQLException *** Context: Statement::Prepare( select F_MODULO(3, 2) from rdb$database ) Message: isc_dsql_prepare failed SQL Message : -104 Invalid token Engine Code: 335544343 Engine Message : invalid request BLR at offset 60 function F_MODULO is not defined module name or entrypoint could not be found Total execution time: 0.003s Here are the steps I have performed: === Delphi XE3 code library myUDF; { Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses System.SysUtils, System.Classes; //{$R *.res} function Modulo(var i, j: Integer): Integer; cdecl; begin if (j = 0) then result := -1 // just check the boundary condition, and // return a reasonably uninteresting answer. else result := i mod j; end; exports Modulo; begin end. == FB 2.5 declaration == DECLARE EXTERNAL FUNCTION F_MODULO Integer, Integer RETURNS Integer BY VALUE ENTRY_POINT 'Modulo' MODULE_NAME 'myDLL'; == Calling the function F_MODULO from FB: === select F_MODULO(3, 2) from rdb$database My firebird.conf looks like: = UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; Please let me know how I can resolve the problem. Thanks.
Re[2]: [firebird-support] UDF and Delphi XE3 Blues
Hello, firebirddev! Wednesday, October 16, 2013, 11:54:07 PM, you wrote: ff> I am unable to resolve the issue with UDF. >> The UDF/DLL is in located in the path described in the firebird.conf: >> UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; default parameter UdfAccess = Restrict UDF refers to the UDF subfolder, so you do not need to specify full path. anyway, use ProcessMonitor to monitor fbserver.exe only (it's easier to use SS here), and to find what it tries to load and where. Since udf is being loaded only when referred, the simple way is to - prepare ProcessMonitor to monitor fbserver.exe, and ensure that nothing else is being monitored - open your database, prepare to execute query - clear all output that you see in ProcessMonitor - execute query that calls your udf - select myudf(... - return to ProcessMonitor, stop monitoring, and enjoy viewing log to find what happening during your function load. -- Dmitry Kuzmenko, www.ib-aid.com
Re: [firebird-support] UDF and Delphi XE3 Blues
> The UDF/DLL is in located in the path described in the firebird.conf: > UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; Try UdfAccess = Full Check OS permissions of dll. > Yes, "myDLL.dll' is 32-bit, However my FB installation is 64-bit. I did > compile the dll to the 64-bit target and copied into the > UDF folder. Perhaps your UDF is dependent on antoher dll ? Is this necesary ? uses System.SysUtils, System.Classes; > function Modulo(var i, j: Integer): Integer; cdecl; Btw. Firebird has built in function MOD() (since fb2.1) Ivan
Re: [firebird-support] UDF and Delphi XE3 Blues
Hello. I am unable to resolve the issue with UDF. Does anyone have any other suggestions? Thanks in advance. 2013/10/3 firebirddev firebirddev > Thanks Sean. > > The UDF/DLL is in located in the path described in the firebird.conf: > UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; > > Yes, "myDLL.dll' is 32-bit, However my FB installation is 64-bit. I did > compile the dll to the 64-bit target and copied into the UDF folder. > > The problem persists. Any other clues? > > Thanks. > > > > 2013/10/2 Leyne, Sean > > ** >> >> >> ** ** >> >> Are you sure that the UDF/DLL is in the %Firebird%\UDF folder? >> >> ** ** >> >> Are you trying to run a 32bit UDF with a 64 bit version of Firebird? >> >> ** ** >> >> ** ** >> >> Sean >> >> ** ** >> >> *From:* firebird-support@yahoogroups.com [mailto: >> firebird-support@yahoogroups.com] *On Behalf Of *firebirddev firebirddev >> *Sent:* Wednesday, October 02, 2013 3:13 PM >> *To:* firebird-support@yahoogroups.com >> *Subject:* [firebird-support] UDF and Delphi XE3 Blues >> >> ** ** >> >> >> >> >> >> >> Hello. >> >> ** ** >> >> If this is not the right group, kindly direct me to the right group. >> >> ** ** >> >> I have created a UDF and I am getting stuck at the following error: >> >> ** ** >> >> Preparing query: select F_MODULO(3, 2) from rdb$database >> >> ** ** >> >> Error: *** IBPP::SQLException *** >> >> Context: Statement::Prepare( select F_MODULO(3, 2) from rdb$database >> >> ) >> >> Message: isc_dsql_prepare failed >> >> ** ** >> >> SQL Message : -104 >> >> Invalid token >> >> ** ** >> >> Engine Code: 335544343 >> >> Engine Message : >> >> invalid request BLR at offset 60 >> >> function F_MODULO is not defined >> >> module name or entrypoint could not be found >> >> ** ** >> >> ** ** >> >> Total execution time: 0.003s >> >> ** ** >> >> ** ** >> >> Here are the steps I have performed: >> >> ** ** >> >> === >> >> Delphi XE3 code >> >> >> >> ** ** >> >> library myUDF; >> >> ** ** >> >> { Important note about DLL memory management: ShareMem must be the >> >> first unit in your library's USES clause AND your project's (select >> >> Project-View Source) USES clause if your DLL exports any procedures or* >> *** >> >> functions that pass strings as parameters or function results. This >> >> applies to all strings passed to and from your DLL--even those that >> >> are nested in records and classes. ShareMem is the interface unit to*** >> * >> >> the BORLNDMM.DLL shared memory manager, which must be deployed along*** >> * >> >> with your DLL. To avoid using BORLNDMM.DLL, pass string information >> >> using PChar or ShortString parameters. } >> >> ** ** >> >> uses >> >> System.SysUtils, >> >> System.Classes; >> >> ** ** >> >> //{$R *.res} >> >> ** ** >> >> function Modulo(var i, j: Integer): Integer; cdecl; >> >> begin >> >> if (j = 0) then >> >> result := -1 // just check the boundary condition, and >> >> // return a reasonably uninteresting answer. >> >> else >> >> result := i mod j; >> >> end; >> >> ** ** >> >> exports >> >> Modulo; >> >> ** ** >> >> begin >> >> end. >> >> ** ** >> >> == >> >> FB 2.5 declaration >> >> == >> >> ** ** >> >> DECLARE EXTERNAL FUNCTION F_MODULO >> >> Integer, Integer >> >> RETURNS Integer BY VALUE >> >> ENTRY_POINT 'Modulo' >> >> MODULE_NAME 'myDLL'; >> >> ** ** >> >> == >> >> Calling the function F_MODULO from FB: >> >> === >> >> ** ** >> >> select F_MODULO(3, 2) from rdb$database >> >> ** ** >> >> >> >> My firebird.conf looks like: >> >> = >> >> ** ** >> >> UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; >> >> ** ** >> >> Please let me know how I can resolve the problem. >> >> ** ** >> >> Thanks. >> >> >> >> >> >> >> >> >> >> > >
Re: [firebird-support] UDF and Delphi XE3 Blues
Thanks Sean. The UDF/DLL is in located in the path described in the firebird.conf: UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; Yes, "myDLL.dll' is 32-bit, However my FB installation is 64-bit. I did compile the dll to the 64-bit target and copied into the UDF folder. The problem persists. Any other clues? Thanks. 2013/10/2 Leyne, Sean > ** > > > ** ** > > Are you sure that the UDF/DLL is in the %Firebird%\UDF folder? > > ** ** > > Are you trying to run a 32bit UDF with a 64 bit version of Firebird? > > ** ** > > ** ** > > Sean > > ** ** > > *From:* firebird-support@yahoogroups.com [mailto: > firebird-support@yahoogroups.com] *On Behalf Of *firebirddev firebirddev > *Sent:* Wednesday, October 02, 2013 3:13 PM > *To:* firebird-support@yahoogroups.com > *Subject:* [firebird-support] UDF and Delphi XE3 Blues > > ** ** > > > > > > > Hello. > > ** ** > > If this is not the right group, kindly direct me to the right group. > > ** ** > > I have created a UDF and I am getting stuck at the following error: > > ** ** > > Preparing query: select F_MODULO(3, 2) from rdb$database > > ** ** > > Error: *** IBPP::SQLException *** > > Context: Statement::Prepare( select F_MODULO(3, 2) from rdb$database > > ) > > Message: isc_dsql_prepare failed > > ** ** > > SQL Message : -104 > > Invalid token > > ** ** > > Engine Code: 335544343 > > Engine Message : > > invalid request BLR at offset 60 > > function F_MODULO is not defined > > module name or entrypoint could not be found > > ** ** > > ** ** > > Total execution time: 0.003s > > ** ** > > ** ** > > Here are the steps I have performed: > > ** ** > > === > > Delphi XE3 code > > > > ** ** > > library myUDF; > > ** ** > > { Important note about DLL memory management: ShareMem must be the > > first unit in your library's USES clause AND your project's (select > > Project-View Source) USES clause if your DLL exports any procedures or** > ** > > functions that pass strings as parameters or function results. This > > applies to all strings passed to and from your DLL--even those that > > are nested in records and classes. ShareMem is the interface unit to > > the BORLNDMM.DLL shared memory manager, which must be deployed along > > with your DLL. To avoid using BORLNDMM.DLL, pass string information > > using PChar or ShortString parameters. } > > ** ** > > uses > > System.SysUtils, > > System.Classes; > > ** ** > > //{$R *.res} > > ** ** > > function Modulo(var i, j: Integer): Integer; cdecl; > > begin > > if (j = 0) then > > result := -1 // just check the boundary condition, and > > // return a reasonably uninteresting answer. > > else > > result := i mod j; > > end; > > ** ** > > exports > > Modulo; > > ** ** > > begin > > end. > > ** ** > > == > > FB 2.5 declaration > > == > > ** ** > > DECLARE EXTERNAL FUNCTION F_MODULO > > Integer, Integer > > RETURNS Integer BY VALUE > > ENTRY_POINT 'Modulo' > > MODULE_NAME 'myDLL'; > > ** ** > > == > > Calling the function F_MODULO from FB: > > === > > ** ** > > select F_MODULO(3, 2) from rdb$database > > ** ** > > > > My firebird.conf looks like: > > = > > ** ** > > UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; > > ** ** > > Please let me know how I can resolve the problem. > > ** ** > > Thanks. > > > > > > > > > >
RE: [firebird-support] UDF and Delphi XE3 Blues
Are you sure that the UDF/DLL is in the %Firebird%\UDF folder? Are you trying to run a 32bit UDF with a 64 bit version of Firebird? Sean From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of firebirddev firebirddev Sent: Wednesday, October 02, 2013 3:13 PM To: firebird-support@yahoogroups.com Subject: [firebird-support] UDF and Delphi XE3 Blues Hello. If this is not the right group, kindly direct me to the right group. I have created a UDF and I am getting stuck at the following error: Preparing query: select F_MODULO(3, 2) from rdb$database Error: *** IBPP::SQLException *** Context: Statement::Prepare( select F_MODULO(3, 2) from rdb$database ) Message: isc_dsql_prepare failed SQL Message : -104 Invalid token Engine Code: 335544343 Engine Message : invalid request BLR at offset 60 function F_MODULO is not defined module name or entrypoint could not be found Total execution time: 0.003s Here are the steps I have performed: === Delphi XE3 code library myUDF; { Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses System.SysUtils, System.Classes; //{$R *.res} function Modulo(var i, j: Integer): Integer; cdecl; begin if (j = 0) then result := -1 // just check the boundary condition, and // return a reasonably uninteresting answer. else result := i mod j; end; exports Modulo; begin end. == FB 2.5 declaration == DECLARE EXTERNAL FUNCTION F_MODULO Integer, Integer RETURNS Integer BY VALUE ENTRY_POINT 'Modulo' MODULE_NAME 'myDLL'; == Calling the function F_MODULO from FB: === select F_MODULO(3, 2) from rdb$database My firebird.conf looks like: = UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; Please let me know how I can resolve the problem. Thanks.
[firebird-support] UDF and Delphi XE3 Blues
Hello. If this is not the right group, kindly direct me to the right group. I have created a UDF and I am getting stuck at the following error: Preparing query: select F_MODULO(3, 2) from rdb$database Error: *** IBPP::SQLException *** Context: Statement::Prepare( select F_MODULO(3, 2) from rdb$database ) Message: isc_dsql_prepare failed SQL Message : -104 Invalid token Engine Code: 335544343 Engine Message : invalid request BLR at offset 60 function F_MODULO is not defined module name or entrypoint could not be found Total execution time: 0.003s Here are the steps I have performed: === Delphi XE3 code library myUDF; { Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses System.SysUtils, System.Classes; //{$R *.res} function Modulo(var i, j: Integer): Integer; cdecl; begin if (j = 0) then result := -1 // just check the boundary condition, and // return a reasonably uninteresting answer. else result := i mod j; end; exports Modulo; begin end. == FB 2.5 declaration == DECLARE EXTERNAL FUNCTION F_MODULO Integer, Integer RETURNS Integer BY VALUE ENTRY_POINT 'Modulo' MODULE_NAME 'myDLL'; == Calling the function F_MODULO from FB: === select F_MODULO(3, 2) from rdb$database My firebird.conf looks like: = UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF; Please let me know how I can resolve the problem. Thanks.
RE: [firebird-support] UDF 64 bits
First Delphi that can compile into 64 bit is XE2. But, you have to select target 64 bit. Also I was used for at least 5 years FreePascal 2.2 compiler to compile into 64 bits and this UDF working fine. Best regards Slavek Ing. Slavomir Skopalik Executive Head Elekt Labs s.r.o. Collection and evaluation of data from machines and laboratories by means of system MASA (http://www.elektlabs.cz/m2demo) - Address: Elekt Labs s.r.o. Chaloupky 158 783 72 Velky Tynec Czech Republic --- Mobile: +420 724 207 851 icq:199 118 333 skype:skopaliks e-mail:skopa...@elektlabs.cz http://www.elektlabs.cz <http://www.elektlabs.cz/> -Original Message- From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Piotr Olszewski Sent: Wednesday, December 05, 2012 10:30 AM To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] UDF 64 bits Hi again... One question about UDF on 64-bits Firebird server, do I need to recompile dll's with 64 - bits RAD?? or can I use compiled with 32 bits Delphi 2007 Piotr Dnia 2012-12-05 00:56 Slavomir Skopalik napisa³(a): >Hi, typical problem with "unable to load" is dependency on another dll. >You can create small delphi x64 application and try to load this dll into >this application. > >And you will see. > >Slavek >Ing. Slavomir Skopalik >Executive Head >Elekt Labs s.r.o. >Collection and evaluation of data from machines and laboratories >by means of system MASA (http://www.elektlabs.cz/m2demo) >-- >Address: >Elekt Labs s.r.o. >Chaloupky 158 >783 72 Velky Tynec >Czech Republic >-- >Mobile: +420 724 207 851 >icq:199 118 333 >skype:skopaliks >e-mail:skopa...@elektlabs.cz <mailto:skopalik%40elektlabs.cz> >http://www.elektlabs.cz <http://www.elektlabs.cz/> > > > > >-Original Message- >From: firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> >[mailto:firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> ] On Behalf Of Sergio H. Gonzalez >Sent: Tuesday, December 04, 2012 3:56 PM >To: firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> >Subject: [firebird-support] UDF 64 bits > > > > >Hello... I think I've posted this question before, but now can't find >the thread... Anyway I still have the problem... > >An UDF that worked fine in FB 32 bits, in 64 bits doesn't work > >This is the DDL: > >DECLARE EXTERNAL FUNCTION SG_DES >DOUBLE PRECISION, >CSTRING(50) >RETURNS DOUBLE PRECISION BY VALUE >ENTRY_POINT 'Descuentos' MODULE_NAME 'SGUDF'; > >SGUDF.DLL is in C:\Program Files\Firebird\Firebird_2_5\UDF > >I get this message whe I try to execute the function: > >can't format message 13:896 -- message file C:\Windows\firebird.msg not >found. >invalid request BLR at offset 59. >function SG_DES is not defined. >module name or entrypoint could not be found. > >The DLL was rebuilded with Delphi XE2 for 64 bits... > >thanks! > > > >[Non-text portions of this message have been removed] > > > [Non-text portions of this message have been removed] ++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [firebird-support] UDF 64 bits
> One question about UDF on 64-bits Firebird server, do I need to recompile > dll's with 64 - bits RAD?? or can I use compiled with 32 bits Delphi 2007 You have to recompile with 64Bit compiler - either Delphi or FreePascal. Elmar
Re: [firebird-support] UDF 64 bits
On 5-12-2012 10:30, Piotr Olszewski wrote: > > > Hi again... > > One question about UDF on 64-bits Firebird server, do I need to recompile > dll's with 64 - bits RAD?? or can I use compiled with 32 bits Delphi 2007 > AFAIU 2007 won't work because it does not have a 64 bit compiler. You could recompile your UDFs to 64 bit with the free FreePascal compiler (www.freepascal.org and www.lazarus.freepascal.org). The language is very similar to Delphi - it has a Delphi compatiblity mode as well as a native Object Pascal dialect By heart: you may need to add an {$ifdef fpc} {$mode delphi} {$endif} at the top of your code.
Re: [firebird-support] UDF 64 bits
Hi again... One question about UDF on 64-bits Firebird server, do I need to recompile dll's with 64 - bits RAD?? or can I use compiled with 32 bits Delphi 2007 Piotr Dnia 2012-12-05 00:56 Slavomir Skopalik napisał(a): >Hi, typical problem with "unable to load" is dependency on another dll. >You can create small delphi x64 application and try to load this dll into >this application. > >And you will see. > >Slavek >Ing. Slavomir Skopalik >Executive Head >Elekt Labs s.r.o. >Collection and evaluation of data from machines and laboratories >by means of system MASA (http://www.elektlabs.cz/m2demo) >- >Address: >Elekt Labs s.r.o. >Chaloupky 158 >783 72 Velky Tynec >Czech Republic >--- >Mobile: +420 724 207 851 >icq:199 118 333 >skype:skopaliks >e-mail:skopa...@elektlabs.cz >http://www.elektlabs.cz <http://www.elektlabs.cz/> > > > > >-Original Message- >From: firebird-support@yahoogroups.com >[mailto:firebird-support@yahoogroups.com] On Behalf Of Sergio H. Gonzalez >Sent: Tuesday, December 04, 2012 3:56 PM >To: firebird-support@yahoogroups.com >Subject: [firebird-support] UDF 64 bits > > > > >Hello... I think I've posted this question before, but now can't find >the thread... Anyway I still have the problem... > >An UDF that worked fine in FB 32 bits, in 64 bits doesn't work > >This is the DDL: > >DECLARE EXTERNAL FUNCTION SG_DES >DOUBLE PRECISION, >CSTRING(50) >RETURNS DOUBLE PRECISION BY VALUE >ENTRY_POINT 'Descuentos' MODULE_NAME 'SGUDF'; > >SGUDF.DLL is in C:\Program Files\Firebird\Firebird_2_5\UDF > >I get this message whe I try to execute the function: > >can't format message 13:896 -- message file C:\Windows\firebird.msg not >found. >invalid request BLR at offset 59. >function SG_DES is not defined. >module name or entrypoint could not be found. > >The DLL was rebuilded with Delphi XE2 for 64 bits... > >thanks! > > > >[Non-text portions of this message have been removed] > > >
RE: [firebird-support] UDF 64 bits
Hi, typical problem with "unable to load" is dependency on another dll. You can create small delphi x64 application and try to load this dll into this application. And you will see. Slavek Ing. Slavomir Skopalik Executive Head Elekt Labs s.r.o. Collection and evaluation of data from machines and laboratories by means of system MASA (http://www.elektlabs.cz/m2demo) - Address: Elekt Labs s.r.o. Chaloupky 158 783 72 Velky Tynec Czech Republic --- Mobile: +420 724 207 851 icq:199 118 333 skype:skopaliks e-mail:skopa...@elektlabs.cz http://www.elektlabs.cz <http://www.elektlabs.cz/> -Original Message- From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Sergio H. Gonzalez Sent: Tuesday, December 04, 2012 3:56 PM To: firebird-support@yahoogroups.com Subject: [firebird-support] UDF 64 bits Hello... I think I've posted this question before, but now can't find the thread... Anyway I still have the problem... An UDF that worked fine in FB 32 bits, in 64 bits doesn't work This is the DDL: DECLARE EXTERNAL FUNCTION SG_DES DOUBLE PRECISION, CSTRING(50) RETURNS DOUBLE PRECISION BY VALUE ENTRY_POINT 'Descuentos' MODULE_NAME 'SGUDF'; SGUDF.DLL is in C:\Program Files\Firebird\Firebird_2_5\UDF I get this message whe I try to execute the function: can't format message 13:896 -- message file C:\Windows\firebird.msg not found. invalid request BLR at offset 59. function SG_DES is not defined. module name or entrypoint could not be found. The DLL was rebuilded with Delphi XE2 for 64 bits... thanks! [Non-text portions of this message have been removed]
Re: [firebird-support] UDF 64 bits
Hello Maybe the problem is that we have to re-compile our dll's as 64 bits. Piotr Dnia 2012-12-04 15:56 Sergio H. Gonzalez napisał(a): >Hello... I think I've posted this question before, but now can't find >the thread... Anyway I still have the problem... > >An UDF that worked fine in FB 32 bits, in 64 bits doesn't work > >This is the DDL: > >DECLARE EXTERNAL FUNCTION SG_DES > DOUBLE PRECISION, > CSTRING(50) >RETURNS DOUBLE PRECISION BY VALUE >ENTRY_POINT 'Descuentos' MODULE_NAME 'SGUDF'; > >SGUDF.DLL is in C:\Program Files\Firebird\Firebird_2_5\UDF > >I get this message whe I try to execute the function: > >can't format message 13:896 -- message file C:\Windows\firebird.msg not >found. >invalid request BLR at offset 59. >function SG_DES is not defined. >module name or entrypoint could not be found. > >The DLL was rebuilded with Delphi XE2 for 64 bits... > >thanks! > >sergio > > > > >[Non-text portions of this message have been removed] > > >
[firebird-support] UDF 64 bits
Hello... I think I've posted this question before, but now can't find the thread... Anyway I still have the problem... An UDF that worked fine in FB 32 bits, in 64 bits doesn't work This is the DDL: DECLARE EXTERNAL FUNCTION SG_DES DOUBLE PRECISION, CSTRING(50) RETURNS DOUBLE PRECISION BY VALUE ENTRY_POINT 'Descuentos' MODULE_NAME 'SGUDF'; SGUDF.DLL is in C:\Program Files\Firebird\Firebird_2_5\UDF I get this message whe I try to execute the function: can't format message 13:896 -- message file C:\Windows\firebird.msg not found. invalid request BLR at offset 59. function SG_DES is not defined. module name or entrypoint could not be found. The DLL was rebuilded with Delphi XE2 for 64 bits... thanks! sergio [Non-text portions of this message have been removed]
Re: [firebird-support] UDF - reading BLOB length
Hi, I might be way off here - but exposed / exposed functions need to be called with the correct calling convention. Double check if it should be cdelc vs stdcall Also check that you declare your EXTERNAL declaration with the same calling convention (in your case: specify cdelc in your external declaration) First things I could think of. Regards Danie On Tue, Jul 31, 2012 at 1:47 PM, Josef Kokeš wrote: > Hi! > > What could possibly be wrong with the following UDF? > > * Function * > > type >TBlob = {packed} record > GetSegment: TISC_BlobGetSegment; > BlobHandle: PInt; > SegmentCount: LongInt; > MaxSegmentLength: LongInt; > TotalSize: LongInt; > PutSegment: TISC_BlobPutSegment; >end; >PBlob = ^TBlob; > > function BLOBLEN(Value: PBlob): Integer; cdecl; > begin >if Value = nil then > Result := 0 >else > Result := Value^.TotalSize; > end; > > * Declaration * > > DECLARE EXTERNAL FUNCTION BLOBLEN > BLOB > RETURNS INTEGER > ENTRY_POINT 'BLOBLEN' MODULE_NAME 'pwIBUDF'; > > * Usage * > > SELECT BLOBLEN(someblobfield) FROM sometable > > I expect to get a list of lengths of a particular BLOB field in the > table. In reality, I get an error on Firebird 1.5, 2.1 and 2.5. Error > log of FB 2.5 says: > > The user defined function: BLOBLEN >referencing entrypoint: BLOBLEN > in module: pwIBUDF > caused the fatal exception: Access violation. > The code attempted to access a virtual > address without privilege to do so. > This exception will cause the Firebird server > to terminate abnormally. > > Which seems rather strange, considering that Firebird was supposed to > pass me a valid BLOB descriptor - and in fact, in a similar function > (but one which returns BLOB contents as a string) apparently does. > > I'd welcome any pointers (no pun intended). > > Thanks, > > Josef > > > > > ++ > > Visit http://www.firebirdsql.org and click the Resources item > on the main (top) menu. Try Knowledgebase and FAQ links ! > > Also search the knowledgebases at http://www.ibphoenix.com > > ++ > Yahoo! Groups Links > > > > [Non-text portions of this message have been removed]
Re: [firebird-support] UDF - reading BLOB length
On 31.7.2012 14:12, Josef Kokeš wrote: > Nice - this will also fail with the same error: > > function BLOBLEN(Value: PBlob): Integer; cdecl; > begin > Result := 1; > end; > > I admit I find this very mystifying. Never mind, found it - the problem was not in the function, but in the SQL declaration - I need "RETURNS INTEGER BY VALUE" rather than "RETURNS INTEGER". Josef ++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [firebird-support] UDF - reading BLOB length
Nice - this will also fail with the same error: function BLOBLEN(Value: PBlob): Integer; cdecl; begin Result := 1; end; I admit I find this very mystifying. Josef > Hi! > > What could possibly be wrong with the following UDF? > > * Function * > > type > TBlob = {packed} record > GetSegment: TISC_BlobGetSegment; > BlobHandle: PInt; > SegmentCount: LongInt; > MaxSegmentLength: LongInt; > TotalSize: LongInt; > PutSegment: TISC_BlobPutSegment; > end; > PBlob = ^TBlob; > > function BLOBLEN(Value: PBlob): Integer; cdecl; > begin > if Value = nil then > Result := 0 > else > Result := Value^.TotalSize; > end; > > * Declaration * > > DECLARE EXTERNAL FUNCTION BLOBLEN > BLOB > RETURNS INTEGER > ENTRY_POINT 'BLOBLEN' MODULE_NAME 'pwIBUDF'; > > * Usage * > > SELECT BLOBLEN(someblobfield) FROM sometable > > I expect to get a list of lengths of a particular BLOB field in the > table. In reality, I get an error on Firebird 1.5, 2.1 and 2.5. Error > log of FB 2.5 says: > > The user defined function: BLOBLEN > referencing entrypoint: BLOBLEN > in module: pwIBUDF > caused the fatal exception: Access violation. > The code attempted to access a virtual > address without privilege to do so. > This exception will cause the Firebird server > to terminate abnormally. > > Which seems rather strange, considering that Firebird was supposed to > pass me a valid BLOB descriptor - and in fact, in a similar function > (but one which returns BLOB contents as a string) apparently does. > > I'd welcome any pointers (no pun intended). > > Thanks, > > Josef > > > > > ++ > > Visit http://www.firebirdsql.org and click the Resources item > on the main (top) menu. Try Knowledgebase and FAQ links ! > > Also search the knowledgebases at http://www.ibphoenix.com > > ++ > Yahoo! Groups Links > > > ++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[firebird-support] UDF - reading BLOB length
Hi! What could possibly be wrong with the following UDF? * Function * type TBlob = {packed} record GetSegment: TISC_BlobGetSegment; BlobHandle: PInt; SegmentCount: LongInt; MaxSegmentLength: LongInt; TotalSize: LongInt; PutSegment: TISC_BlobPutSegment; end; PBlob = ^TBlob; function BLOBLEN(Value: PBlob): Integer; cdecl; begin if Value = nil then Result := 0 else Result := Value^.TotalSize; end; * Declaration * DECLARE EXTERNAL FUNCTION BLOBLEN BLOB RETURNS INTEGER ENTRY_POINT 'BLOBLEN' MODULE_NAME 'pwIBUDF'; * Usage * SELECT BLOBLEN(someblobfield) FROM sometable I expect to get a list of lengths of a particular BLOB field in the table. In reality, I get an error on Firebird 1.5, 2.1 and 2.5. Error log of FB 2.5 says: The user defined function: BLOBLEN referencing entrypoint: BLOBLEN in module: pwIBUDF caused the fatal exception: Access violation. The code attempted to access a virtual address without privilege to do so. This exception will cause the Firebird server to terminate abnormally. Which seems rather strange, considering that Firebird was supposed to pass me a valid BLOB descriptor - and in fact, in a similar function (but one which returns BLOB contents as a string) apparently does. I'd welcome any pointers (no pun intended). Thanks, Josef ++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[firebird-support] UDF & ISC_QUAD typedef compiled with gcc (64 bit )
Hi! Current c code : typedef struct { #ifdef __LP64__ signed long slong; unsigned long ulong; #else signed int slong; unsigned int ulong; #endif } ISC_QUAD; It's OK on win32, win64, linux32. It's not ON linux64, time fraction is incorrect. What do I need to change to get good result on linux64? PS: It's also strange that win64 is OK, but linux64 not.
Re: [firebird-support] UDF memory allocation for result string in Linux
On 2012-04-17 08:01, ma_golyo wrote: > I use ib_util_malloc in my Win version, no problem there. What should I use > in Linux version? Currently memory allocated with malloc. Include ib_util.h in your UDF's source (it's located by default in /opt/firebird/include) or explicitly declare void* ib_util_malloc(size_t) at the beginning of the source module, use ib_util_malloc instead of C's malloc, and link against ib_util (libib_util.so is by default located in /opt/firebird/lib). Your compilation command line should look like this: gcc -O -fPIC -shared -I/opt/firebird/include -L/opt/firebird/lib \ -oUDF3s.so UDF3s.c -lib_util -lstdc++ -lm -lc (I'm not sure whether libstdc++ is necessary, sometimes it is). regards Tomasz -- __--==--__ __--== Tomasz Tyrakowski==--__ __--==SOL-SYSTEM==--__ __--== http://www.sol-system.pl ==--__ __--==--__
[firebird-support] UDF memory allocation for result string in Linux
Hi! When I run my UDF (udf_op), I get an error : "Bad written UDF detected: pointer returned in FREE_IT function was not allocated by ib_util_malloc" I use ib_util_malloc in my Win version, no problem there. What should I use in Linux version? Currently memory allocated with malloc. SQL: DECLARE EXTERNAL FUNCTION UDF_OP RETURNS CSTRING(10) FREE_IT ENTRY_POINT 'udf_op' MODULE_NAME 'UDF3s'; C: char * udf_op(); char * udf_op() { char *buffer = (char *)malloc(10); strncpy(buffer, "Linux", 6); return buffer; } C compiled with : gcc -c -O -fpic UDF3s.c ld -G UDF3s.o -lm -lc -o UDF3s.so Thank You!
RE: [firebird-support] UDF Question(s) - a couple more
Hi Set, I think Ive removed all the dependencies. I rewrote the AgeInMonths in a stored procedure after looking at the source code for the UDF in FreeUDFLib. Current_Date does appear to be supported in FB 1.56. And thankfully, the Extract method is also supported so I can get the year, month and day parts from a date. Now I just need to figure out an ODBC issue Im having which is really bubbling up on the priority scale. Cheers! Kevin From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Svein Erling Tysvær Sent: Monday, March 19, 2012 1:44 AM To: firebird-support@yahoogroups.com Subject: RE: [firebird-support] UDF Question(s) - a couple more On 16-3-2012 17:13, Kevin Stanton wrote: > Greetings, > > I believe I'm down to just 3 UDFs and was wondering if there are any > replacements for: > > F_ADDMONTH > F_ADDYEAR > F_AGEINMONTHS > > > Also, is there a place where I can get a list of all functions for FB > 1.56 (and beyond)? I've taken a quick look but it's not jumping out at me. > >Upgrading to Firebird 2.1 or higher would give you DATEADD and DATEDIFF (see >http://www.firebirdsql.org/file/documentation/reference_manuals/reference_m aterial/html/langrefupd25-intfunc.html >) > >For F_ADDMONTH and F_ADDYEAR you could use the Firebird provided udfs addMonth and addYear (see >http://www.firebirdsql.org/file/documentation/reference_manuals/reference_m aterial/html/langrefupd25-udf.html) And it ought to be reasonably simple to calculate AgeInMonths on the fly: (extract(year from current_date)-extract(year from MyBirthDate))*12+ extract(month from current_date)-extract(month from MyBirthDate)- case when extract(day from current_date) < extract(day from MyBirthDate) then 1 else 0 end A couple of things to note: - I do not have Fb 1.5 available now, and am uncertain whether current_date is supported - I've never used F_AGEINMONTHS, but assume it truncates rather than rounds, e.g. that 29 February 2012 - 30 January 2011 should return 12 and not 13 since it hasn't reached 30 February yet (i.e. 1 March). HTH, Set [Non-text portions of this message have been removed]
RE: [firebird-support] UDF Question(s) - a couple more
On 16-3-2012 17:13, Kevin Stanton wrote: > Greetings, > > I believe I'm down to just 3 UDFs and was wondering if there are any > replacements for: > > F_ADDMONTH > F_ADDYEAR > F_AGEINMONTHS > > > Also, is there a place where I can get a list of all functions for FB > 1.56 (and beyond)? I've taken a quick look but it's not jumping out at me. > >Upgrading to Firebird 2.1 or higher would give you DATEADD and DATEDIFF (see >>http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-intfunc.html >) > >For F_ADDMONTH and F_ADDYEAR you could use the Firebird provided udfs addMonth >and addYear (see >>http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-udf.html) And it ought to be reasonably simple to calculate AgeInMonths on the fly: (extract(year from current_date)-extract(year from MyBirthDate))*12+ extract(month from current_date)-extract(month from MyBirthDate)- case when extract(day from current_date) < extract(day from MyBirthDate) then 1 else 0 end A couple of things to note: - I do not have Fb 1.5 available now, and am uncertain whether current_date is supported - I've never used F_AGEINMONTHS, but assume it truncates rather than rounds, e.g. that 29 February 2012 - 30 January 2011 should return 12 and not 13 since it hasn't reached 30 February yet (i.e. 1 March). HTH, Set
Re: [firebird-support] UDF Question(s) - a couple more
On 16-3-2012 17:13, Kevin Stanton wrote: > Greetings, > > I believe I'm down to just 3 UDFs and was wondering if there are any > replacements for: > > F_ADDMONTH > F_ADDYEAR > F_AGEINMONTHS > > > Also, is there a place where I can get a list of all functions for FB 1.56 > (and beyond)? I've taken a quick look but it's not jumping out at me. Upgrading to Firebird 2.1 or higher would give you DATEADD and DATEDIFF (see http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-intfunc.html ) For F_ADDMONTH and F_ADDYEAR you could use the Firebird provided udfs addMonth and addYear (see http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-udf.html ) Mark -- Mark Rotteveel
RE: [firebird-support] UDF Question(s) - a couple more
Greetings, I believe I'm down to just 3 UDFs and was wondering if there are any replacements for: F_ADDMONTH F_ADDYEAR F_AGEINMONTHS Also, is there a place where I can get a list of all functions for FB 1.56 (and beyond)? I've taken a quick look but it's not jumping out at me. Thanks! Kevin > -Original Message- > From: firebird-support@yahoogroups.com [mailto:firebird- > supp...@yahoogroups.com] On Behalf Of Iwan Cahyadi Sugeng > Sent: Friday, March 16, 2012 7:11 AM > To: firebird-support@yahoogroups.com > Subject: Re: [firebird-support] UDF Question(s) > > Try This : > > On Fri, Mar 16, 2012 at 8:52 PM, Kevin Stanton < Kevin.Stanton@rdb- > solutions.com> wrote: > > > ** > > > > > > Greetings, > > > > I'm trying to eliminate the need for the FreeUDFLib so I can have the > > option of running Firebird 32-bit or 64-bit. > > > > I believe I'm down to 4 UDFs - are there any replacement for the following: > > > > F_DAY (extracts the day from a passed date) > > > Extract (Day from Table.Date) > > > > > F_MONTH (extracts the month from a passed date) > > > > Extract (Month from Table.Date) > > > F_YEAR (extracts the year from a passed date) > > > > Extract (Year from Table.Date) > > > F_AGEINDAYS (returns an integer with the number of days between two > > parameter dates) > > > > DateDiff(Day, Table.StartDate, Table.EndDate) (available in fb2.1 and > above) > > > Thanks in advance, > > > > Kevin > > > > ~ > > > > Kevin Stanton > > > > RDB Solutions > > > > P: 503-705-0834 > > > > F: 503-822-0178 > > > > [Non-text portions of this message have been removed] > > > > > > > > > > -- > Iwan Cahyadi Sugeng > Interaktif Cipta Lestari > > > [Non-text portions of this message have been removed] > > > > > > ++ > > > Visit http://www.firebirdsql.org and click the Resources item > on the main (top) menu. Try Knowledgebase and FAQ links ! > > Also search the knowledgebases at http://www.ibphoenix.com > > ++ > > Yahoo! Groups Links > > >
Re: [firebird-support] UDF Question(s)
Try This : On Fri, Mar 16, 2012 at 8:52 PM, Kevin Stanton < kevin.stan...@rdb-solutions.com> wrote: > ** > > > Greetings, > > I'm trying to eliminate the need for the FreeUDFLib so I can have the > option > of running Firebird 32-bit or 64-bit. > > I believe I'm down to 4 UDFs - are there any replacement for the following: > > F_DAY (extracts the day from a passed date) > Extract (Day from Table.Date) > > F_MONTH (extracts the month from a passed date) > > Extract (Month from Table.Date) > F_YEAR (extracts the year from a passed date) > > Extract (Year from Table.Date) > F_AGEINDAYS (returns an integer with the number of days between two > parameter dates) > > DateDiff(Day, Table.StartDate, Table.EndDate) (available in fb2.1 and above) > Thanks in advance, > > Kevin > > ~ > > Kevin Stanton > > RDB Solutions > > P: 503-705-0834 > > F: 503-822-0178 > > [Non-text portions of this message have been removed] > > > -- Iwan Cahyadi Sugeng Interaktif Cipta Lestari [Non-text portions of this message have been removed] ++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [firebird-support] UDF Question(s)
Perfect! those work in 1.56. J I have tried (quickly) the date2 date1 and it does seem to return an integer. More testing to do but all looks good. Thanks for the help! Kevin From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Svein Erling Tysvær Sent: Friday, March 16, 2012 7:05 AM To: 'firebird-support@yahoogroups.com' Subject: RE: [firebird-support] UDF Question(s) >Greetings, > >I'm trying to eliminate the need for the FreeUDFLib so I can have the option of running Firebird 32-bit or 64-bit. >I believe I'm down to 4 UDFs - are there any replacement for the following: >F_DAY (extracts the day from a passed date) >F_MONTH (extracts the month from a passed date) >F_YEAR (extracts the year from a passed date) >F_AGEINDAYS (returns an integer with the number of days between two parameter dates) >One last thing: I'm using FB 1.56. > >Thanks in advance, Are you saying that EXTRACT(DAY FROM ) EXTRACT(MONTH FROM ) EXTRACT(YEAR FROM ) - Doesn't work? I assume you're using Dialect 3, I think Dialect 1 DATE = Dialect 3 TIMESTAMP. HTH, Set [Non-text portions of this message have been removed]
RE: [firebird-support] UDF Question(s)
Hi Set should those functions be in FB 1.56? I will go test. Thanks, Kevin From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Svein Erling Tysvær Sent: Friday, March 16, 2012 7:05 AM To: 'firebird-support@yahoogroups.com' Subject: RE: [firebird-support] UDF Question(s) >Greetings, > >I'm trying to eliminate the need for the FreeUDFLib so I can have the option of running Firebird 32-bit or 64-bit. >I believe I'm down to 4 UDFs - are there any replacement for the following: >F_DAY (extracts the day from a passed date) >F_MONTH (extracts the month from a passed date) >F_YEAR (extracts the year from a passed date) >F_AGEINDAYS (returns an integer with the number of days between two parameter dates) >One last thing: I'm using FB 1.56. > >Thanks in advance, Are you saying that EXTRACT(DAY FROM ) EXTRACT(MONTH FROM ) EXTRACT(YEAR FROM ) - Doesn't work? I assume you're using Dialect 3, I think Dialect 1 DATE = Dialect 3 TIMESTAMP. HTH, Set [Non-text portions of this message have been removed]
RE: [firebird-support] UDF Question(s)
Thanks for the info Jerry! From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Jerry Sands Sent: Friday, March 16, 2012 7:02 AM To: firebird-support@yahoogroups.com Subject: RE: [firebird-support] UDF Question(s) Oh, FB 1.56 - well good luck then - Jerry From: firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> [mailto:firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> ] On Behalf Of Kevin Stanton Sent: Friday, March 16, 2012 9:00 AM To: firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> Subject: RE: [firebird-support] UDF Question(s) One last thing: I'm using FB 1.56. Thank you, Kevin From: firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> <mailto:firebird-support%40yahoogroups.com> [mailto:firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> <mailto:firebird-support%40yahoogroups.com> ] On Behalf Of Kevin Stanton Sent: Friday, March 16, 2012 6:53 AM To: Firebird Support Subject: [firebird-support] UDF Question(s) Greetings, I'm trying to eliminate the need for the FreeUDFLib so I can have the option of running Firebird 32-bit or 64-bit. I believe I'm down to 4 UDFs - are there any replacement for the following: F_DAY (extracts the day from a passed date) F_MONTH (extracts the month from a passed date) F_YEAR (extracts the year from a passed date) F_AGEINDAYS (returns an integer with the number of days between two parameter dates) Thanks in advance, Kevin ~ Kevin Stanton RDB Solutions P: 503-705-0834 F: 503-822-0178 [Non-text portions of this message have been removed] [Non-text portions of this message have been removed] [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]
RE: [firebird-support] UDF Question(s)
>Greetings, > >I'm trying to eliminate the need for the FreeUDFLib so I can have the option >of running Firebird 32-bit or 64-bit. >I believe I'm down to 4 UDFs - are there any replacement for the following: >F_DAY (extracts the day from a passed date) >F_MONTH (extracts the month from a passed date) >F_YEAR (extracts the year from a passed date) >F_AGEINDAYS (returns an integer with the number of days between two parameter >dates) >One last thing: I'm using FB 1.56. > >Thanks in advance, Are you saying that EXTRACT(DAY FROM ) EXTRACT(MONTH FROM ) EXTRACT(YEAR FROM ) - Doesn't work? I assume you're using Dialect 3, I think Dialect 1 DATE = Dialect 3 TIMESTAMP. HTH, Set
RE: [firebird-support] UDF Question(s)
Oh, FB 1.56 - well good luck then - Jerry From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Kevin Stanton Sent: Friday, March 16, 2012 9:00 AM To: firebird-support@yahoogroups.com Subject: RE: [firebird-support] UDF Question(s) One last thing: I'm using FB 1.56. Thank you, Kevin From: firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> [mailto:firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> ] On Behalf Of Kevin Stanton Sent: Friday, March 16, 2012 6:53 AM To: Firebird Support Subject: [firebird-support] UDF Question(s) Greetings, I'm trying to eliminate the need for the FreeUDFLib so I can have the option of running Firebird 32-bit or 64-bit. I believe I'm down to 4 UDFs - are there any replacement for the following: F_DAY (extracts the day from a passed date) F_MONTH (extracts the month from a passed date) F_YEAR (extracts the year from a passed date) F_AGEINDAYS (returns an integer with the number of days between two parameter dates) Thanks in advance, Kevin ~ Kevin Stanton RDB Solutions P: 503-705-0834 F: 503-822-0178 [Non-text portions of this message have been removed] [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]
RE: [firebird-support] UDF Question(s)
Extract(Day from MyDate) Extract(Month from MyDate) Extract(Year from MyDate) DateDiff(Day from FirstDate to SecondDate) (you can substitute Month, Week, Hour, Minute, Second, and MilleSecond as well. These are all in FB V2.1 I'm trying to eliminate the need for the FreeUDFLib so I can have the option of running Firebird 32-bit or 64-bit. I believe I'm down to 4 UDFs - are there any replacement for the following: F_DAY (extracts the day from a passed date) F_MONTH (extracts the month from a passed date) F_YEAR (extracts the year from a passed date) F_AGEINDAYS (returns an integer with the number of days between two parameter dates) Thanks in advance, Kevin _,_._,___ [Non-text portions of this message have been removed]
RE: [firebird-support] UDF Question(s)
One last thing: I'm using FB 1.56. Thank you, Kevin From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Kevin Stanton Sent: Friday, March 16, 2012 6:53 AM To: Firebird Support Subject: [firebird-support] UDF Question(s) Greetings, I'm trying to eliminate the need for the FreeUDFLib so I can have the option of running Firebird 32-bit or 64-bit. I believe I'm down to 4 UDFs - are there any replacement for the following: F_DAY (extracts the day from a passed date) F_MONTH (extracts the month from a passed date) F_YEAR (extracts the year from a passed date) F_AGEINDAYS (returns an integer with the number of days between two parameter dates) Thanks in advance, Kevin ~ Kevin Stanton RDB Solutions P: 503-705-0834 F: 503-822-0178 [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]
[firebird-support] UDF Question(s)
Greetings, I'm trying to eliminate the need for the FreeUDFLib so I can have the option of running Firebird 32-bit or 64-bit. I believe I'm down to 4 UDFs - are there any replacement for the following: F_DAY (extracts the day from a passed date) F_MONTH (extracts the month from a passed date) F_YEAR (extracts the year from a passed date) F_AGEINDAYS (returns an integer with the number of days between two parameter dates) Thanks in advance, Kevin ~ Kevin Stanton RDB Solutions P: 503-705-0834 F: 503-822-0178 [Non-text portions of this message have been removed]
Re: [firebird-support] UDF
> Hello, this is related to my previous post... I'm trying to write a UDF > in Delphi... It's declared like this: > > function Descuentos(var Suma:currency;Descuentos:pchar):double; cdecl; > export; > > DECLARE EXTERNAL FUNCTION SG_DES > DOUBLE PRECISION, > CSTRING(50) > RETURNS DOUBLE PRECISION BY VALUE > ENTRY_POINT 'Descuentos' MODULE_NAME 'SGUDF'; Delphi type Currency is not the same thing as Firebird type DOUBLE PRECISION. Change the Delphi declaration to: function Descuentos(var Suma:double;Descuentos:pchar):double; cdecl; export; Pepak ++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[firebird-support] UDF
Hello, this is related to my previous post... I'm trying to write a UDF in Delphi... It's declared like this: interface function Descuentos(var Suma:currency;Descuentos:pchar):double; cdecl; export; implementation function Descuentos(var Suma:currency;Descuentos:pchar):double; begin // JUST TRYING... result := Suma; end; In FB is declared like this: DECLARE EXTERNAL FUNCTION SG_DES DOUBLE PRECISION, CSTRING(50) RETURNS DOUBLE PRECISION BY VALUE ENTRY_POINT 'Descuentos' MODULE_NAME 'SGUDF'; And if I do this: select sg_des(precio,''), precio from stock where precio <> 0 the first column brings values like this: 462238206754239.312 462128431513322.125 463114860569204.625 this select select sg_des(1,'') from rdb$database shows this 460718241880001.75 what I'm doing wrong?? Thanks!!! -sergio