The branch, master has been updated via 9675d8aed8e ctdb-utils: Fix incorrect FSF address via 92078188efe ldb: remove unused test-sqlite3.sh via ebea46ae511 codespellrc: remove reference to non-existent file via 7be38329509 ldb: doxygen: don't mention sqlite via 6526db804b3 ldb:manpages: ldbedit: update url schemes via 62eca00b612 ldb: remove obsolete copy of https://ldb.samba.org via 1e1503e1f89 ldb: remove unused nssldb via 25502486b1c ldb: remove unused sqlite backend from 4ae92241384 vfs_ceph_new: use libcephfs nonblocking API for async-io ops
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 9675d8aed8e3368f0a797490f3bf85d8026e5acc Author: Martin Schwenke <mschwe...@ddn.com> Date: Wed Mar 5 09:16:20 2025 +1100 ctdb-utils: Fix incorrect FSF address BUG: https://bugzilla.samba.org/show_bug.cgi?id=15820 Signed-off-by: Martin Schwenke <mschwe...@ddn.com> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagn...@samba.org> Autobuild-Date(master): Wed Mar 5 03:40:15 UTC 2025 on atb-devel-224 commit 92078188efeefc4f657b0dabb05a2971227fad4e Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Tue Mar 4 13:00:21 2025 +1300 ldb: remove unused test-sqlite3.sh Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersut...@catalyst.net.nz> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit ebea46ae511a5937104093d8245bbc0e9fe60918 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Tue Mar 4 12:56:39 2025 +1300 codespellrc: remove reference to non-existent file Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersut...@catalyst.net.nz> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 7be38329509928c0ce5ebf50063bb726351855b1 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Tue Mar 4 12:54:38 2025 +1300 ldb: doxygen: don't mention sqlite Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersut...@catalyst.net.nz> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 6526db804b380c0bb4358d883dcb11263cc6ee1f Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Tue Mar 4 12:54:11 2025 +1300 ldb:manpages: ldbedit: update url schemes no sqlite://, but ldaps:// ldb://, mdb://. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersut...@catalyst.net.nz> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 62eca00b612848702b7bf3425b68e183c1af6905 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Tue Mar 4 11:02:57 2025 +1300 ldb: remove obsolete copy of https://ldb.samba.org lib/ldb/web/index.html used to be the source for https://ldb.samba.org/, but the web page has continued to evolve in minor ways without git keeping up. The current difference is all http:// have been converted to https:// and a few URL domains and paths have changed. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersut...@catalyst.net.nz> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 1e1503e1f894cdebd7cf3a3528dbdee45e16b39e Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Tue Mar 4 11:02:21 2025 +1300 ldb: remove unused nssldb Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersut...@catalyst.net.nz> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 25502486b1cc7465470c794422724f14968a8ebc Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Tue Mar 4 11:02:01 2025 +1300 ldb: remove unused sqlite backend Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersut...@catalyst.net.nz> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> ----------------------------------------------------------------------- Summary of changes: .codespellrc | 2 +- ctdb/utils/pmda/Install | 3 +- ctdb/utils/pmda/Remove | 3 +- ctdb/utils/pmda/domain.h | 3 +- ctdb/utils/pmda/help | 3 +- ctdb/utils/pmda/pmda_ctdb.c | 3 +- ctdb/utils/pmda/pmns | 3 +- lib/ldb/include/ldb.h | 2 +- lib/ldb/include/ldb_private.h | 2 - lib/ldb/ldb_sqlite3/README | 7 - lib/ldb/ldb_sqlite3/base160.c | 154 --- lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 1958 ------------------------------------- lib/ldb/ldb_sqlite3/schema | 328 ------- lib/ldb/ldb_sqlite3/trees.ps | 1760 --------------------------------- lib/ldb/mainpage.dox | 2 +- lib/ldb/man/ldbedit.1.xml | 18 +- lib/ldb/nssldb/README.txt | 34 - lib/ldb/nssldb/ldb-grp.c | 429 -------- lib/ldb/nssldb/ldb-nss.c | 395 -------- lib/ldb/nssldb/ldb-nss.h | 84 -- lib/ldb/nssldb/ldb-pwd.c | 242 ----- lib/ldb/tests/test-sqlite3.sh | 23 - lib/ldb/web/index.html | 74 -- lib/ldb/wscript | 9 - 24 files changed, 20 insertions(+), 5521 deletions(-) delete mode 100644 lib/ldb/ldb_sqlite3/README delete mode 100644 lib/ldb/ldb_sqlite3/base160.c delete mode 100644 lib/ldb/ldb_sqlite3/ldb_sqlite3.c delete mode 100644 lib/ldb/ldb_sqlite3/schema delete mode 100644 lib/ldb/ldb_sqlite3/trees.ps delete mode 100644 lib/ldb/nssldb/README.txt delete mode 100644 lib/ldb/nssldb/ldb-grp.c delete mode 100644 lib/ldb/nssldb/ldb-nss.c delete mode 100644 lib/ldb/nssldb/ldb-nss.h delete mode 100644 lib/ldb/nssldb/ldb-pwd.c delete mode 100755 lib/ldb/tests/test-sqlite3.sh delete mode 100644 lib/ldb/web/index.html Changeset truncated at 500 lines: diff --git a/.codespellrc b/.codespellrc index 02c07fb6ea1..45bba3254bb 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,4 +1,4 @@ [codespell] -skip = ./.git,./bin,./ctdb/bin,./docs-xml/archives,./docs-xml/manpages/vfs_fruit.8.xml,./docs-xml/smbdotconf/browse/preferredmaster.xml,./lib/ldb/ldb_sqlite3/trees.ps,./libcli/util/hresult_err_table.txt,./python/samba/tests/blackbox/testdata,./source3/include/MacExtensions.h,./source3/selftest/ktest-krb5_ccache-2.txt,./source4/setup/display-specifiers,./source4/ldap_server/devdocs,./source4/selftest/provisions,./source4/setup/adprep/WindowsServerDocs,./source4/setup/display-specifiers,./source4/torture/vfs/fruit.c,./testdata,./third_party,*.IBM-DS,*.config,*.diff,*.dump,*.ldif,*.ldf,*.pdml,*.pem,*.po,*.schema +skip = ./.git,./bin,./ctdb/bin,./docs-xml/archives,./docs-xml/manpages/vfs_fruit.8.xml,./docs-xml/smbdotconf/browse/preferredmaster.xml,./libcli/util/hresult_err_table.txt,./python/samba/tests/blackbox/testdata,./source3/include/MacExtensions.h,./source3/selftest/ktest-krb5_ccache-2.txt,./source4/setup/display-specifiers,./source4/ldap_server/devdocs,./source4/selftest/provisions,./source4/setup/adprep/WindowsServerDocs,./source4/setup/display-specifiers,./source4/torture/vfs/fruit.c,./testdata,./third_party,*.IBM-DS,*.config,*.diff,*.dump,*.ldif,*.ldf,*.pdml,*.pem,*.po,*.schema ignore-regex = \\[t] ignore-words = .codespellignore diff --git a/ctdb/utils/pmda/Install b/ctdb/utils/pmda/Install index a56a63506a8..bd12b7486cf 100644 --- a/ctdb/utils/pmda/Install +++ b/ctdb/utils/pmda/Install @@ -13,8 +13,7 @@ # for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# with this program; if not, see <https://www.gnu.org/licenses/>. # # Install the ctdb PMDA and/or PMNS # diff --git a/ctdb/utils/pmda/Remove b/ctdb/utils/pmda/Remove index 7d1c509e50e..8bf0fe76e15 100644 --- a/ctdb/utils/pmda/Remove +++ b/ctdb/utils/pmda/Remove @@ -13,8 +13,7 @@ # for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# with this program; if not, see <https://www.gnu.org/licenses/>. # # Remove the ctdb PMDA # diff --git a/ctdb/utils/pmda/domain.h b/ctdb/utils/pmda/domain.h index 0bed7fef599..b00d32d90dc 100644 --- a/ctdb/utils/pmda/domain.h +++ b/ctdb/utils/pmda/domain.h @@ -13,7 +13,6 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, see <https://www.gnu.org/licenses/>. */ #define CTDB 110 diff --git a/ctdb/utils/pmda/help b/ctdb/utils/pmda/help index 0e9984eab3a..26b5385b0da 100644 --- a/ctdb/utils/pmda/help +++ b/ctdb/utils/pmda/help @@ -12,8 +12,7 @@ # for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# with this program; if not, see <https://www.gnu.org/licenses/>. # # ctdb PMDA help file in the ASCII format # diff --git a/ctdb/utils/pmda/pmda_ctdb.c b/ctdb/utils/pmda/pmda_ctdb.c index 4f7933de9c5..7ac8a3b38d1 100644 --- a/ctdb/utils/pmda/pmda_ctdb.c +++ b/ctdb/utils/pmda/pmda_ctdb.c @@ -15,8 +15,7 @@ * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * with this program; if not, see <https://www.gnu.org/licenses/>. */ #include "replace.h" diff --git a/ctdb/utils/pmda/pmns b/ctdb/utils/pmda/pmns index dc7e3ac2bfa..c9f6644d52f 100644 --- a/ctdb/utils/pmda/pmns +++ b/ctdb/utils/pmda/pmns @@ -15,8 +15,7 @@ * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * with this program; if not, see <https://www.gnu.org/licenses/>. */ ctdb { diff --git a/lib/ldb/include/ldb.h b/lib/ldb/include/ldb.h index f2d4642375f..0d1d455d0cf 100644 --- a/lib/ldb/include/ldb.h +++ b/lib/ldb/include/ldb.h @@ -1094,7 +1094,7 @@ struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx) - tdb://path - ldapi://path - ldap://host - - sqlite://path + - mdb://path \param ldb the context associated with the database (from ldb_init()) \param url the URL of the database to connect to, as noted above diff --git a/lib/ldb/include/ldb_private.h b/lib/ldb/include/ldb_private.h index c21195a2d30..6a851e1bccc 100644 --- a/lib/ldb/include/ldb_private.h +++ b/lib/ldb/include/ldb_private.h @@ -204,12 +204,10 @@ extern const struct ldb_module_ops ldb_tdb_module_ops; extern const struct ldb_module_ops ldb_skel_module_ops; extern const struct ldb_module_ops ldb_subtree_rename_module_ops; extern const struct ldb_module_ops ldb_subtree_delete_module_ops; -extern const struct ldb_module_ops ldb_sqlite3_module_ops; extern const struct ldb_module_ops ldb_wins_ldb_module_ops; extern const struct ldb_module_ops ldb_ranged_results_module_ops; extern const struct ldb_backend_ops ldb_tdb_backend_ops; -extern const struct ldb_backend_ops ldb_sqlite3_backend_ops; extern const struct ldb_backend_ops ldb_ldap_backend_ops; extern const struct ldb_backend_ops ldb_ldapi_backend_ops; extern const struct ldb_backend_ops ldb_ldaps_backend_ops; diff --git a/lib/ldb/ldb_sqlite3/README b/lib/ldb/ldb_sqlite3/README deleted file mode 100644 index 6cda0a77595..00000000000 --- a/lib/ldb/ldb_sqlite3/README +++ /dev/null @@ -1,7 +0,0 @@ -trees.ps contains an explanation of the Genealogical Representation of Trees -in Databases which is being used in ldb_sqlite3. Note that we use fgID -representation with 4 bytes per level, so we can represent 6.5E+08 subclasses -of any object class. This should be adequate for our purposes. :-) - -The following document is the primary basis for the schema currently being -used here: http://www.research.ibm.com/journal/sj/392/shi.html diff --git a/lib/ldb/ldb_sqlite3/base160.c b/lib/ldb/ldb_sqlite3/base160.c deleted file mode 100644 index 7ad39f7c2f5..00000000000 --- a/lib/ldb/ldb_sqlite3/base160.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - base160 code used by ldb_sqlite3 - - Copyright (C) 2004 Derrell Lipman - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - - -/* - * ldb_sqlite3_base160() - * - * Convert an integer value to a string containing the base 160 representation - * of the integer. We always convert to a string representation that is 4 - * bytes in length, and we always null terminate. - * - * Parameters: - * val -- - * The value to be converted - * - * result -- - * Buffer in which the result is to be placed - * - * Returns: - * nothing - */ -static unsigned char base160tab[161] = -{ - 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , /* 0-9 */ - 58 , 59 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , /* : ; A-H */ - 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 , /* I-R */ - 83 , 84 , 85 , 86 , 87 , 88 , 89 , 90 , 97 , 98 , /* S-Z , a-b */ - 99 , 100, 101, 102, 103, 104, 105, 106, 107, 108, /* c-l */ - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, /* m-v */ - 119, 120, 121, 122, 160, 161, 162, 163, 164, 165, /* w-z, latin1 */ - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, /* latin1 */ - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, /* latin1 */ - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, /* latin1 */ - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, /* latin1 */ - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, /* latin1 */ - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, /* latin1 */ - 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, /* latin1 */ - 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, /* latin1 */ - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, /* latin1 */ - '\0' -}; - - -/* - * lsqlite3_base160() - * - * Convert an unsigned long integer into a base160 representation of the - * number. - * - * Parameters: - * val -- - * value to be converted - * - * result -- - * character array, 5 bytes long, into which the base160 representation - * will be placed. The result will be a four-digit representation of the - * number (with leading zeros prepended as necessary), and null - * terminated. - * - * Returns: - * Nothing - */ -void -lsqlite3_base160(unsigned long val, - unsigned char result[5]) -{ - int i; - - for (i = 3; i >= 0; i--) { - - result[i] = base160tab[val % 160]; - val /= 160; - } - - result[4] = '\0'; -} - - -/* - * lsqlite3_base160Next() - * - * Retrieve the next-greater number in the base160 sequence for the terminal - * tree node (the last four digits). Only one tree level (four digits) are - * operated on. - * - * Parameters: - * base160 -- a character array containing either an empty string (in which - * case no operation is performed), or a string of base160 digits - * with a length of a multiple of four digits. - * - * Upon return, the trailing four digits (one tree level) will - * have been incremented by 1. - * - * Returns: - * base160 -- the modified array - */ -char * -lsqlite3_base160Next(char base160[]) -{ - int i; - int len; - unsigned char * pTab; - char * pBase160 = base160; - - /* - * We need a minimum of four digits, and we will always get a multiple of - * four digits. - */ - if ((len = strlen(pBase160)) >= 4) - { - pBase160 += strlen(pBase160) - 1; - - /* We only carry through four digits: one level in the tree */ - for (i = 0; i < 4; i++) { - - /* What base160 value does this digit have? */ - pTab = strchr(base160tab, *pBase160); - - /* Is there a carry? */ - if (pTab < base160tab + sizeof(base160tab) - 1) { - - /* Nope. Just increment this value and we're done. */ - *pBase160 = *++pTab; - break; - } else { - - /* - * There's a carry. This value gets base160tab[0], we - * decrement the buffer pointer to get the next higher-order - * digit, and continue in the loop. - */ - *pBase160-- = base160tab[0]; - } - } - } - - return base160; -} diff --git a/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/lib/ldb/ldb_sqlite3/ldb_sqlite3.c deleted file mode 100644 index 26c7023be17..00000000000 --- a/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ /dev/null @@ -1,1958 +0,0 @@ -/* - ldb database library - - Copyright (C) Derrell Lipman 2005 - Copyright (C) Simo Sorce 2005-2009 - - ** NOTE! The following LGPL license applies to the ldb - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -/* - * Name: ldb - * - * Component: ldb sqlite3 backend - * - * Description: core files for SQLITE3 backend - * - * Author: Derrell Lipman (based on Andrew Tridgell's LDAP backend) - */ - -#include "ldb_module.h" - -#include <sqlite3.h> - -struct lsqlite3_private { - int trans_count; - char **options; - sqlite3 *sqlite; -}; - -struct lsql_context { - struct ldb_module *module; - struct ldb_request *req; - - /* search stuff */ - long long current_eid; - const char * const * attrs; - struct ldb_reply *ares; - - bool callback_failed; - struct tevent_timer *timeout_event; -}; - -/* - * Macros used throughout - */ - -#ifndef FALSE -# define FALSE (0) -# define TRUE (! FALSE) -#endif - -#define RESULT_ATTR_TABLE "temp_result_attrs" - - -/* for testing, define to nothing, (create non-temporary table) */ -#define TEMPTAB "TEMPORARY" - -/* - * Static variables - */ -sqlite3_stmt * stmtGetEID = NULL; - -static char *lsqlite3_tprintf(TALLOC_CTX *mem_ctx, const char *fmt, ...) -{ - char *str, *ret; - va_list ap; - - va_start(ap, fmt); - str = sqlite3_vmprintf(fmt, ap); - va_end(ap); - - if (str == NULL) return NULL; - - ret = talloc_strdup(mem_ctx, str); - if (ret == NULL) { - sqlite3_free(str); - return NULL; - } - - sqlite3_free(str); - return ret; -} - -static char base160tab[161] = { - 48 ,49 ,50 ,51 ,52 ,53 ,54 ,55 ,56 ,57 , /* 0-9 */ - 58 ,59 ,65 ,66 ,67 ,68 ,69 ,70 ,71 ,72 , /* : ; A-H */ - 73 ,74 ,75 ,76 ,77 ,78 ,79 ,80 ,81 ,82 , /* I-R */ - 83 ,84 ,85 ,86 ,87 ,88 ,89 ,90 ,97 ,98 , /* S-Z , a-b */ - 99 ,100,101,102,103,104,105,106,107,108, /* c-l */ - 109,110,111,112,113,114,115,116,117,118, /* m-v */ - 119,120,121,122,160,161,162,163,164,165, /* w-z, latin1 */ - 166,167,168,169,170,171,172,173,174,175, /* latin1 */ - 176,177,178,179,180,181,182,183,184,185, /* latin1 */ - 186,187,188,189,190,191,192,193,194,195, /* latin1 */ - 196,197,198,199,200,201,202,203,204,205, /* latin1 */ - 206,207,208,209,210,211,212,213,214,215, /* latin1 */ - 216,217,218,219,220,221,222,223,224,225, /* latin1 */ - 226,227,228,229,230,231,232,233,234,235, /* latin1 */ - 236,237,238,239,240,241,242,243,244,245, /* latin1 */ - 246,247,248,249,250,251,252,253,254,255, /* latin1 */ - '\0' -}; - - -/* - * base160() - * - * Convert an unsigned long integer into a base160 representation of the - * number. - * - * Parameters: - * val -- - * value to be converted - * - * result -- - * character array, 5 bytes long, into which the base160 representation - * will be placed. The result will be a four-digit representation of the - * number (with leading zeros prepended as necessary), and null - * terminated. - * - * Returns: - * Nothing - */ -static void -base160_sql(sqlite3_context * hContext, - int argc, - sqlite3_value ** argv) -{ - int i; - long long val; - char result[5]; - - val = sqlite3_value_int64(argv[0]); - - for (i = 3; i >= 0; i--) { - - result[i] = base160tab[val % 160]; - val /= 160; - } - - result[4] = '\0'; - - sqlite3_result_text(hContext, result, -1, SQLITE_TRANSIENT); -} - - -/* - * base160next_sql() - * - * This function enhances sqlite by adding a "base160_next()" function which is - * accessible via queries. - * - * Retrieve the next-greater number in the base160 sequence for the terminal - * tree node (the last four digits). Only one tree level (four digits) is - * operated on. - * - * Input: - * A character string: either an empty string (in which case no operation is - * performed), or a string of base160 digits with a length of a multiple of - * four digits. - * - * Output: - * Upon return, the trailing four digits (one tree level) will have been - * incremented by 1. - */ -static void -base160next_sql(sqlite3_context * hContext, - int argc, - sqlite3_value ** argv) -{ - int i; - int len; - char * pTab; - char * pBase160 = strdup((const char *)sqlite3_value_text(argv[0])); - char * pStart = pBase160; - - /* - * We need a minimum of four digits, and we will always get a multiple - * of four digits. - */ - if (pBase160 != NULL && - (len = strlen(pBase160)) >= 4 && - len % 4 == 0) { -- Samba Shared Repository