/// <summary> /// Sets the database if it's not already set. /// </summary> protected void SetDefaultDb(OptArgs globalOpts) { if (globalOpts?.ContainsKey("db") == false && dbname != null) { // Only override the db global arg if the user hasn't // specified one already and one is specified on the connection globalOpts.With("db", dbname); } if (globalOpts?.ContainsKey("db") == true) { // The db arg must be wrapped in a db ast object globalOpts.With("db", new Db(Arguments.Make(globalOpts["db"]))); } }
void IConnection.RunNoReply(ReqlAst term, object globalOpts) { OptArgs opts = OptArgs.FromAnonType(globalOpts); SetDefaultDb(opts); opts.With("noreply", true); SendQueryNoReply(Query.Start(NewToken(), term, opts)); }