mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
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
This commit is contained in:
parent
1dd6d887b0
commit
6f9d598dba
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=250602
6 changed files with 121 additions and 0 deletions
|
@ -679,6 +679,7 @@
|
||||||
SUBDIR += sqlclient
|
SUBDIR += sqlclient
|
||||||
SUBDIR += sqldeveloper
|
SUBDIR += sqldeveloper
|
||||||
SUBDIR += sqlite-ext-inet
|
SUBDIR += sqlite-ext-inet
|
||||||
|
SUBDIR += sqlite-ext-miscfuncs
|
||||||
SUBDIR += sqlite2
|
SUBDIR += sqlite2
|
||||||
SUBDIR += sqlite3
|
SUBDIR += sqlite3
|
||||||
SUBDIR += sqlite34
|
SUBDIR += sqlite34
|
||||||
|
|
58
databases/sqlite-ext-miscfuncs/Makefile
Normal file
58
databases/sqlite-ext-miscfuncs/Makefile
Normal file
|
@ -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>
|
3
databases/sqlite-ext-miscfuncs/distinfo
Normal file
3
databases/sqlite-ext-miscfuncs/distinfo
Normal file
|
@ -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
|
29
databases/sqlite-ext-miscfuncs/files/README.in
Normal file
29
databases/sqlite-ext-miscfuncs/files/README.in
Normal file
|
@ -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.
|
19
databases/sqlite-ext-miscfuncs/pkg-descr
Normal file
19
databases/sqlite-ext-miscfuncs/pkg-descr
Normal file
|
@ -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
|
11
databases/sqlite-ext-miscfuncs/pkg-message
Normal file
11
databases/sqlite-ext-miscfuncs/pkg-message
Normal file
|
@ -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.
|
||||||
|
*********************************************************************
|
Loading…
Add table
Reference in a new issue