3228e85fa927785f7b52ad8320ef9f3484509424 galt Wed Aug 5 01:00:31 2015 -0700 Initial check-in for Add-SSL-Support-Options to jksql.c and to hgsql-and-family functions. diff --git src/hg/inc/jksql.h src/hg/inc/jksql.h index f77efe9..e3119cf 100644 --- src/hg/inc/jksql.h +++ src/hg/inc/jksql.h @@ -13,77 +13,95 @@ * * 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" + extern char *defaultProfileName; // name of default profile +/* create a new profile object (does not include ->dbs) */ + 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 * override. */ struct sqlConnection *sqlMayConnectProfile(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 * override. Return NULL if connection fails. */ struct sqlConnection *sqlConnectRemote(char *host, char *user, char *password, char *database); /* Connect to database somewhere as somebody. Database maybe NULL to - * just connect to the server. Abort on error. */ + * just connect to the server. Abort on error. + * This only takes limited connection parameters. Use Full version for access to all.*/ struct sqlConnection *sqlMayConnectRemote(char *host, char *user, char *password, char *database); /* Connect to database somewhere as somebody. Database maybe NULL to - * just connect to the server. Return NULL can't connect */ + * just connect to the server. Return NULL if can't connect. + * This only takes limited connection parameters. Use Full version for access to all.*/ + +struct sqlConnection *sqlConnectRemoteFull(struct slPair *pairs, char *database); +/* Connect to database somewhere as somebody. Database maybe NULL to + * just connect to the server. Abort on error. + * Connection parameter pairs contains a list of name/values. */ -void sqlProfileConfig(char *profileName, char *host, unsigned int port, char *socket, - char *user, char *password); +struct sqlConnection *sqlMayConnectRemoteFull(struct slPair *pairs, char *database); +/* Connect to database somewhere as somebody. Database maybe NULL to + * just connect to the server. + * Connection parameter pairs contains a list of name/values. Return NULL if can't connect.*/ + +void sqlProfileConfig(struct slPair *pairs); /* Set configuration for the profile. This overrides an existing profile in * hg.conf or defines a new one. Results are unpredictable if a connect cache * has been established for this profile. */ -void sqlProfileConfigDefault(char *host, unsigned int port, char *socket, char *user, - char *password); +void sqlProfileConfigDefault(struct slPair *pairs); /* Set configuration for the default profile. This overrides an existing * profile in hg.conf or defines a new one. Results are unpredictable if a * connect cache has been established for this profile. */ +char *sqlProfileToMyCnf(char *profileName); +/* Read in profile named, + * and create a multi-line setting string usable in my.cnf files. + * Return Null if profile not found. */ + void sqlProfileAddDb(char *profileName, char *db); /* add a mapping of db to profile. If database is already associated with * this profile, it is ignored. If it is associated with a different profile, * it is an error. */ struct slName* sqlProfileGetNames(); /* Get a list of all profile names. slFreeList result when done */ struct hash *sqlHashOfDatabases(void); /* Get hash table with names of all databases that are online. */ struct slName *sqlListOfDatabases(void); /* Get list of all databases that are online. */ void sqlDisconnect(struct sqlConnection **pSc);