Writing MySQL UDFs

Architecture and Technology, General, LAMP, PHP and MySQL, Tutorial
Location: Ballroom A Level: Novice

This tutorial is geared towards people that want to get started writing MySQL UDFs. Attendees are expected to have some general programming skills, but are not required to have prior experience in programming C/C++.

The tutorial will be a mixture of explanation of theory and labs during which attendees will learn how to apply the theory. Attendees are strongly encouraged to bring their laptops (either windows with visual studio or linux with gcc and an effort will be made to cater to OS/X users). At the end of the tutorial, attendees will have written their own UDF’s and will have enough background knowledge to find their own way in implementing them.

The following flow will used:

- Definitions: what are UDFS, how do they relate to stored functions and built-in functions.
- Introduction into the C programming language (geared to writing UDFs)
- Setting up the environment for compilation of UDFs
- MySQL interface for simple UDFs
- MySQL interface for aggregate UDFs
- Installing/de-installing UDFs
- Security considerations
- UDFs and Future developments

Throughout these topics, the following elements from the MySQL UDF interface will be explained:
- different function signatures and their purpose (xxx_init, xxx_deinit etc)
- argument handling
- data types (STRING_RESULT, DECIMAL_RESULT, etc.) and their mapping to SQL data types
- returning values
- memory management
- error handling
- troubleshooting common problems in writing and installing UDFs

Code that will be used will be derived from:
in particular:
- lib_mysqludf_json
- lib_mysqludf_sys
- lib_mysqludf_udf
- lib_mysqludf_stat

Photo of Roland Bouman

Roland Bouman

XCDSQL Solutions / Strukton Rail

I’m a Web Application and Business Intelligence developer and I authored two books about the Pentaho Open Source Business Intelligence stack: “Pentaho Solutions” (ISBN 978-0470484326) and "Pentaho Kettle Solutions (ISBN 978-0470635179). I’m an active member of the MySQL and Pentaho communities. In the past, I worked for Inter Access, MySQL AB, Sun Microsystems. I currently work for Pentaho.

  • Kickfire
  • Zmanda, Inc.
  • Continuent
  • EDS
  • JasperSoft
  • Sun Microsystems
  • Symantec Anti-Virus Software
  • XAware
  • Data Direct Technologies
  • Dolphin Interconnect Solutions
  • Hewlett Packard
  • Infobright, Inc
  • Linagora
  • Microsoft
  • OpSource
  • Oracle
  • Pentaho
  • R1Soft
  • Red Hat
  • Ticketmaster
  • TechRepublic

Contact Us

View a complete list of MySQL contacts.