You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a personnal udf library that works since a long time ago, from firebird 1 to firebird 2.5 (classic server 32 bits only)
Trying to migrate to firebird superserver 64 bits.
Own source compiled without troubles in 64 bits mode, using gcc
linking OK (using ld) excepts necessity to make a symbolink link to http://fbudf.so in /var/lib64 otherwire, http://fbudf.so is not found found when executing (small bug in firebird installation ?)
But all functions that uses isc_encode_timestamp or isc_decode_timestamp makes firebird superserver crash.
This code code works on Firebird classique 32 bits, (Linux and windows) not on firebird superserver 64 bits.
Don't know about firebird-superserver 32 bits.
The text was updated successfully, but these errors were encountered:
Out of curiosity, why you declare struct tm yourself instead of using the standard one from time.h?
Why do you need a memory leak? I see currtime allocated dynamically and the new pointer is lost two lines below.
How is this UDF declared in the database?
Hi, sorry, i reply to you via email and it seems that you've not received my answer, so, i repeat it :
First thanks for your message : you're the first one who answsers me.
Before registering on firebird bu tracker, I've tried everything during 10 days.
replacing ib_malloc by malloc, using time.h instead of declaring my own tm structure etc....
If I ask the trackers, this is because I don't know what to do and I don't found any answser in google.
But You have to know that I've tried a very small udf that just do an is_encode_timestamp with the same issue.
This is strange because It works with firebird classic 32 bits for a long time, using on result sets with hundred of thousands rows and it works with a single test programme using this shared object
So, to answer your question this is how I've declared this functions in Firebird :
Usage is : select First_Day_Of(1,-1) from rdb$database give you the first day of january of the last year (2012-01-01')
replace second parameter (-1) by 0 to change to the current year, by 1 to change to the next year and so on.
replace first parameter by 2..12 to change the month
Submitted by: christophe derenne (cdr60530)
Votes: 1
Using a personnal udf library that works since a long time ago, from firebird 1 to firebird 2.5 (classic server 32 bits only)
Trying to migrate to firebird superserver 64 bits.
Own source compiled without troubles in 64 bits mode, using gcc
linking OK (using ld) excepts necessity to make a symbolink link to http://fbudf.so in /var/lib64 otherwire, http://fbudf.so is not found found when executing (small bug in firebird installation ?)
But all functions that uses isc_encode_timestamp or isc_decode_timestamp makes firebird superserver crash.
Exemple :
ISC_TIMESTAMP * First_Day_Of(int *,int *);
ISC_TIMESTAMP * First_Day_Of(mm,aa)
{
ISC_TIMESTAMP *buffer = (ISC_TIMESTAMP*)ib_util_malloc(sizeof(ISC_TIMESTAMP));
time_t t;
typedef struct tm tm;
struct tm{
int tm_sec;int tm_min;int tm_hour;
int tm_mday;int tm_mon;int tm_year;
int tm_wday;int tm_yday;int tm_isdst;
};
tm *currtime = (tm*)ib_util_malloc(sizeof( tm));
t = time(NULL);
currtime = localtime(&t);
currtime->tm_year = ( *aa + currtime->tm_year );
currtime->tm_mon = ( *mm - 1 );
currtime->tm_mday = 1;
currtime->tm_sec = 0;
currtime->tm_min = 0;
currtime->tm_hour = 0;
isc_encode_timestamp(currtime,buffer);
return buffer;
}
This code code works on Firebird classique 32 bits, (Linux and windows) not on firebird superserver 64 bits.
Don't know about firebird-superserver 32 bits.
The text was updated successfully, but these errors were encountered: