<< previous page   --   table of contents   --   next page >>
| | | | | | | |
  • Return to Table of Contents
  • Table of Contents

    1. General Information
    2. MySQL Installation
    3. Tutorial Introduction
    4. Database Administration
    5. MySQL Optimisation
    6. MySQL Language Reference
    7. MySQL Table Types
    8. MySQL APIs
    9. Extending MySQL

    620 MySQL Technical Reference for Version 4.0.3 unsigned int decimals Number of decimals.   The default value is the maximum number of decimals in the arguments passed to the main function.   (For example,  if the function is passed  1.34,  1.345, and  1.3, the default would be 3, because  1.345  has 3 decimals. unsigned int max_length The maximum length of the string result.  The default value di ers depending on the result type of the function.  For string functions, the default is the length of the longest argument.  For integer functions, the default is 21 digits.  For real functions, the default is 13 plus the number of decimals indicated by initid- >decimals.   (For  numeric  functions,  the  length  includes  any  sign  or  decimal point characters.) If you want to return a blob, you can set this to 65K or 16M; this memory is not allocated but used to decide which column type to use if there is a need to temporary store the data. char *ptr   A pointer that the function can use for its own purposes. For example, functions can use initid->ptr to communicate allocated memory between functions.  In xxx_init(), allocate the memory and assign it to this pointer: initid->ptr = allocated_memory; In  xxx()  and  xxx_deinit(),  refer  to  initid->ptr  to  use  or  deallocate  the memory. 9.2.2.2  UDF Calling Sequences for aggregate functions Here follows a description of the di erent functions you need to de ne when you want to create an aggregate UDF function. char *xxx_reset(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error); This function is called when MySQL nds the rst row in a new group.  In the function you should reset any internal summary variables and then set the given argument as the rst argument in the group. In many cases this is implemented internally by reseting all variables and then calling xxx_ add(). char *xxx_add(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error); This function is called for all rows that belongs to the same group, except for the rst row. In this you should add the value in UDF ARGS to your internal summary variable. The xxx() function should be declared identical as when you de ne a simple UDF function. See Section 9.2.2.1 [UDF calling], page 619. This function is called when all rows in the group has been processed.  You should normally never access the args variable here but return your value based on your internal summary variables.
     

    Customer Support CentreMySQL Reference Manual

    Web Hosting Services
    UNIX WEB HOSTING
    MERCHANT ACCOUNTS
    DEDICATED SERVERS
    E-COMMERCE HOSTING
    SUPPORT & FAQ's
    TERMS OF USE
    Domain Services
    DOMAIN
    REGISTRATION
    MANAGE
    YOUR ACCOUNT
    SUPPORT & FAQ's
    TERMS OF USE
    Corporate Info
    ABOUT US
    OUR NETWORK
    CONTACT US
    SITE MAP
    Copyright © 2002 Dyntex Group, Inc. All Rights Reserved
  • Return to Table of Contents
  • Back to top

  • Web Hosting: Manuals & FAQ's

    1. Unix-Based Web Hosting
    2. Unix Dedicated Servers
    3. Windows Dedicated Servers
    4. CuteFTP User’s Guide
    5. CuteHTML User’s Guide
    6. WS_FTP Pro User's Guide
    7. Miva Order User's Guide
    8. Miva Merchant User's Guide