1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-06 06:30:19 +00: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:
Greg Larkin 2010-03-05 19:29:17 +00:00
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

View File

@ -679,6 +679,7 @@
SUBDIR += sqlclient
SUBDIR += sqldeveloper
SUBDIR += sqlite-ext-inet
SUBDIR += sqlite-ext-miscfuncs
SUBDIR += sqlite2
SUBDIR += sqlite3
SUBDIR += sqlite34

View 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>

View 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

View 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.

View 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

View 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.
*********************************************************************