FreeUDFLib

A Free UDF Library for InterBase Servers

Gregory H. Deatz


Table of Contents


Introduction

FreeUDFLib is a free UDF library for use with InterBase databases. It is written in Delphi, and all source code is provided. Just because it is free, however, does not mean that it is public domain. If you have questions regarding your rights, please see see section Licensing.

Acknowledgements

Hoagland, Longo, Moran, Dunst & Doukas

Hoagland, Longo, Moran, Dunst & Doukas is a law firm in New Brunswick, NJ. This law firm is one of the most technologically advanced law firms in New Jersey, due largely to the fact that their management team has a uniquely clear vision of the future use of technology in the legal field.

Hoagland, Longo, Moran, Dunst & Doukas is dedicated to providing quality legal services to the business community, healthcare and insurance industries. Since our founding in 1977 we have handled thousands of matters spanning the spectrum of business transactions and civil litigation including automobile negligence, commercial litigation, construction claims, coverage, D and O liability, employment practices liability, environmental claims, general liability, municipal liability, products liability, professional liability and workers compensation.

Very special thanks goes to Hoagland, Longo, Moran, Dunst & Doukas. If you ever require legal representation in the New Jersey area, you might want to look these guys up.

InterBase corporation

InterBase corporation has provided their support by providing a home for both FreeUDFLib and FreeUDFLib (see section About the author).

Obviously, without InterBase, FreeUDFLib would be virtually meaningless, so a special thanks goes to all at InterBase, with a strong vote of support to please continue the outstanding work!

Contributors and supporters

Here is a list of all who have contributed or otherwise supported the project. If your name has been omitted, it is not on purpose:

  • Oleg Kukarthev, Gerard Perreault, Stephen W. Boyd, Doug Chamberlin, rberryman@earhlink.net, John Small (john@yagya.demon.co.uk), Graham Bremner (graham_bremner@hlmdd.com), Serge Vannieuwenborgh (sva@netsol.be), brentrose@clear.net.nz.

    Technical support

    Since FreeUDFLib is free, it is important to give developers a sense of what kind of support they can expect. Although there are no guarantees of any kind, I want to give developers reasonable assurances of what they can, in general, expect from me.

    I believe that there are four basic levels of support developers require:

    1. Prompt bug resolution.
    2. Thorough documentation.
    3. Wish lists.
    4. Standard help-desk style support. (How do I do ...? When should I do ... ?)

    Bugs

    FreeUDFLib is intended to be used in production environments! To that end, a demonstrated bug will be fixed as promptly as possible.

    Because FreeUDFLib is completely free, developers also have access to the source code. If a bug is fixed, send it to me, and I will incorporate it in future "official releases" of the product.

    If a bug cannot be replicated, I will have a difficult time finding it, so I can't guarantee resolution of these so-called phantom bugs, but I will do my best to resolve them.

    If you provide me with a bug fix, your name will be included in the acknowledgements section of this manual. Bug reports should be submitted as e-mail messages only.

    Documentation

    The policy on resolving source code bugs also stands for correcting and maintaining good documentation. Please send me any and all corrections and/or enhancements to the documentation. Every product needs thorough and complete documentation. Even though this product is free, I have a desire to see it used in all environments. I can't expect a developer to use it if there is no documentation.

    I can't guarantee that I will respond to you, only that your comments will be heard and possibly included in future releases.

    Wish lists

    Users can feel free to provide me with wish list requests and/or FreeUDFLib enhancements.

    If you send me a wish list request, you will not receive a response from me, but you can be assured that your request will be considered for future releases.

    If you send me an enhancement or extension to FreeUDFLib that you would like included in the distribution, I will consider it and respond accordingly. Keep in mind, however, that FreeUDFLib and all source code is free. Do not even think about asking to distribute proprietary products with FreeUDFLib.

    If I distribute product enhancements written by others than myself, their names will be included in the acknowledgements section of this manual, and their source code will be acknowledged appropriately.

    Help desk

    I don't do help desk support, at least not in general. You can feel free to e-mail me with questions, but it is more likely than not that you will not receive a response from me.

    Help desk style questions should be directed to an appropriate Internet support group. The mailing list INTERBASE@dx100.mers.com, for example, provides excellent support for InterBase related questions.

    If you absolutely require my assistance for some issue, I can provide services for standard consulting rates.

    About the documentation

    I have used a product called texinfo to produce all documentation for FreeUDFLib.

    From a single source file, I can produce a formatted manual, ready for print-out (using tex), I can produce html, ready for viewing in a browser, and I can produce rich-text for the production of a help file.

    I don't see the need for producing a help file, so I haven't included one... just the original texinfo documentation, a ready-produced Acrobat file, and a single HTML manual.

    If the reader wishes to find more information on using texinfo with Windows, search the internet for "GNU tex texinfo Windows". (O yeah, texinfo is free, protected under the GNU Public License)

    Release notes

    Planned features

    1. Regular expression matcher.
    2. Search blobs/text strings for regular expressions.

    8/6/98

    By default, FreeUDFLib uses thread-local variables to return strings and dates to InterBase. There has been some speculation that thread-local variables don't work as well as they should, although I haven't been able to verify the speculation, (nor has InterBase, for that matter).

    However, FreeUDFLib can now be built to use dynamic memory allocation (with free_it) as opposed to thread-locals. In `udf_glob.pas', just uncomment the conditional define called FREE_IT.

    {$FREE_IT}
    

    This allows you to declare all string and date UDFs with the free_it convention.

    New stuff:

    1. New function: GenerateSndxIndex(sz: String);
      You can guess what this function does... It generates the soundex index as described on InterBase's web site.
    2. New function: LineWrap. It wraps a string and returns a given line. See its definition below.

    Several functions were removed which did not work, and so were cluttering up the source.

    3/13/98

    Thread-safety has been pretty rigorously tested. Users should not have any problems with FreeUDFLib.

    New functions:

    1. EvaluateExpression: evalute a textual expression with support for symbols and string, date and numeric literals.

    Installation

    After unzipping FreeUDFLib.zip, copy `FreeUDFLib.dll' to the InterBase bin directory, most probably

    c:\Program Files\InterBase Corp\InterBase\Bin
    
    - or -
    
    c:\Program Files\Borland\IntrBase\Bin
    

    Whenever you require the use of FreeUDFLib in an InterBase database, run the `ext_funcs.sql' SQL script against the database.

    Licensing

    GENERAL SOFTWARE LICENSE AGREEMENT CAUTION: THE COPYING, MODIFICATION, TRANSLATION OR DISTRIBUTION OF THE OBJECT CODE, PROGRAM, SOFTWARE OR SOURCE CODE IMPLIES ACCEPTANCE OF THE TERMS OF THIS GENERAL SOFTWARE PROGRAM LICENSE AGREEMENT. YOU SHOULD READ CAREFULLY THE FOLLOWING TERMS AND CONDITIONS BEFORE YOU COPY, MODIFY, TRANSLATE OR DISTRIBUTE THE OBJECT CODE, PROGRAM, SOFTWARE OR SOURCE CODE.

    1.0 DEFINITIONS

    1.1 Licensee - The person who has the privilege to copy, modify, translate or distribute the object code, program, software and source code, subject to the terms and conditions of this General Software License Agreement.

    1.2 Object Code - The version of a computer program in machine language, and therefore, ready to be executed by the computer.

    1.3 Program - A sequence of instructions for executions by a computer.

    1.4 Software - The computer program plus program documentation, if applicable.

    1.5 Source Code - The version of a computer program in assembly language or high-level language, and therefore, not ready to be executed by the computer.

    1.6 Work - All forms of tangible or intangible property, based whole, in part or derived from the object code, program, software or source code.

    1.7 You - The person who has the privilege to copy, modify, translate or distribute the object code, program, software and source code, subject to the terms and conditions of this General Software License Agreement.

    2.0 LICENSE

    2.1 The copyright holder hereby extends a license to you to use its copyrighted object code, program, software and source code, subject to the terms and conditions of this General Software License Agreement.

    2.2 This license is applicable to the object code, program, software and source code distributed under the terms of this General Software License Agreement, any work containing the object code, program, software or source code distributed under the terms of this General Software License Agreement, any modification of the object code, program, software or source code distributed under the terms of this General Software License Agreement, any translation of the object code, program, software or source code distributed under the terms of this General Software License Agreement and any work containing a modification or translation of the object code, program, software or source code distributed pursuant to the terms and conditions of this General Software License Agreement.

    2.3 You may copy, modify, translate and distribute the object code, program, software or source code distributed under the terms of this General Software License Agreement, subject to the terms and conditions of this General Software License Agreement.

    2.4 If you copy, modify, translate or distribute the object code, program, software or source code distributed under the terms of this General Software License Agreement, you must publish and make known in a clear and conspicuous manner on each copy, modification, translation or distribution of the object code, program, software or source code that the copy, modification, translation or distribution of the object code, program, software or source code is subject to the terms and conditions of this General Software License Agreement and provide a copy of this General Software License Agreement with each copy, modification, translation or distribution of the object code, program, software or source code.

    2.5 If you derive, publish or distribute any work that is based whole or in part on the object code, program, software or source code distributed under the terms of this General Software License Agreement, or any modification or translation thereof, you must publish and make known in a clear and conspicuous manner on each such work that the work is subject to the terms and conditions of this General Software License Agreement and provide a copy of this General Software License Agreement with each work.

    2.6 If you copy, modify, translate or distribute the object code, program, software or source code distributed under the terms and conditions of this General Software License Agreement, you must provide clear and conspicuous notice that you have copied, modified, translated or distributed the object code, program, software or source code distributed under the terms of this General Software License Agreement, and indicate the date of each such copy, modification, translation or distribution.

    2.7 If you copy, modify, translate or distribute the object code, program, software or source code distributed under the terms of this General Software License Agreement, or publish or distribute any work that is derived, in whole or in part, from any copy, modification, translation or distribution of the object code, program, software or source code distributed under the terms of this General Software License Agreement, you cannot impose any further obligations or restrictions on any third person or entity other than what is contained in this General Software License Agreement.

    3.0 NO WARRANTY

    3.1 THE OBJECT CODE, PROGRAM, SOFTWARE AND SOURCE CODE ARE PROVIDED "AS IS" WITHOUT ANY WARRANT OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR USE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE OBJECT CODE, PROGRAM, SOFTWARE AND SOURCE CODE IS WITH YOU. SHOULD THE OBJECT CODE, PROGRAM, SOFTWARE AND SOURCE CODE PROVE DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

    4.0 LIMITATION OF DAMAGES

    4.1 IN NO EVENT WILL THE COPYRIGHT HOLDER OR ANY OTHER PERSON OR ENTITY BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING ANY LOST PROFITS, LOST SAVINGS, COMPENSATORY, GENERAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR THE INABILITY TO USE THE OBJECT CODE, PROGRAM, SOFTWARE AND SOURCE CODE, EVEN IF THE COPYRIGHT HOLDER OR ANY OTHER PERSON OR ENTITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.

    5.0 MISCELLANEOUS

    5.1 The article and paragraph headings appearing in this General Software License Agreement have been asserted for the purpose of convenience and ready reference. They do not purport to, and shall not be deemed to define, limit, or extend the scope or intent of the articles and paragraphs to which they pertain.

    5.2 This General Software License Agreement embodies the entire agreement respecting its subject matter. There are no promises, terms, conditions or obligations other than those expressly set forth herein. Unless otherwise expressly set forth herein, this General Software License Agreement supersedes all previous communications, representations, agreements, either verbal or written, warranties, promises, covenants or undertakings. 5.3 This General Software License Agreement shall not be modified, altered, amended or supplemented, except in writing signed by all parties hereto.

    5.4 This General Software License Agreement shall be governed by the laws of the State of New Jersey.

    Functions

    Obsolete functions

    The below functions are now considered obsolete. At some point in future releases of FreeUDFLib, they will no longer exist.

    When a developer has a convincing argument as to why FreeUDFLib should continue to include the function, please let me know, and I will consider your argument.

    1. UserMaintenance is not a terribly useful function for adding and deleting users. It asks IB to start the gsec procedure on the server to add users, etc... Instead, the IBPassword function can be used with a direct connection to ISC4.GDB for adding, deleting and modifying users.

    List of functions

    Below is a list of all available routines. When appropriate, addition documentation will be provided. [This section is not complete, as the user can tell]

    String routines

    Function: PChar Character (var Number: Integer)
    Given the provided ordinal value, return the associated character.
    declare external function f_Character
      integer
      returns cstring(2)
      entry_point 'Character' module_name 'FreeUDFLib.dll';
    

    Function: PChar CRLF ()
    Return the carriage return/line feed string.
    declare external function f_CRLF
      returns cstring(3)
      entry_point 'CRLF' module_name 'FreeUDFLib.dll';
    

    Function: PChar FindNthWord (sz: PChar; var i: Integer)
    A convenient way to find the nth word in a string; however, if you are scanning an entire string to pick out each individual word, it is recommended that you use FindWord and FindWordIndex instead.

    Function: PChar FindWord (sz: PChar; var i: Integer)
    Given a starting position, return the first word starting at that position.
    NOTE: Strings passed to FindWord start at index 0.

    Function: Integer FindWordIndex (sz: PChar; var i: Integer)
    Given a starting position, return the index of the first word that starts on or after that position. This function helps to account for whitespace.
    NOTE: Strings passed to FindWordIndex start at index 0.

    Function: PChar GenerateFormattedName (szFormatString, szNamePrefix, szFirstName, szMiddleInitial, szLastName, szNameSuffix: PChar)
    Given a name prefix (szNamePrefix), a first name (szFirstName), a middle initial (szMiddleInitial), a last name (szLastname), and a name suffix (sznameSuffix), construct a formatted name based on the provided format string (szFormatString).

    A format string is constructed as follows:

    Commands:
     \<pretext>\<posttext>\P  --> name prefix
     \<pretext>\<posttext>\F  --> first name
     \<pretext>\<posttext>\M  --> middle initial
     \<pretext>\<posttext>\L  --> last name
     \<pretext>\<posttext>\S  --> name suffix
     @ - escape character; anything following an  will be printed as a literal
    
     --options (affect the entire string)--
     \\\A   --> print only alpha's, i.e. strip string of anything but alpha's
     \\\9   --> print only alpha's and numeric's, i.e. strip string of
                everything but alpha's
     \\\U   --> uppercase string
    

    All other strings are just printed as-is.

    You use "pretext" and "posttext" values when the text preceding or succeeding a field depends on the presence of a value in the field. An example:

      format string = '\\ \P\\ \F\\. \M\\\L\, \\S'
    
      1. Name Prefix = Mr.
         First name = John
         Middle initial = M
         Last name = Smith
         Name suffix = III
           GenerateFormattedName yields Mr. John M. Smith, III
      2. Same as (1), but
         Name prefix is blank
         Middle initial is blank
         Name suffix is blank
           GenerateFormattedName yields John Smith
      3. Same as (1), but
         Name prefix is blank
         Name suffix is blank
           GenerateFormattedName yields John M. Smith
    

    Function: PChar GenerateSndxIndex (sz: PChar)
    Given a string sz, compute its soundex value. The documentation for this implementation of soundex can be found at InterBase's web site.

    Function: PChar Left (sz: PChar; var Number: Integer)
    Return the Number leftmost characters of sz.

    Function: PChar LineWrap (sz: PChar; var Start, ColWidth: Integer)
    Given a starting point (Start) in a string, and a column width, ColWidth, return the portion of sz, starting at Start that fits in ColWidth character spaces.
    NOTE: Strings passed to LineWrap start at index 0.

    Function: PChar lrTrim (sz: PChar)
    Trim whitespace on both sides of sz. In other words, trim all leading and trailing whitespace.

    Function: PChar lTrim (sz: PChar)
    Trim whitespace on the left side of sz. In other words, trim all leading whitespace.

    Function: PChar Mid (sz: PChar; var Start, Number: Integer)
    Return Number characters from sz, starting at Start position.
    NOTE: Strings passed to Mid start at index 0.

    Function: PChar PadLeft (sz, szPadString: PChar; var Len: Integer)
    Pad the left side of sz with szPadString for Len characters.

    Function: PChar PadRight (sz, szPadString: PChar; var Len: Integer)
    Pad the right side of sz with szPadString for Len characters.

    Function: PChar ProperCase (sz: PChar)
    Proper-case sz. That is, take each word, and ensure that the first letter of each word starts with an uppercase, and the rest of the word is in lower-case.

    This function is convenient, but it is not, in general, terribly useful. After all, it won't ProperCase O'Connor correctly, or McNamara.

    Function: PChar Right (sz: PChar; var Number: Integer)
    Return the Number rightmost characters from sz.

    Function: PChar rTrim (sz: PChar)
    Trim the right side of sz of all whitespace. In other words, trim all trailing whitespace.

    Function: Integer StringLength (sz: PChar)
    Return the StrLen of sz.

    Function: PChar StripString (sz, szCharsToStrip: PChar)
    Strip sz of all characters listed in szCharsToStrip.

    Function: Integer SubStr (szSubStr, szStr: PChar)
    Look for szSubStr in szStr, and return the index. If the string is not found, SubStr returns -1.
    NOTE: Strings passed to SubStr start at index 0.

    Function: Integer ValidateNameFormat (szFormatString: PChar)
    Determine if the provided format string (as described above) is valid.

    Function: Integer ValidateRegularExpression (sz: PChar)
    Given a string sz, determine if it is a valid regular expression.

    NOTE: This function is not yet implemented.

    Function: Integer ValidateStringInRE(sz, re: PChar)
    Given a string sz, and a valid regular expression re, determine if the string sz is in the language specified by re.

    NOTE: This function is not yet implemented.

    Miscellaneous routines

    Function: CloseDebuggerOutput: Integer
    Used in conjunction with SetDebuggerOutput, and Debug. This function closes whatever the currently set output handle is.

    Function: Integer Debug (szDebuggerOutput: PChar)
    Used in conjunction with SetDebuggerOutput and CloseDebuggerOutput. This function writes a string to the currently set debugger handle.

    Function: Integer EvaluateCycleExpression (szCycleExpression: PChar; var ExprStart: Integer; OldDate, NewDate: PISC_QUAD; var Amount: Double)
    A cycle expression is a prefix notation expression evaluator that takes as input a possible OldDate, NewDate and dollar Amount.

    A billing expression is

    • The question, 'Given X bill cycle (in months), is AGE mod X 0?'
      This question is expressed simply by using a valid integer. For example, in semi-pseudo code
        EvaluateCycleExpression('3', 0, '1/1/98', '4/1/98', 0) = 1;
        EvaluateCycleExpression('3', 0, '1/1/98', '3/1/98', 0) = 0;
      
    • The question, 'Is the age in months of the file >= X?'
      This question is expressed simply by typing a '>', followed by a valid integer. For example, in semi-pseudo code:
        EvaluateCycleExpression('>6', 0, '1/1/98', '8/1/98', 0) = 1;
        EvaluateCycleExpression('3', 0, '1/1/98', '3/1/98', 0) = 0;
      
    • The question, 'Is the dollar value >= X?'
      This question is expressed simply by typing a '$', followed by a valid float. For example, in semi-pseudo code:
        EvaluateCycleExpression('$1000', 0, '1/1/98', '8/1/98', 3000) = 1;
        EvaluateCycleExpression('$1000', 0, '1/1/98', '3/1/98', 0) = 0;
      
    • A valid expression is:
        OR <valid expression> <valid expression>
      
      This allows you to "or" two expressions together.
    • A valid expression is:
        AND <valid expression> <valid expression>
      
      This allows you to "and" two expressions together.
    •   NOT <valid expression>
      
      This allows you to negate the result of an expression.

    Function: PChar EvaluateExpression(szExpr, szSymbols: PChar)
    EvaluteExpression is a fully featured expression evaluator. It allows you to use typical parenthesized syntax to compare values of symbols passed in a symbol list with constants.

    The full syntaxes of an expression and of a symbol list are listed in `ExprParser.y', and `Symbols.l', respectively.

    This simple example of an expression should be enough to get you started, though:

      EvaluateExpression(
        '(MyDate={1/1/98}) and (HelloWorld='hello') and (A=B + 9)'
        'MyDate={1/1/98} HelloWorld='hello' A=18 B=9') = 1
    

    Function: PChar IBTempPath ()
    Return what InterBase currently thinks the temporary path is.

    Function: Integer SetDebuggerOutput (szOutputFile: PChar)
    Used in conjuction with Debug and CloseDebuggerOutput. This function sets the current output to a file, or to STDOUT. To set the debugger output to a file, just pass a file name in. The file name STDOUT is a special file name that tells SetDebuggerOutput to set the output to the standard output.

    Function: Integer ValidateCycleExpression (szCycleExpression: PChar; var ExprStart: Integer)
    Given a billing cycle-style expression as described in EvaluateCycleExpression, determine if the expression is valid.

    Blob routines

    Function: Integer BlobMaxSegmentLength (Blob: PBlob)
    Given a Blob, return the maximum segment size of the blob.

    Function: Integer BlobSegmentCount (Blob: PBlob)
    Given a Blob, return the number of segments used to store the blob.

    Function: Integer BlobSize (Blob: PBlob)
    Given a Blob, return the total size of the blob.

    The following functions allow you to treat blobs as pseudo-strings. These functions have limited utility and should only be used when you are confident that your blob is not overly large.

    This in mind, if you are using these functions, you might want to consider exactly why you need these functions, and you might possibly be better served by replacing your blobs with large varchars.

    Function: PChar BlobAsPChar (Blob: PBlob)
    Return the passed blob as a string.

    Function: PChar BlobLeft (Blob: PBlob; var Number: Integer)
    Return the Number leftmost characters of Blob.

    Function: PChar BlobLine (Blob: PBlob; var Number: Integer)
    Return the Number'th line of a blob. The first line of a blob is 0.

    Function: PChar BlobMid (Blob: PBlob; var Start, Number: Integer)
    Return Number characters from a blob starting at the zero-index position Start.

    Function: PChar BlobRight (Blob: PBlob; var Number: Integer)
    Return the Number right-most characters from Blob.

    Function: PBlob StrBlob (sz: PChar; Blob: PBlob)
    Given a string, return it as a blob.

    Math routines

    Function: PChar DollarVal (var Value: Double)
    Format the passed Value as a dollar-ish looking string.

    Function: Double DoubleAbs (var Value: Double)
    Return the absolute value of Value.

    Function: PChar FixedPoint (var Value: Double; var DecimalPlaces: Integer)
    Format the passed Value as a fixed-point string with DecimalPlaces number decimal places.

    Function: Integer IntegerAbs (var Value: Integer)
    Return the absolute value of Value.

    Function: Integer Modulo (var Numerator, Denominator: Integer)
    Divide Numerator by Denominator and return the remainder.

    Function: Integer IsDivisibleBy (var Numerator, Denominator: Integer)
    Return 1 if Numerator is evenly divisible by Denominator, otherwise return 0.

    Function: Double RoundFloat (var Value, RoundToNearest: Double)
    Attempt to round the passed Value to the RoundToNearest fraction.

    Function: Integer Truncate (var Value: Double)
    Truncate Value to an integer value.

    Date/Time routines

    Function: PISC_QUAD AddMonth (ib_date: PISC_QUAD; var months_to_add: Integer)
    Add months_to_add months to ib_date.

    Function: PISC_QUAD AddYear (ib_date: PISC_QUAD; var years_to_add: Integer)
    Add years_to_add years to ib_date.

    Function: Integer AgeInDays (ib_date, ib_date_reference: PISC_QUAD)
    Using ib_date_reference as a reference point, compute the age in days of ib_date. Typically, ib_date_reference will be 'Today'.

    Function: Integer AgeInDaysThreshold (ib_date, ib_date_reference: PISC_QUAD; var Min, UseMin, Max, UseMax: Integer)
    Using ib_date_reference as a reference point, compute the age in days of ib_date. Typically, ib_date_reference will be 'Today'.

    When UseMin is 1, then the minimum age returned is Min. When UseMax is 1, then the maximum age returned is Max. Calling this function with both UseMin and UseMax set to 0, is the same as calling its sister function above.

    Function: Integer AgeInMonths (ib_date, ib_date_reference: PISC_QUAD)
    Using ib_date_reference as a reference point, compute the age in months of ib_date. Typically, ib_date_reference will be 'Today'.

    Function: Integer AgeInMonthsThreshold (ib_date, ib_date_reference: PISC_QUAD; var Min, UseMin, Max, UseMax: Integer)
    Using ib_date_reference as a reference point, compute the age in months of ib_date. Typically, ib_date_reference will be 'Today'.

    When UseMin is 1, then the minimum age returned is Min. When UseMax is 1, then the maximum age returned is Max. Calling this function with both UseMin and UseMax set to 0, is the same as calling its sister function above.

    Function: Integer AgeInWeeks (ib_date, ib_date_reference: PISC_QUAD)
    Using ib_date_reference as a reference point, compute the age in weeks of ib_date. Typically, ib_date_reference will be 'Today'.

    Function: Integer AgeInWeeksThreshold (ib_date, ib_date_reference: PISC_QUAD; var Min, UseMin, Max, UseMax: Integer)
    Using ib_date_reference as a reference point, compute the age in weeks of ib_date. Typically, ib_date_reference will be 'Today'.

    When UseMin is 1, then the minimum age returned is Min. When UseMax is 1, then the maximum age returned is Max. Calling this function with both UseMin and UseMax set to 0, is the same as calling its sister function above.

    Function: PChar CDOWLong (ib_date: PISC_QUAD)
    Return the long string version of the day of the day of the week. For example,

      CDOWLong('1/1/98') = 'Thursday'
    

    Function: PChar CDOWShort (ib_date: PISC_QUAD)
    Return the short string version of the day of the day of the week. For example,

      CDOWShort('1/1/98') = 'Thu'
    

    Function: PChar CMonthLong (ib_date: PISC_QUAD)
    Return the long string version of the month. For example,

      CMonthLong('1/1/98') = 'January'
    

    Function: PChar CMonthShort (ib_date: PISC_QUAD)
    Return the short string version of the month. For example,

      CMonthShort('1/1/98') = 'Jan'
    

    Function: Integer DayOfMonth (ib_date: PISC_QUAD)
    Return the integer day of the month.

    Function: Integer DayOfWeek (ib_date: PISC_QUAD)
    Return the integer day of the week.

    Function: Integer DayOfYear (ib_date: PISC_QUAD)
    Return the integer day of the year.

    Function: Integer IsLeapYear (year: Integer)
    Is the passed year a leap year?

    Function: PISC_QUAD MaxDate (ib_d1, ib_d2: PISC_QUAD)
    Return the larger of the two dates.

    Function: PISC_QUAD MinDate (ib_d1, ib_d2: PISC_QUAD)
    Return the smaller of the two dates.

    Function: Integer Month (ib_date: PISC_QUAD)
    Return the integer month of the passed date.

    Function: Integer Quarter (ib_date: PISC_QUAD)
    Return the integer quarter of the passed date.

    Function: PISC_QUAD StripDate (ib_date: PISC_QUAD)
    Set the date portion of the passed date to the equivalent of '0', leaving just the time portion.

    Function: PISC_QUAD StripTime (ib_date: PISC_QUAD)
    Set the time portion of the passed date to the equivalent of '0', leaving just the date portion.

    Function: Integer WeekOfYear (ib_date: PISC_QUAD)
    Return the integer week of the passed date.

    Function: PChar WOY (ib_date: PISC_QUAD)
    Return a string which concatenates the year of the date with the integer week of the year.

    Function: Integer Year (ib_date: PISC_QUAD)
    Return the integer year of the passed date.

    Function: Integer YearOfYear (ib_date: PISC_QUAD)
    Return the integer year of the date, but compute as if the WeekOfYear was being computed.

    User maintenance routines

    Function: PChar IBPassword (pInStr: PChar)
    Given an unencrypted string, return the encrypted string as InterBase encrypts it for InterBase passwords.

    With InterBase version 5.0, this function is effectively unnecessary, since version 5.0 now has the API calls isc_add_user, etc...

    Function: Integer UserMaintenance(username, password, sysuname, syspword, action: PChar)
    NOTE: This function is obsolete.

    This function allows the user to invoke `gsec' on the server, thus allowing a remote SYSDBA to manage users without using the InterBase Server Manager.

    About the author

    Gregory Deatz is a senior programmer/analyst at Hoagland, Longo, Moran, Dunst & Doukas, a law firm in New Brunswick, NJ. His current focus is in legal billing and case management applications. He is the author of FreeUDFLib, a free UDF library for InterBase written entirely in Delphi, and FreeIBComponents, a set of native InterBase components for use with Delphi 3.0. Both of these tools can be found at at InterBase Corporation. He can be reached via e-mail at gdeatz@hlmdd.com, by voice at (732) 545-4717, or by fax at (732) 545-4579.


    This document was generated on 6 August 1998 using the texi2html translator version 1.51a.