int mysql_drv_init(void) { char *s; args.hosts = sb_get_value_list("mysql-host"); if (SB_LIST_IS_EMPTY(args.hosts)) { log_text(LOG_FATAL, "No MySQL hosts specified, aborting"); return 1; } hosts_pos = args.hosts; pthread_mutex_init(&hosts_mutex, NULL); args.port = sb_get_value_int("mysql-port"); args.socket = sb_get_value_string("mysql-socket"); args.user = sb_get_value_string("mysql-user"); args.password = sb_get_value_string("mysql-password"); args.db = sb_get_value_string("mysql-db"); args.myisam_max_rows = sb_get_value_int("myisam-max-rows"); args.use_ssl = sb_get_value_flag("mysql-ssl"); args.create_options = sb_get_value_string("mysql-create-options"); if (args.create_options == NULL) args.create_options = ""; use_ps = 0; #ifdef HAVE_PS mysql_drv_caps.prepared_statements = 1; if (db_globals.ps_mode != DB_PS_MODE_DISABLE) use_ps = 1; #endif s = sb_get_value_string("mysql-engine-trx"); if (s == NULL) { log_text(LOG_FATAL, "--mysql-engine-trx requires an argument"); return 1; } if (!strcasecmp(s, "yes")) args.engine_trx = ENGINE_TRX_YES; else if (!strcasecmp(s, "no")) args.engine_trx = ENGINE_TRX_NO; else if (!strcasecmp(s, "auto")) args.engine_trx = ENGINE_TRX_AUTO; else { log_text(LOG_FATAL, "Invalid value for mysql-engine-trx: %s", s); return 1; } s = sb_get_value_string("mysql-table-engine"); mysql_library_init(0, NULL, NULL); return parse_table_engine(s); }
int attachsql_drv_init(void) { args.hosts = sb_get_value_list("attachsql-host"); if (SB_LIST_IS_EMPTY(args.hosts)) { log_text(LOG_FATAL, "No libAttachSQL hosts specified, aborting"); return 1; } hosts_pos = args.hosts; pthread_mutex_init(&hosts_mutex, NULL); args.port = (unsigned int)sb_get_value_int("attachsql-port"); args.socket = sb_get_value_string("attachsql-socket"); args.user = sb_get_value_string("attachsql-user"); args.password = sb_get_value_string("attachsql-password"); args.db = sb_get_value_string("attachsql-db"); attachsql_library_init(); return 0; }