Esempio n. 1
0
 /// <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"])));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Prepares the query by setting the default DB if it doesn't exist.
 /// </summary>
 protected Query PrepareQuery(ReqlAst term, OptArgs globalOpts) {
     SetDefaultDb(globalOpts);
     Query q = Query.Start(NewToken(), term, globalOpts);
     if (globalOpts?.ContainsKey("noreply") == true) {
         throw new ReqlDriverError("Don't provide the noreply option as an optarg. Use `.RunNoReply` instead of `.Run`");
     }
     return q;
 }