Subject | Re: [ib-support] udf crashes firebird |
---|---|
Author | Ivan Prenosil |
Post date | 2003-05-19T12:11:06Z |
From: "Nick Upson" <uebridger@...>
Subject: [ib-support] udf crashes firebird
Do you use
... RETURNS INTEGER BY VALUE; ?
2) There is EXTRACT built-in function (not in IB4, IB5 though),
to return Monday = 1, .. Sun = 7, use it that way
EXTRACT(WEEKDAY FROM my_date_field - 1) + 1
Ivan Prenosil
[ I am looking for a job: InterBase - Firebird - Delphi - C - fulltext db - and more ... ]
Ivan.Prenosil@...
http://www.volny.cz/iprenosil/interbase
Subject: [ib-support] udf crashes firebird
> gratefull thanks to anyone who can tell me why1) how does your UDF declaration look like ?
>
> /* ==============================================================
> fn_dowi() return the day of today as integer, Monday = 1, Sun = 7, etc
> ============================================================== */
> int fn_dowi()
> {
> struct tm tmem, *tbuf = &tmem;
>
> localtime_r(time(NULL), tbuf);
> return (tbuf->tm_wday);
> }
Do you use
... RETURNS INTEGER BY VALUE; ?
2) There is EXTRACT built-in function (not in IB4, IB5 though),
to return Monday = 1, .. Sun = 7, use it that way
EXTRACT(WEEKDAY FROM my_date_field - 1) + 1
Ivan Prenosil
[ I am looking for a job: InterBase - Firebird - Delphi - C - fulltext db - and more ... ]
Ivan.Prenosil@...
http://www.volny.cz/iprenosil/interbase