示例#1
0
        private string SuperClean(string inStr)
        {
            string t = ParseJSONObjects.cleanTextforSQL(inStr);
            string s = "";

            foreach (char x in t)
            {
                if (x != '?')
                {
                    s += x;
                }
            }

            return(s);
        }
示例#2
0
        public void Pop()
        {
            foreach (KeyValuePair <string, List <KeyValuePair <string, Hashtable> > > tmpp in stack)
            {
                List <KeyValuePair <string, Hashtable> > tmp = tmpp.Value as List <KeyValuePair <string, Hashtable> >;
                foreach (KeyValuePair <string, Hashtable> t in tmp)
                {
                    List <KeyValuePair <string, List <string> > > temp;

                    if (!cat.Contains(ParseJSONObjects.repSpac2Und(t.Key)))
                    {
                        cat.Add(ParseJSONObjects.repSpac2Und(t.Key));
                        temp = asemb(t);
                    }
                    else
                    {
                        temp = findDuc(ParseJSONObjects.repSpac2Und(t.Key));
                    }
                }
            }

            rela.Clear();


            foreach (KeyValuePair <string, KeyValuePair <string, Hashtable> > tmpp in chunk)
            {
                List <string> tables = new List <string>();
                KeyValuePair <string, Hashtable> tmp = tmpp.Value;

                //If cat does not contain the category
                List <KeyValuePair <string, List <string> > > temp = findsDuc(tmp);

                //write mysql query of saved cates and required parameters as recorded, and save those queries to local *.sql file.
                foreach (KeyValuePair <string, List <string> > product in temp)
                {
                    if (!tables.Contains(ParseJSONObjects.repSpac2Und(product.Key)))
                    {
                        tables.Add(ParseJSONObjects.repSpac2Und(product.Key));

                        string query  = "Insert into " + ParseJSONObjects.repSpac2Und(product.Key.ToString()) + " set business_id='" + ParseJSONObjects.cleanTextforSQL(tmpp.Key) + "',";
                        int    before = query.Length;

                        foreach (string s in (product.Value as List <string>))
                        {
                            query += ParseJSONObjects.repSpac2Und(s) + "='" + ParseJSONObjects.cleanTextforSQL((tmp.Value as Hashtable)[ParseJSONObjects.repSpac2Und(s)].ToString()) + "',";
                        }


                        query = query.Substring(0, query.Length - 1) + ";";

                        using (StreamWriter w = File.AppendText(Parser.dataDir + "/sub/insertIntoCatTables.sql"))
                        {
                            w.WriteLine(query);
                        }
                    }


                    //end inner 'foreach'
                }

                //end outter 'foreach'
            }


            this.sortMeow();
            //end func
        }