[65385] trunk/base/src/cregistry
raimue at macports.org
raimue at macports.org
Thu Mar 25 15:38:02 PDT 2010
Revision: 65385
http://trac.macports.org/changeset/65385
Author: raimue at macports.org
Date: 2010-03-25 15:38:02 -0700 (Thu, 25 Mar 2010)
Log Message:
-----------
cregistry:
Add an SQLite extension which helps to examine and modify registry.db for
debugging. This is only meant for debugging purposes and is therefore not being
installed.
Modified Paths:
--------------
trunk/base/src/cregistry/Makefile
Added Paths:
-----------
trunk/base/src/cregistry/README.sqlext
trunk/base/src/cregistry/sqlext.c
Property Changed:
----------------
trunk/base/src/cregistry/
Property changes on: trunk/base/src/cregistry
___________________________________________________________________
Modified: svn:ignore
- cregistry.a
+ cregistry.a
macports.sqlext
Modified: trunk/base/src/cregistry/Makefile
===================================================================
--- trunk/base/src/cregistry/Makefile 2010-03-25 22:31:23 UTC (rev 65384)
+++ trunk/base/src/cregistry/Makefile 2010-03-25 22:38:02 UTC (rev 65385)
@@ -4,12 +4,13 @@
STLIB_NAME = cregistry.a
RANLIB = ranlib
+SQLEXT_NAME = macports.sqlext
+SQLEXT_OBJS = sqlext.o vercomp.o
include ../../Mk/macports.autoconf.mk
+all:: ${STLIB_NAME} ${SQLEXT_NAME}
-all:: ${STLIB_NAME}
-
.c.o:
${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
@@ -17,8 +18,11 @@
${STLIB_LD} ${STLIB_NAME} ${OBJS}
${RANLIB} ${STLIB_NAME}
+${SQLEXT_NAME}: ${SQLEXT_OBJS}
+ ${SHLIB_LD} ${SQLEXT_OBJS} -o $@
+
clean::
- rm -f ${STLIB_NAME} ${OBJS}
+ rm -f ${STLIB_NAME} ${SQLEXT_NAME} ${OBJS}
distclean:: clean
Added: trunk/base/src/cregistry/README.sqlext
===================================================================
--- trunk/base/src/cregistry/README.sqlext (rev 0)
+++ trunk/base/src/cregistry/README.sqlext 2010-03-25 22:38:02 UTC (rev 65385)
@@ -0,0 +1,12 @@
+The macports.sqlext is meant to ease debugging the registry database by
+providing the necessary SQLite extensions to examine and modify the database
+using the sqlite3 command line tool.
+
+To use this SQLite extension, use '.load macports.sqlext' at the sqlite3 prompt
+right after attaching the registry.db file.
+
+Example:
+
+$ sqlite3 /opt/local/var/macports/registry/registry.db
+...
+sqlite> .load ~/src/macports/trunk/base/src/cregistry/macports.sqlext
Added: trunk/base/src/cregistry/sqlext.c
===================================================================
--- trunk/base/src/cregistry/sqlext.c (rev 0)
+++ trunk/base/src/cregistry/sqlext.c 2010-03-25 22:38:02 UTC (rev 65385)
@@ -0,0 +1,29 @@
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "vercomp.h"
+
+#include <string.h>
+#include <sqlite3ext.h>
+SQLITE_EXTENSION_INIT1
+
+/**
+ * Extension for sqlite3 defining collates being used in our DB. This can be
+ * used by any sqlite3 client to load the required collates.
+ *
+ * @param [in] db database connection
+ * @param [out] pzErrMsg error messages string
+ * @param [in] pApi API methods
+ */
+int sqlite3_extension_init(
+ sqlite3 *db, /* The database connection */
+ char **pzErrMsg UNUSED, /* Write error messages here */
+ const sqlite3_api_routines *pApi /* API methods */
+) {
+ SQLITE_EXTENSION_INIT2(pApi)
+
+ sqlite3_create_collation(db, "VERSION", SQLITE_UTF8, NULL, sql_version);
+
+ return 0;
+}
Property changes on: trunk/base/src/cregistry/sqlext.c
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100325/e0c9ab88/attachment-0001.html>
More information about the macports-changes
mailing list