7c459941c1e589297e0014bf7957599f70836096
hiram
  Thu Apr 4 11:08:18 2019 -0700
moving some SQL functions to jksql.c from hgTables refs #18869 #23233

diff --git src/hg/inc/jksql.h src/hg/inc/jksql.h
index 71193c9..2a90f19 100644
--- src/hg/inc/jksql.h
+++ src/hg/inc/jksql.h
@@ -12,31 +12,31 @@
  * to normal form.
  *
  * These routines will all print an error message and abort if
  * there's a problem, cleaning up open connections, etc. on abort
  * (or on program exit).  Do a pushAbortHandler if you want to
  * catch the aborts.  The error messages from bad SQL syntax
  * are actually pretty good (they're just passed on from
  * mySQL). */
 #ifndef JKSQL_H
 #define JKSQL_H
 
 #include "sqlNum.h"
 #include "sqlList.h"
 #include "hash.h"
 #include "dystring.h"
-
+#include "asParse.h"
 
 char *getDefaultProfileName();  // name of default profile
 
 struct sqlConnection *sqlConnect(char *database);
 /* Connect to database on default host as default user. */
 
 struct sqlConnection *sqlMayConnect(char *database);
 /* Connect to database on default host as default user.
  * Return NULL (don't abort) on failure. */
 
 struct sqlConnection *sqlConnectProfile(char *profileName, char *database);
 /* Connect to profile or database using the specified profile.  Can specify
  * profileName, database, or both. The profile is the prefix to the host,
  * user, and password variables in .hg.conf.  For the default profile of "db",
  * the environment variables HGDB_HOST, HGDB_USER, and HGDB_PASSWORD can
@@ -750,16 +750,43 @@
 /* Append a comma-separated, quoted and escaped list of values. */
 
 void sqlCheckError(char *format, ...)
 /* A sql injection error has occurred. Check for settings and respond
  * as appropriate with error, warning, logOnly, ignore, dumpstack.
  * Then abort if needed. NOTE: unless it aborts, this function will return! */
 #ifdef __GNUC__
 __attribute__((format(printf, 1, 2)))
 #endif
 ;
 
 struct sqlConnection *sqlFailoverConn(struct sqlConnection *sc);
 /* returns the failover connection of a connection or NULL.
  * (Needed because the sqlConnection is not in the .h file) */
 
+/* structure moved here from hgTables.h 2019-03-04 - Hiram */
+struct sqlFieldType
+/* List field names and types */
+    {
+    struct sqlFieldType *next;
+    char *name;         /* Name of field. */
+    char *type;         /* Type of field (MySQL notion) */
+    };
+
+struct sqlFieldType *sqlFieldTypeNew(char *name, char *type);
+/* Create a new sqlFieldType */
+
+void sqlFieldTypeFree(struct sqlFieldType **pFt);
+/* Free resources used by sqlFieldType */
+
+void sqlFieldTypeFreeList(struct sqlFieldType **pList);
+/* Free a list of dynamically allocated sqlFieldType's */
+
+struct sqlFieldType *sqlFieldTypesFromAs(struct asObject *as);
+/* Convert asObject to list of sqlFieldTypes */
+
+struct sqlFieldType *sqlListFieldsAndTypes(struct sqlConnection *conn, char *table);
+/* Get list of fields including their names and types.  The type currently is
+ * just a MySQL type string. */
+
+
+
 #endif /* JKSQL_H */