1f311ce51ddbd0ad3c2a49f3a9abad95b7b2d8f5
kent
  Fri Feb 20 12:36:08 2015 -0800
A new module for tables on the web mostly.

diff --git src/hg/lib/tablesTables.c src/hg/lib/tablesTables.c
new file mode 100644
index 0000000..2b0b35e
--- /dev/null
+++ src/hg/lib/tablesTables.c
@@ -0,0 +1,27 @@
+/* tablesTables - this module deals with two types of tables SQL tables in a database,
+ * and fieldedTable objects in memory. It has routines to do sortable, filterable web
+ * displays on tables. */
+
+#include "common.h"
+#include "hash.h"
+#include "linefile.h"
+#include "jksql.h"
+#include "fieldedTable.h"
+#include "web.h"
+#include "cart.h"
+
+struct fieldedTable *fieldedTableFromDbQuery(struct sqlConnection *conn, char *query)
+/* Return fieldedTable from a database query */
+{
+struct sqlResult *sr = sqlGetResult(conn, query);
+char **fields;
+int fieldCount = sqlResultFieldArray(sr, &fields);
+struct fieldedTable *table = fieldedTableNew(query, fields, fieldCount);
+char **row;
+int i = 0;
+while ((row = sqlNextRow(sr)) != NULL)
+    fieldedTableAdd(table, row, fieldCount, ++i);
+sqlFreeResult(&sr);
+return table;
+}
+