[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5338 - in GNUnet: . src/applications/sqstore_mysql
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5338 - in GNUnet: . src/applications/sqstore_mysql |
Date: |
Sun, 22 Jul 2007 02:17:21 -0600 (MDT) |
Author: grothoff
Date: 2007-07-22 02:17:19 -0600 (Sun, 22 Jul 2007)
New Revision: 5338
Modified:
GNUnet/UPDATING
GNUnet/configure.ac
GNUnet/src/applications/sqstore_mysql/mysql.c
Log:
trying to add mysql migration code
Modified: GNUnet/UPDATING
===================================================================
--- GNUnet/UPDATING 2007-07-22 07:52:00 UTC (rev 5337)
+++ GNUnet/UPDATING 2007-07-22 08:17:19 UTC (rev 5338)
@@ -11,8 +11,7 @@
0.7.2a to HEAD
==============
-WARNING: Migration of the content in your databases is not yet supported.
-(all of your existing content will be "lost" (for now)).
+Run gnunet-update.
0.7.2 to 0.7.2a
Modified: GNUnet/configure.ac
===================================================================
--- GNUnet/configure.ac 2007-07-22 07:52:00 UTC (rev 5337)
+++ GNUnet/configure.ac 2007-07-22 08:17:19 UTC (rev 5338)
@@ -21,8 +21,8 @@
#
#
AC_PREREQ(2.57)
-AC_INIT([GNUnet], [0.7.2a],address@hidden)
-AM_INIT_AUTOMAKE([GNUnet], [0.7.2a])
+AC_INIT([GNUnet], [0.7.2a-SVN],address@hidden)
+AM_INIT_AUTOMAKE([GNUnet], [0.7.2a-SVN])
AM_CONFIG_HEADER([config.h])
AH_TOP([#define _GNU_SOURCE 1])
Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c 2007-07-22 07:52:00 UTC
(rev 5337)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c 2007-07-22 08:17:19 UTC
(rev 5338)
@@ -1519,4 +1519,71 @@
coreAPI = NULL;
}
+
+/**
+ * Update mysql database module.
+ */
+void
+update_module_sqstore_mysql (UpdateAPI * uapi) {
+ ectx = uapi->ectx;
+#ifndef WINDOWS
+ pw = getpwuid (getuid ());
+ if (!pw)
+ GE_DIE_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "getpwuid");
+ home_dir = STRDUP (pw->pw_dir);
+#else
+ home_dir = (char *) MALLOC (_MAX_PATH + 1);
+ plibc_conv_to_win_path ("~/", home_dir);
+#endif
+ nX = strlen (home_dir) + 10;
+ cnffile = MALLOC (nX);
+ SNPRINTF (cnffile, nX, "%s/.my.cnf", home_dir);
+ FREE (home_dir);
+ GC_get_configuration_value_filename (uapi->cfg,
+ "MYSQL", "CONFIG", cnffile, &home_dir);
+ FREE (cnffile);
+ cnffile = home_dir;
+ GE_LOG (ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ _("Trying to use file `%s' for MySQL configuration.\n"), cnffile);
+ fp = FOPEN (cnffile, "r");
+ if (!fp)
+ {
+ GE_LOG_STRERROR_FILE (ectx,
+ GE_ERROR | GE_ADMIN | GE_BULK, "fopen", cnffile);
+ FREE (cnffile);
+ return;
+ }
+ else
+ {
+ fclose (fp);
+ }
+ dbh = MALLOC (sizeof (mysqlHandle));
+ memset(dbh, 0, sizeof(mysqlHandle));
+ dbh->cnffile = cnffile;
+ if (OK != iopen ())
+ {
+ FREE (cnffile);
+ FREE (dbh);
+ GE_LOG (ectx,
+ GE_ERROR | GE_BULK | GE_USER,
+ _
+ ("Failed to load MySQL database module. Check that MySQL is
running and configured properly!\n"));
+ dbh = NULL;
+ return;
+ }
+ if ( (0 == mysql_query(dbh->dbf,
+ "ALTER TABLE gn070 ADD COLUMN vkey BIGINT UNSIGNED
PRIMARY KEY AUTO_INCREMENT")) &&
+ (0 == mysql_query(dbh->dbf,
+ "INSERT INTO gn071
(size,type,prio,anonLevel,expire,hash,vkey) (SELECT
size,type,prio,anonLevel,expire,hash,vkey FROM gn070)")) &&
+ (0 == mysql_query(dbh->dbf,
+ "INSERT INTO gn072 (vkey,value) (SELECT vkey,value
FROM gn070)") ) )
+ mysql_query("DROP TABLE gn070");
+
+ }
+ iclose();
+ mysql_library_end ();
+ ectx = NULL;
+}
+
/* end of mysql.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5338 - in GNUnet: . src/applications/sqstore_mysql,
gnunet <=