Beispiel #1
0
        /// <summary>
        /// Fetches the method from the type of query 
        /// </summary>
        /// <param name="method"></param>
        protected virtual List<string> ParseMethod(IMethod method) {
            List<string> parsed = new List<string>();

            if (method is Find) {
                parsed.Add("SELECT");
            }
            else if (method is Save) {
                parsed.Add("INSERT");
            }
            else if (method is Merge) {
                parsed.Add("REPLACE");
            }
            else if (method is Create) {
                if (method.Any(statement => statement is Builders.Database) == true || method.Any(statement => statement is Collection) == true) {
                    parsed.Add("CREATE");
                }
                else if (method.Any(statement => statement is Field) == true) {
                    parsed.Add("ADD");
                }
            }
            else if (method is Modify) {
                parsed.Add("UPDATE");
            }
            else if (method is Remove) {
                parsed.Add("DELETE");
            }
            else if (method is Drop) {
                parsed.Add("DROP");
            }
            else if (method is Index) {
                parsed.Add("CREATE");
            }
            else if (method is Alter) {
                parsed.Add("ALTER");
            }

            return parsed;
        }
Beispiel #2
0
        protected virtual List<String> ParseMethod(IMethod method) {
            List<String> parsed = new List<string>();

            if (method.Any(item => item is Distinct) == true) {
                parsed.Add("distinct");
            }
            else if (method is Create) {
                parsed.Add("create");
            }
            else if (method is Find) {
                parsed.Add("find");
            }
            else if (method is Remove) {
                parsed.Add("remove");
            }
            else if (method is Modify) {
                parsed.Add("update");
            }
            else if (method is Save) {
                parsed.Add("save");
            }
            else if (method is Drop) {
                parsed.Add("drop");
            }
            else if (method is Merge) {
                parsed.Add("findAndModify");
            }

            return parsed;
        }