/// <summary> /// Execute a query against the database. Query means only idempotent commands like SQL SELECT and TRAVERSE. Idempotent /// means the command is read-only and can't change the database. Remember that in IE6 the URL can be maximum of 2,083 /// characters. Other browsers supports major length, but if you want to stay compatible with all limit to 2,083 /// characters. /// </summary> /// <param name="query">The text containing the query to execute</param> /// <param name="database">The database</param> /// <param name="language"> /// the name of the language between those supported. OrientDB distribution comes with "sql" only. /// Gremlin language cannot be executed with query because it cannot guarantee to be idempotent. To execute Gremlin use /// command instead. /// </param> /// <remarks> /// Syntax: http://<server>:[<port>]/query/<database>/<language>/<query-text>[/<limit /// >][/<fetchPlan>] /// </remarks> /// <see cref="GetQuery"/> public OrientdbResponse <T> GetQuery <T>(string query, string database, CommandLanguage language) { query.ThrowIfNullOrEmpty("query"); database.ThrowIfNullOrEmpty("database"); string url = "query/{0}/{1}/{2}".F(Encoded(database), Encoded(language.ToString().ToLower()), query); return(DoRequest <T>("GET", url, query)); }
/// <summary> /// Execute a command against the database. Returns the records affected or the list of records for queries. Command executed via POST. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="query">The query containing the command to execute</param> /// <param name="database">database name</param> /// <param name="language">The name of the language between those supported. OrientDB distribution comes with "sql" and GraphDB distribution has both "sql" and "gremlin"</param> /// <returns><see cref="BaseResult{T}"/></returns> public BaseResult <T> BaseResultCommand <T>(string query, string database, CommandLanguage language) { OrientdbResponse <BaseResult <T> > request = Command <BaseResult <T> >(query, database, language); return(request.Response); }
/// <summary> /// Execute a command against the database. Returns the records affected or the list of records for queries. Command executed via POST. /// </summary> /// <param name="query">The query containing the command to execute</param> /// <param name="database">database name</param> /// <param name="language">The name of the language between those supported. OrientDB distribution comes with "sql" and GraphDB distribution has both "sql" and "gremlin"</param> /// <returns><see cref="OrientdbResponse{DynamicDictionary}"/></returns> /// <see cref="http://www.orientechnologies.com/docs/last/orientdb.wiki/OrientDB-REST.html#command"/> public OrientdbResponse <DynamicDictionary> Command(string query, string database, CommandLanguage language) { query.ThrowIfNullOrEmpty("query"); database.ThrowIfNullOrEmpty("database"); string url = "command/{0}/{1}".F(Encoded(database), Encoded(language.ToString().ToLower())); return(OrientdbResponse.Wrap(DoRequest <Dictionary <string, object> >("POST", url, query))); }