Skip to content

kingpong/mysql_bitwise_strings

Repository files navigation

mysql_bitwise_strings
========================================================================

This package provides sql functions for MySQL to perform bitwise
operations on strings of arbitrary length.  The functions are written in
C and are then loaded into the MySQL server as dynamic modules.  That
means you MUST INSTALL THIS ON THE MYSQL SERVER (not just from any
client).

These functions mimic the bitwise string operators in Perl. See
`perldoc perlop` for an explanation.

FUNCTIONS:

str_and(s1,s2,...)
  Performs a bitwise AND on the arguments and returns the result.
  The result is truncated to the length of the shortest operand.

str_or(s1,s2,...)
  Performs a bitwise OR on the arguments and returns the result.
  The result is truncated to the length of the longest operand.

str_xor(s1,s2,...)
  Performs a bitwise XOR on the arguments and returns the result.
  The result is truncated to the length of the longest operand.

str_not(s1)
  Performs a bitwise negation on the argument and returns the result.


INSTALLATION
========================================================================

The following commands must be run on the MySQL server.

Build the module:

  # make

Install the module into the library directory:

  # export DEST=/path/to/mysql/libs # optional
  # sudo make install-module

Install the functions into the running MySQL server:

  # make install-sql MYSQL_DATABASE=mydatabase

Run the test suite (requires Ruby, Ruby MySQL driver and Perl):

  # make test MYSQL_DATABASE=mydatabase \
              MYSQL_USER=myusername MYSQL_PASS=mypassword

COPYRIGHT AND LICENSE
========================================================================

Copyright (c) 2009 Philip Garrett.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

UDF native functions for performing bitwise operations on strings of arbitrary length in MySQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published