summaryrefslogtreecommitdiff
path: root/databases
diff options
context:
space:
mode:
authorGreg Larkin <glarkin@FreeBSD.org>2010-03-05 19:29:17 +0000
committerGreg Larkin <glarkin@FreeBSD.org>2010-03-05 19:29:17 +0000
commit6f9d598dba5c458063de4bfc9efbf7206bc021db (patch)
tree4d66d46a762705ac5fe8e53ea262711aa6f79717 /databases
parentFix build with custom PREFIX. (diff)
Provide mathematical, string and aggregate functions for SQL queries
using the SQLite loadable extensions mechanism. Math functions: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi String functions: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr, padc, strfilter Aggregate functions: stdev, variance, mode, median, lower_quartile, upper_quartile WWW: http://www.sqlite.org/contrib Submitted by: myself (glarkin) Feature safe: yes
Notes
Notes: svn path=/head/; revision=250602
Diffstat (limited to 'databases')
-rw-r--r--databases/Makefile1
-rw-r--r--databases/sqlite-ext-miscfuncs/Makefile58
-rw-r--r--databases/sqlite-ext-miscfuncs/distinfo3
-rw-r--r--databases/sqlite-ext-miscfuncs/files/README.in29
-rw-r--r--databases/sqlite-ext-miscfuncs/pkg-descr19
-rw-r--r--databases/sqlite-ext-miscfuncs/pkg-message11
6 files changed, 121 insertions, 0 deletions
diff --git a/databases/Makefile b/databases/Makefile
index 507d83b219cf..abde40e36403 100644
--- a/databases/Makefile
+++ b/databases/Makefile
@@ -679,6 +679,7 @@
SUBDIR += sqlclient
SUBDIR += sqldeveloper
SUBDIR += sqlite-ext-inet
+ SUBDIR += sqlite-ext-miscfuncs
SUBDIR += sqlite2
SUBDIR += sqlite3
SUBDIR += sqlite34
diff --git a/databases/sqlite-ext-miscfuncs/Makefile b/databases/sqlite-ext-miscfuncs/Makefile
new file mode 100644
index 000000000000..770670784941
--- /dev/null
+++ b/databases/sqlite-ext-miscfuncs/Makefile
@@ -0,0 +1,58 @@
+# New ports collection makefile for: sqlite-ext-miscfuncs
+# Date created: 28 Jan 2010
+# Whom: Greg Larkin <glarkin@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= sqlite-ext-miscfuncs
+PORTVERSION= 1.0
+CATEGORIES= databases
+MASTER_SITES= http://www.sqlite.org/contrib/download/${DISTFILES}/download/ \
+ LOCAL/glarkin
+DISTNAME= ${SRCFILE}
+EXTRACT_SUFX=
+
+MAINTAINER= glarkin@FreeBSD.org
+COMMENT= Math, string, and aggregate function library for SQLite
+
+USE_SQLITE= yes
+DIST_SUBDIR= sqlite-ext
+NO_WRKSUBDIR= yes
+
+SRCFILE= extension-functions.c
+LIBFILE= libsqlitemiscfuncs.so
+INST_DIR= ${PREFIX}/libexec/${DIST_SUBDIR}
+USE_LDCONFIG= ${INST_DIR}
+
+SUB_FILES= ${PORTDOCS}
+SUB_LIST+= LIBFILE=${LIBFILE}
+
+FETCH_BEFORE_ARGS= -o ${SRCFILE}?get=25
+
+EXTRACT_CMD= ${CP}
+EXTRACT_BEFORE_ARGS=
+EXTRACT_AFTER_ARGS= ${WRKSRC}/
+
+PLIST_DIRS= libexec/${DIST_SUBDIR}
+PLIST_FILES= ${PLIST_DIRS}/${LIBFILE}
+
+PORTDOCS= README
+
+CFLAGS+= -I${PREFIX}/include -fPIC -lm -shared
+
+do-build:
+ @cd ${WRKSRC} && ${CC} ${CFLAGS} ${SRCFILE} -o ${LIBFILE}
+
+do-install:
+ @${INSTALL} -d ${PREFIX}/libexec/${DIST_SUBDIR}
+ @${INSTALL_PROGRAM} ${WRKSRC}/${LIBFILE} ${INST_DIR}
+
+post-install:
+.if !defined(NOPORTDOCS)
+ @${INSTALL} -d ${DOCSDIR}
+ @${CP} ${WRKDIR}/${PORTDOCS} ${DOCSDIR}
+.endif
+ @${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.mk>
diff --git a/databases/sqlite-ext-miscfuncs/distinfo b/databases/sqlite-ext-miscfuncs/distinfo
new file mode 100644
index 000000000000..921d5b987ca3
--- /dev/null
+++ b/databases/sqlite-ext-miscfuncs/distinfo
@@ -0,0 +1,3 @@
+MD5 (sqlite-ext/extension-functions.c) = 625757faf99dde4e976a85f04a8f5e65
+SHA256 (sqlite-ext/extension-functions.c) = 4d8eeb7046e0c9671beadd0c5bea105c24a38ff1cf5fb318543a982d6ca3b1da
+SIZE (sqlite-ext/extension-functions.c) = 51748
diff --git a/databases/sqlite-ext-miscfuncs/files/README.in b/databases/sqlite-ext-miscfuncs/files/README.in
new file mode 100644
index 000000000000..5365a6d87ad0
--- /dev/null
+++ b/databases/sqlite-ext-miscfuncs/files/README.in
@@ -0,0 +1,29 @@
+Usage instructions for applications calling the sqlite3 API functions:
+
+ In your application, call sqlite3_enable_load_extension(db,1) to
+ allow loading external libraries. Then load the library
+ %%LIBFILE%% using sqlite3_load_extension; the third argument
+ should be 0. See http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions.
+ Select statements may now use these functions, as in:
+
+ SELECT cos(radians(inclination)) FROM satsum WHERE satnum = 25544;
+
+
+Usage instructions for the sqlite3 program:
+
+ If the program is built so that loading extensions is permitted,
+ the following will work:
+
+ sqlite> SELECT load_extension('%%LIBFILE%%');
+ sqlite> select cos(radians(45));
+ 0.707106781186548
+
+ Note: Loading extensions is by default prohibited as a
+ security measure; see "Security Considerations" in
+ http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions.
+
+ If the sqlite3 program and library are built this
+ way, you cannot use these functions from the program, you
+ must write your own program using the sqlite3 API, and call
+ sqlite3_enable_load_extension as described above, or else
+ rebuilt the sqlite3 program to allow loadable extensions.
diff --git a/databases/sqlite-ext-miscfuncs/pkg-descr b/databases/sqlite-ext-miscfuncs/pkg-descr
new file mode 100644
index 000000000000..9bb0e8f92c09
--- /dev/null
+++ b/databases/sqlite-ext-miscfuncs/pkg-descr
@@ -0,0 +1,19 @@
+Provide mathematical, string and aggregate functions for SQL queries
+using the SQLite loadable extensions mechanism.
+
+Math functions:
+
+ acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference,
+ degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth,
+ exp, log, log10, power, sign, sqrt, square, ceil, floor, pi
+
+String functions:
+
+ replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim,
+ replace, reverse, proper, padl, padr, padc, strfilter
+
+Aggregate functions:
+
+ stdev, variance, mode, median, lower_quartile, upper_quartile
+
+WWW: http://www.sqlite.org/contrib
diff --git a/databases/sqlite-ext-miscfuncs/pkg-message b/databases/sqlite-ext-miscfuncs/pkg-message
new file mode 100644
index 000000000000..d55184d7fb78
--- /dev/null
+++ b/databases/sqlite-ext-miscfuncs/pkg-message
@@ -0,0 +1,11 @@
+*********************************************************************
+Loading extensions is by default prohibited as a security measure;
+see "Security Considerations" in
+http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions.
+
+If the sqlite3 program and library are built this way, you cannot
+use these functions from the program, you must write your own program
+using the sqlite3 API, and call sqlite3_enable_load_extension as
+described above, or else rebuilt the sqlite3 program to allow
+loadable extensions.
+*********************************************************************