[firebird-support] Question on UDF's
Hi: Any insight appreciated. Installed FB 2.5 on win 10. Using IB_SQL.exe for access. GDB is from an old IB 6.02 which works flawlessly on XP I have several of my UDF libs in udf dir When I open w IB_SQL. exe and look at UDF's all I get showing are 6 from ib_sql and shows error "Unexpected boolean value". 1. the ib_udf which is the source of these errors came with FB 2.5 2. There are other udf's in ib_udf (according to Chapter 15 External Functions and listing below) which are not reporting errors.Why? 3. The ib_udf.sql shows many UDF's commented out which are reporting errors as below: Why? /* * * a b s * * * * Functional description: * Returns the absolute value of a * number. * * DECLARE EXTERNAL FUNCTION abs DOUBLE PRECISION RETURNS DOUBLE PRECISION BY VALUE ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf'; */ 4. My UDF's don't show up in ib_sql dialog under UDF's. Why not? I know they are working since procedures using my UDF's reported errors until I copied my libs in the UDF directory and are included below. All this is very confusing. Below is RDB$FUNCTIONS. They are all here Highlighted one are returning the boolean error *'ABS',0,'','','ib_udf','IB_UDF_abs',0,NULL** **'ACOS',0,'','','ib_udf','IB_UDF_acos',0,NULL** **'ASCII_CHAR',0,'','','ib_udf','IB_UDF_ascii_char',0,NULL** **'ASCII_VAL',0,'','','ib_udf','IB_UDF_ascii_val',0,NULL** **'ASIN',0,'','','ib_udf','IB_UDF_asin',0,NULL** **'ATAN',0,'','','ib_udf','IB_UDF_atan',0,NULL** **'ATAN2',0,'','','ib_udf','IB_UDF_atan2',0,NULL* 'BIN_AND',0,'','','ib_udf','IB_UDF_bin_and',0,NULL 'BIN_OR',0,'','','ib_udf','IB_UDF_bin_or',0,NULL 'BIN_XOR',0,'','','ib_udf','IB_UDF_bin_xor',0,NULL 'CEILING',0,'','','ib_udf','IB_UDF_ceiling',0,NULL 'COS',0,'','','ib_udf','IB_UDF_cos',0,NULL 'COSH',0,'','','ib_udf','IB_UDF_cosh',0,NULL 'COT',0,'','','ib_udf','IB_UDF_cot',0,NULL 'DIV',0,'','','ib_udf','IB_UDF_div',0,NULL 'FLOOR',0,'','','ib_udf','IB_UDF_floor',0,NULL 'LN',0,'','','ib_udf','IB_UDF_ln',0,NULL 'LOG',0,'','','ib_udf','IB_UDF_log',0,NULL 'LOG10',0,'','','ib_udf','IB_UDF_log10',0,NULL 'LOWER',0,'','','ib_udf','IB_UDF_lower',0,NULL 'LTRIM',0,'','','ib_udf','IB_UDF_ltrim',0,NULL 'MOD',0,'','','ib_udf','IB_UDF_mod',0,NULL 'PI',0,'','','ib_udf','IB_UDF_pi',0,NULL 'RAND',0,'','','ib_udf','IB_UDF_rand',0,NULL 'RTRIM',0,'','','ib_udf','IB_UDF_rtrim',0,NULL 'SIGN',0,'','','ib_udf','IB_UDF_sign',0,NULL 'SIN',0,'','','ib_udf','IB_UDF_sin',0,NULL 'SINH',0,'','','ib_udf','IB_UDF_sinh',0,NULL 'SQRT',0,'','','ib_udf','IB_UDF_sqrt',0,NULL 'SUBSTR',0,'','','ib_udf','IB_UDF_substr',0,NULL 'STRLEN',0,'','','ib_udf','IB_UDF_strlen',0,NULL 'TAN',0,'','','ib_udf','IB_UDF_tan',0,NULL 'TANH',0,'','','ib_udf','IB_UDF_tanh',0,NULL 'CLEARIBLOG',0,'','','ltudf','fn_ClearIbLog',0,NULL 'DELETEIBBACKUP',0,'','','ltudf','fn_DeleteIbBackup',0,NULL 'COPYIBDATABASE',0,'','','ltudf','fn_CopyIbDatabase',0,NULL 'PROPERCASESTRING',0,'','','strudf','fn_ProperCaseString',0,NULL 'F_ABS',0,'','','FreeAdhocUDF','doubleabs',0,NULL 'F_ADDDAY',0,'','','FreeAdhocUDF','addday',0,NULL 'F_ADDHOUR',0,'','','FreeAdhocUDF','addhour',0,NULL 'F_ADDMINUTE',0,'','','FreeAdhocUDF','addminute',0,NULL 'F_ADDMONTH',0,'','','FreeAdhocUDF','addmonth',0,NULL 'F_ADDSECOND',0,'','','FreeAdhocUDF','addsecond',0,NULL 'F_ADDWEEK',0,'','','FreeAdhocUDF','addweek',0,NULL 'F_ADDYEAR',0,'','','FreeAdhocUDF','addyear',0,NULL 'F_AGEINDAYS',0,'','','FreeAdhocUDF','ageindays',0,NULL 'F_AGEINDAYSTHRESHOLD',0,'','','FreeAdhocUDF','ageindaysthreshold',0,NULL 'F_AGEINHOURS',0,'','','FreeAdhocUDF','ageinhours',0,NULL 'F_AGEINHOURSTHRESHOLD',0,'','','FreeAdhocUDF','ageinhoursthreshold',0,NULL 'F_AGEINMINUTES',0,'','','FreeAdhocUDF','ageinminutes',0,NULL 'F_AGEINMINUTESTHRESHOLD',0,'','','FreeAdhocUDF','ageinminutes threshold',0,NULL 'F_AGEINMONTHS',0,'','','FreeAdhocUDF','ageinmonths',0,NULL 'F_AGEINMONTHSTHRESHOLD',0,'','','FreeAdhocUDF','ageinmonthsthreshold',0,NULL 'F_AGEINSECONDS',0,'','','FreeAdhocUDF','ageinseconds',0,NULL 'F_AGEINSECONDSTHRESHOLD',0,'','','FreeAdhocUDF','ageinsecondsthreshold',0,NULL 'F_AGEINWEEKS',0,'','','FreeAdhocUDF','ageinweeks',0,NULL 'F_AGEINWEEKSTHRESHOLD',0,'','','FreeAdhocUDF','ageinweeksthreshold',0,NULL 'F_AGEINYEARS',0,'','','FreeAdhocUDF','ageinyears',0,NULL 'F_AGEINYEARSTHRESHOLD',0,'','','FreeAdhocUDF','ageinyearsthreshold',0,NULL 'F_ANSILOWERCASE',0,'','','FreeAdhocUDF','lower',0,NULL 'F_ANSIUPPERCASE',0,'','','FreeAdhocUDF','upper',0,NULL 'F_BIGLEFT',0,'','','FreeAdhocUDF','left',0,NULL 'F_BIGLRTRIM',0,'','','FreeAdhocUDF','lrtrim',0,NULL 'F_BIGLTRIM',0,'','','FreeAdhocUDF','ltrim',0,NULL 'F_BIGMID',0,'','','FreeAdhocUDF','mid',0,NULL 'F_BIGREPLACE',0,'','','FreeAdhocUDF','replace',0,NULL 'F_BIGREPLACESTRING',0,'','','FreeAdhocUDF','replacestring',0,NULL 'F_BIGRIGHT',0,'','','FreeAdhocUDF','right',0,NULL
Re: [firebird-support] Sequential auto incremental numbering
On Wed, Sep 5, 2018 at 10:07 AM, Gabor Boros mlngl...@bgss.hu [firebird-support] wrote: > 2018. 09. 02. 17:03 keltezéssel, 'Christian Giesen' ch...@xt.co.za > [firebird-support] írta: > > > > > I have a need to generate unique sequential invoice/credit note numbers.. > > I fully understand the usage of generators to produce unique identifiers > > in tables. However, according to Firebird documentation the use of > > generators does NOT guarantee sequential numbering. > Right. Generators are outside transaction control. Once they're allocated, they're gone. Rolling back the transaction that created the value does not reset the generator so it leaves a hole in the sequence. Selecting max(whatever) from ... doesn't work either, except single user, because two concurrent transactions can see the same max value. Creating monotonically increasing serial number with no gaps requires serializing concurrent transactions. Anything else is going to risk leaving gaps. > > I use and suggest a table instead of generator. More flexible and > transaction controlled solution. If you need more than one (and > independent) sequential number just use same table with more records. > The simplest way to create monotonically increasing serial numbers is to create a table A with one long integer column. Store an initial value in it. For your application, start a transaction, update table A setting the column to itself plus one and returning the value of the column. If the update fails, rollback the transaction and start a new one. When the update succeeds, you've got your serial identifier. If there's an error in subsequent database activities, roll the transaction back and retry the whole thing. The roll back will reset the serial identifier column. Good luck, Ann
ODP: [firebird-support] Before Insert or After Insert trigger?
Hi, >> Now I need to set a fields in the same table like this to track the >>updates performed: If you need to update same table then „before” update trigger is the best choice. If you use after and run there UPDATE command you must take into accout recursive call. Your update command run then triggers once again and if your check condition do not stop another UPDATE command you got endless recursion, stopped in some point by engine with an error >>Updating another table from a Before trigger is made in a transaction >>that rolling back if exception occurs? If you do not run it in different transaction context - like IN AUTONOMOUS TRANSACTION - then yes regards, Karol Bieniaszewski Od: Luigi Siciliano luigi...@tiscalinet.it [firebird-support] Wysłano: czwartek, 6 września 2018 08:53 Do: firebird-support@yahoogroups.com Temat: [firebird-support] Before Insert or After Insert trigger? Hallo, I have an After Insert/Update trigger for a table to update another table like this: if (NEW.AGGIORNA_CONDIZIONI = 1) then begin update ARTICOLI_CONDIZIONI_CLIENTI ACC SET end else if ... Now I need to set a fields in the same table like this to track the updates performed: CONDIZIONI_AGGIORNATE = NEW.AGGIORNA_CONDIZIONI, AGGIORNA_CONDIZIONI = 0 /* no conditions to update */ To do this I must change from After Insert/Update trigger in Before Insert/Update trigger. Is this safe or I must do other behaviour? Updating another table from a Before trigger is made in a transaction that rolling back if exception occurs? Thanks. -- Luigi Siciliano -- ++ 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
[firebird-support] Before Insert or After Insert trigger?
Hallo, I have an After Insert/Update trigger for a table to update another table like this: if (NEW.AGGIORNA_CONDIZIONI = 1) then begin update ARTICOLI_CONDIZIONI_CLIENTI ACC SET end else if ... Now I need to set a fields in the same table like this to track the updates performed: CONDIZIONI_AGGIORNATE = NEW.AGGIORNA_CONDIZIONI, AGGIORNA_CONDIZIONI = 0 /* no conditions to update */ To do this I must change from After Insert/Update trigger in Before Insert/Update trigger. Is this safe or I must do other behaviour? Updating another table from a Before trigger is made in a transaction that rolling back if exception occurs? Thanks. -- Luigi Siciliano -- ++ 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/