src/hg/lib/jksql.c 1.129
1.129 2009/04/13 22:34:11 markd
added function to determine if a mysql server appears to be remote; ignore SQL_TAB_FILE_ON_SERVER if server is remote
Index: src/hg/lib/jksql.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/jksql.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -b -B -U 4 -r1.128 -r1.129
--- src/hg/lib/jksql.c 28 Feb 2009 00:34:00 -0000 1.128
+++ src/hg/lib/jksql.c 13 Apr 2009 22:34:11 -0000 1.129
@@ -1128,9 +1128,10 @@
void sqlLoadTabFile(struct sqlConnection *conn, char *path, char *table,
unsigned options)
/* Load a tab-seperated file into a database table, checking for errors.
- * Options are the SQL_TAB_* bit set. */
+ * Options are the SQL_TAB_* bit set. SQL_TAB_FILE_ON_SERVER is ignored if
+ * sqlIsRemote() returns true. */
{
assert(!conn->isFree);
char tabPath[PATH_LEN];
char query[PATH_LEN+256];
@@ -1153,9 +1154,9 @@
#endif
/* determine if tab file can be accessed directly by the database, or send
* over the network */
-if (options & SQL_TAB_FILE_ON_SERVER)
+if ((options & SQL_TAB_FILE_ON_SERVER) && !sqlIsRemote(conn))
{
/* tab file on server requiries full path */
strcpy(tabPath, "");
if (path[0] != '/')
@@ -2421,4 +2422,11 @@
/* If set to TRUE, will make more diagnostic stderr messages. */
{
sqlParanoid = beParanoid;
}
+
+boolean sqlIsRemote(struct sqlConnection *conn)
+/* test if the conn appears to be to a remote system.
+ * Current only tests for a TCP/IP connection */
+{
+return (conn->conn->unix_socket == NULL);
+}