1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 3.00 out of 5)
Loading...

12 comments

  • Mmm, terrible, for my taste. Someone can say “not perfect” article, but

    I can’t say anything about C++ code, I don’t like C++, so …

    1. wrong comparison of UDFs with MIN/MAX aggregate functions. You can’t write aggregate functions as UDF.

    2.
    SELECT GetName(:”parserPtr”) FROM rdb$database INTO :”Name”;

    why, why, why???
    Why not just write
    Name=GetName(parserPtr); ?

    3. what for this horror with the quoted identifiers? Why not just declare variable parserPtr and then write it even as PARSERPTR ?

    • 1. UDF difinishion was taken from LangRef.pdf (InterBase 6 doc)

      2. Agreed, but with SELECT you should use my form

      3. I preffer always to use case sensetive names avoid names reserved words duplication.

  • also found additional “horror” :

    RETURNS TIMESTAMP FREE_IT

    man, FREE_IT is used for returning CSTRING variables. timestamp and integer and so on usually returned by value.

    • It can be used with a lot of types, not only with CSTRING. In sample I just wish only to show how to use engine memory allocation. Besides this one:

      DECLARE EXTERNAL FUNCTION GetCreationTime
      INTEGER
      RETURNS TIMESTAMP BY VALUE
      ENTRY_POINT ‘SampleUdf_GetCreationTime’ MODULE_NAME ‘SampleUdf’

      returns exception on query running: Invalid command

      • well, ok, this “bug” is from the old Interbase age – same was for DATE fields in dialect 1, that equal to TIMESTAMP in dialect 3.

        But, what about other things in the article?
        I’m apologize to be emotional, but when you write an article you create it to be read by people, they will follow your ideas.

        • I already replied in first post – see it upper 🙂

          1.About UDF difinition – can you propose your variant of definition ?
          I will replace it in an article.

          2. I will replace this in article and sample.

          3. About quoted names – in big projects with hundred of stored procedures case-unsensitive names could be a problem when it confilcts with reserved words or existing stoted procedures or table columns. In my practice, I have acquired the habit always use the qouted names 🙂

          • come on – declaration of variables and parameters in stored proc does not need delimited identifiers, even if developer does not have any sense of “reserved words avoidig”. Delimited identifiers disturbs source code and add a lot of crap needing to
            – always specify double quotes
            – write quoted identifiers exactly with the same case when they were first declared.

            Really I do not see any real excuse to use delimited identifiers. At least in your article.
            Since you are ukranian, you may read http://www.ibase.ru/ibfaq.htm#dtproblem , where all these arguments written.

            And, the final, please, change reference to MIN/MAX to some another UDF example, so readers will not have false hope of creating aggregate functions.

            p.s. the last question I see the most important that prevents me to recommend your article. I do not push you, but for me there are some “internal” requirements to recommend or not articles to read.

  • All is done : article and sample is updated.

Leave a Reply