Skip to content
Browse files

This project is no longer maintained within PEAR CVS,

developement is now hosted on

  http://CodeGenerators.php-baustelle.de/

instead.


git-svn-id: http://svn.php.net/repository/pear/packages/CodeGen_MySQL_Plugin/trunk@235323 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent e9e623d commit 3aa9c9362bae4e6397ebefaa1e1997e24e0969b6 Hartmut Holzgraefe committed May 10, 2007
Showing with 6 additions and 509 deletions.
  1. +6 −0 README
  2. +0 −8 docs/Makefile
  3. +0 −126 docs/examples/gzip_fulltext.xml
  4. +0 −42 docs/examples/is-example.xml
  5. +0 −52 docs/examples/minimal.xml
  6. +0 −281 docs/manual.xml
View
6 README
@@ -0,0 +1,6 @@
+This project is no longer maintained within PEAR CVS,
+developement is now hosted on
+
+ http://CodeGenerators.php-baustelle.de/
+
+instead.
View
8 docs/Makefile
@@ -1,8 +0,0 @@
-all: manual.html manual.pdf
-
-manual.html: manual.xml
- docbook2html -u manual.xml
-
-manual.pdf: manual.xml
- docbook2pdf manual.xml
-
View
126 docs/examples/gzip_fulltext.xml
@@ -1,126 +0,0 @@
-<?xml version="1.0"?>
-<plugin name="gzip_fulltext">
- <maintainer>
- <name>Hartmut Holzgraefe</name>
- <email>hartmut@mysql.com</email>
- </maintainer>
-
- <license>GPL</license>
-
- <release>
- <version>0.1</version>
- <date>2004-05-25</date>
- <state>beta</state>
- <notes>
- First working release
- </notes>
- </release>
-
- <deps>
- <src/>
- <header name="zlib.h"/>
- </deps>
-
- <fulltext name="gzip">
- <summary>A fulltext plugin to search on gzip COMPRESS()ed fields</summary>
-
- <parser>
- <code>
-<![CDATA[
- /* check for compress header to distinguish between compressed data
- and uncompressed search terms
- MySQL COMPRESS() stores the real data length in the first 4 bytes
- followed by the compressed data which starts with the two magic
- marker bytes 0x78, 0x9C
- */
- if ((param->length >= 6)
- && ((unsigned char)(param->doc[4]) == 0x78)
- && ((unsigned char)(param->doc[5]) == 0x9C)) {
- ulong real_size;
- char *real_doc;
- int result;
-
- /* calculate the real size and allocate memory */
- real_size = uint4korr(&param->length) & 0x3FFFFFFF;
- real_doc = malloc(real_size + 1);
- if (!real_doc) {
- return 1;
- }
-
- /* the following flag needs to be set as we uncompress
- to dynamic storage we free again right away */
- param->flags |= MYSQL_FTFLAGS_NEED_COPY;
-
- /* uncompress */
- result = uncompress((unsigned char*)real_doc, &real_size, (unsigned char *)(param->doc) + 4, param->length);
-
- if (result == Z_OK) {
- /* OK, pass on to default parser */
- result = param->mysql_parse(param, real_doc, real_size);
- } else {
- /* failure */
- result = 1;
- }
-
- /* cleanup, no leaks please */
- free(real_doc);
-
- return result;
- } else {
- /* uncompressed data is passed on right away */
- return param->mysql_parse(param, param->doc, param->length);
- }
-]]>
- </code>
- </parser>
-
- <test name="gzip_plugin">
- <!-- this test just checks for the plugins existance -->
- <code>
-SELECT PLUGIN_NAME, PLUGIN_STATUS,PLUGIN_TYPE,PLUGIN_LIBRARY FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='gzip';
- </code>
- <result>
-PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE PLUGIN_LIBRARY
-gzip ACTIVE FTPARSER gzip_fulltext.so
- </result>
- </test>
-
- <test name="gzip_fulltext">
- <!--
- this test creates a table using the new plugin,
- populates it with some text rows, both gzip compressed and plain text,
- and then checks the result of some full text queries, again using
- both compressed and uncompressed data
- -->
- <code>
---disable_warnings
-DROP TABLE IF EXISTS t1;
---ensable_warnings
-CREATE TABLE t1 (
- doc CHAR(100) DEFAULT NULL,
- FULLTEXT KEY `doc` (`doc`) WITH PARSER gzip
-) ENGINE=MyISAM DEFAULT CHARSET latin1;
-
-INSERT INTO t1 (doc) VALUES ('this is a fulltext parser test');
-INSERT INTO t1 (doc) VALUES (COMPRESS('this is a fulltext parser test'));
-INSERT INTO t1 (doc) VALUES ('the meaning of life, universe and all the rest');
-INSERT INTO t1 (doc) VALUES ('some dummy text');
-INSERT INTO t1 (doc) VALUES (COMPRESS('more dummy text'));
-
-SELECT COUNT(*) FROM t1 WHERE MATCH(doc) AGAINST('parser');
-SELECT COUNT(*) FROM t1 WHERE MATCH(doc) AGAINST(COMPRESS('parser'));
-SELECT COUNT(*) FROM t1 WHERE MATCH(doc) AGAINST(COMPRESS('universe'));
- </code>
- <result>
-COUNT(*)
-2
-COUNT(*)
-2
-COUNT(*)
-1
- </result>
- </test>
-
- </fulltext>
-
-</plugin>
View
42 docs/examples/is-example.xml
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<plugin name="is_example">
- <maintainer>
- <name>Hartmut Holzgraefe</name>
- <email>hartmut@mysql.com</email>
- </maintainer>
-
- <license>GPL</license>
-
- <release>
- <version>0.1</version>
- <date>2006-04-27</date>
- <state>beta</state>
- <notes>
- First working release
- </notes>
- </release>
-
- <deps language="c++"/>
-
- <infoschema name="is_dummy">
- <summary>minimal example plugin</summary>
-
- <field name="FOOBAR" type="LONG"/>
-
- <code>
-<?data
- TABLE* table= tables->table;
-
- table->field[FIELD_FOOBAR]->store(23);
- schema_table_store_record(thd, table);
-
- table->field[FIELD_FOOBAR]->store(23);
- schema_table_store_record(thd, table);
-
- return 0;
-?>
- </code>
-
- </infoschema>
-
-</plugin>
View
52 docs/examples/minimal.xml
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<plugin name="minimal">
- <maintainer>
- <name>Hartmut Holzgraefe</name>
- <email>hartmut@mysql.com</email>
- </maintainer>
-
- <license>GPL</license>
-
- <release>
- <version>0.1</version>
- <date>2004-05-25</date>
- <state>beta</state>
- <notes>
- First working release
- </notes>
- </release>
-
- <deps>
- <src/>
- </deps>
-
- <fulltext name="dummy">
- <summary>minimal example plugin</summary>
-
- <statusvar type="int" name="_int" init="42"/>
- <statusvar type="long" name="_long" init="-1"/>
- <statusvar type="longlong" name="_llong" init="12000000000LL"/>
- <statusvar type="char" name="_char" init="'q'"/>
- <statusvar type="char_ptr" name="_char_ptr" init='"hello world!"'/>
- <statusvar type="array" name="dummy">
- <statusvar type="int" name="foo" init="23"/>
- <statusvar type="int" name="bar" init="42"/>
- </statusvar>
-
- <parser>
- <code>
-<![CDATA[
- char *doc;
- int result;
-
- doc = strndup(param->doc, param->length);
- result = param->mysql_parse(param, param->doc, param->length);
- free(doc);
-
- return result;
-]]>
- </code>
- </parser>
- </fulltext>
-
-</plugin>
View
281 docs/manual.xml
@@ -1,281 +0,0 @@
-<?xml version='1.0' encoding='ISO-8859-1' ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
- "../../phpdoc/dtds/dbxml-4.1.2/docbookx.dtd" [
-]>
-
-<book>
- <title><literal>CodeGen_MySQL_Plugin</literal> - the MySQL Plugin code generator</title>
-
- <chapter>
- <title>Introduction</title>
- <section>
- <title>What is it?</title>
- <para>
- <literal>CodeGen_MySQL_Plugin</literal> is a tool that can automatically
- create the basic framework for MySQL plugin libraries from a rather simple XML
- specification file. The actual functionality is provided
- by the script <filename>mysql-plugin-gen</filename> that is installed by
- the <literal>CodeGen_MySQL_Plugin</literal> package.
- </para>
- <para>
- The code generated by <filename>mysql-plugin-gen</filename> is currently
- designed to work with the most current MySQL 5.1 beta release only.
- Once MySQL 5.1 becomes GA and the plugin API stabelizes the generated
- code will compile wih all 5.1 GA releases and future releases
- (although it may be necessary to recompile it for a specific server
- version to load and run).
- </para>
- </section>
-
- <section>
- <title>Features</title>
- <para>
- <literal>mysql-plugin-gen</literal> tries to support as many plugin
- writing aspects as possible. This currently includes code generation
- for fulltext parser plugins and preparation of
- <filename>configure</filename> and <filename>Makefile</filename>
- related build files.
- </para>
- <para>
- Support for pluggable storage engines is currently being worked on
- and user defined functions and other plugin types will be added
- when these plugin types are supported by the MySQL server.
- </para>
- </section>
-
- <section>
- <title>Installation</title>
- <para>
- <literal>CodeGen_MySQL_Plugin</literal> is available in PEAR, the
- PHP Extension and Application Repository, on <literal>http://pear.php.net/</literal>.
- </para>
-
- <section>
- <title>Online installation</title>
- <para>
- Online installation using the PEAR installer is the easiest way
- to install <literal>CodeGen_MySQL_Plugin</literal>, just issue the
- following command:
- </para>
- <programlisting>
-pear install -o CodeGen_MySQL_Plugin
- </programlisting>
- <para>
- The PEAR installer will download and install the package itself
- and all packages that it depends on.
- </para>
- </section>
-
- <section>
- <title>Installing from package files</title>
- <para>
- When installing from package files downloaded from <literal>pear.php.net</literal>
- you have to resolve dependencies yourself. Currently <literal>CodeGen_PECL</literal>
- depends on two other PEAR packages: <literal>Console_Getopt</literal>, which is part
- of the PEAR base installation, <literal>CodeGen</literal>, the code generator
- base package, and <literal>CodeGen_MySQL</literal>, the base package for MySQL
- specific code generators. You need to download all three packages for installation.
- The actual installation is once again performed by the PEAR installer:
- </para>
- <programlisting>
-pear install CogeGen-0.9.0.tgz
-pear install CogeGen_MySQL-0.9.0.tgz
-pear install CogeGen_MySQL-Plugin-0.9.0.tgz
- </programlisting>
- </section>
-
- <section>
- <title>Installing from PEAR CVS</title>
- <para>
- You can also install CodeGen_MySQL_Plugin snapshots from PEAR CVS. CVS snapshots may
- include features not yet available in any release package, but the code in
- CVS may not be as well tested as the release packages (or even broken at
- times). Be warned, your milage may vary. Use the following sequence of
- commands in your PEAR CVS checkout to install the latest
- <literal>CodeGen_MySQL_Plugin</literal> snapshot:
- </para>
- <programlisting>
-cd pear
-cd CodeGen
-cvs update
-pear install -f package.xml
-cd ..
-cd CodeGen_MySQL
-cvs update
-pear install -f package.xml
-cd ..
-cd CodeGen_MySQL_Plugin
-cvs update
-pear install -f package.xml
-cd ..
- </programlisting>
- </section>
- </section>
-
- <section>
- <title>How to use it</title>
- <para>
- Given that you already have written your XML specs file invoking
- <command>mysql-plugin-gen</command> is as simple as:
- <screen>mysql-plugin-gen specfile.xml</screen>
- </para>
- <para>
- <command>mysql-plugin-gen</command> will parse the specs file, create a new
- subdirectory and puts all generated files in there. The generated
- code is ready to be compiled using the usual
- <screen>configure [--with-mysql=...]; make</screen>
- sequence.
- </para>
- <para>
- Below you find a hardcopy of <literal>udf-gen --help</literal> output:
- </para>
- <screen>
-<![CDATA[
-mysql-plugin-gen 0.1.0dev, Copyright (c) 2006, 2007 Hartmut Holzgraefe
-
-Usage:
-
-/usr/local/bin/mysql-plugin-gen [-hxfl] [-d dir] [--version] specfile.xml
-
- -h|--help this message
- -x|--experimental enable experimental features
- -d|--dir output directory
- -f|--force overwrite existing files/directories
- -l|--lint check syntax only, don't create output
- --version show version info
-
-]]>
- </screen>
- </section>
- </chapter>
-
- <chapter>
- <title>The XML description</title>
-
- <section>
- <title>Basics</title>
- <para>
- The top level container tag describing a plugin library is the
- <literal>&lt;plugin&gt;</literal> tag. The name of the plugin
- is given in the <literal>name=...</literal> attribute. The plugin library
- name has to be a valid file name as it is used the extensions
- directory name.
- </para>
- <para>
- You can specify which CodeGen_MySQL_Plugin version your specification file
- was build for using the <literal>version=...</literal> attribute.
- The <command>mysql-plugin-gen</command> command will not accept specifications
- written for a newer version of CodeGen_MySQL_Plugin than the one installed.
- If the requested version is older then the current one then
- <command>mysql-plugin-gen</command> will try to fall back to the older versions
- behavior for features that have changed in incompatible ways.
- </para>
- <note>
- <para>
- So far no such changes have happened.
- </para>
- </note>
- <para>
- The tags <literal>&lt;summary&gt;</literal> and
- <literal>&lt;description&gt;</literal> should be added at the very top of
- your plugins. The summary should be a short one-line
- description of the plugin library while the actually description can be
- as detailed as you like.
- </para>
- <example>
- <title>Plugin basics</title>
- <programlisting role="xml">
-<![CDATA[
-<plugin name="sample" version="0.1.0">
- <summary>A sample plugin library</summary>
- <description>
- This is a sample plugin specification
- showing how to use CodeGen_MySQL_Plugin for
- plugin library generation.
- </description>
- ...
-]]>
- </programlisting>
- </example>
- </section>
-
-
- <section>
- <title>Release information</title>
- <para>
- The release information for your plugin library should include the
- plugin authors and maintainers, the version number, state and
- release date, the chosen license and maybe a change log describing
- previous releases.
- </para>
- <para>
- The <literal>&lt;maintainers&gt;</literal>, <literal>&lt;release&gt;</literal> and
- <literal>&lt;changelog&gt;</literal> tags specifications are identical to
- those in the PEAR <literal>package.xml</literal> specification so
- please refer to the PEAR documentation here.
- </para>
- <example>
- <title>Release information</title>
- <programlisting>
-<![CDATA[
-...
- <maintainers>
- <maintainer>
- <user>hholzgra</user>
- <name>Hartmut Holzgraefe</name>
- <email>hartmut@php.net</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
-
- <release>
- <version>1.0</version>
- <date>2002-07-09</date>
- <state>stable</state>
- <notes>
- The sample plugin library is now stable
- </notes>
- </release>
-
- <changelog>
- <release>
- <version>0.5</version>
- <date>2002-07-05</date>
- <state>beta</state>
- <notes>First beta version</notes>
- <release>
- <release>
- <version>0.1</version>
- <date>2002-07-01</date>
- <state>alpha</state>
- <notes>First alpha version</notes>
- <release>
- </changelog>
-...
-]]>
- </programlisting>
- </example>
- <para>
- The <literal>&lt;license&gt;</literal> tag is a little more restrictive as
- its <literal>package.xml</literal> counterpart as it is used to
- decide which license text should actually be written to the
- <literal>LICENSE</literal>. For now you have to specify either
- <literal>GPL</literal> or
- <literal>BSD</literal>, any other value is taken as
- '<emphasis>proprietary</emphasis>'.
- </para>
- <example>
- <title>License</title>
- <programlisting role="xml">
-<![CDATA[
-...
- <license>GPL</license>
-...
-]]>
- </programlisting>
- </example>
- </section>
-
- </chapter>
-
-</book>

0 comments on commit 3aa9c93

Please sign in to comment.
Something went wrong with that request. Please try again.