Ejemplo n.º 1
0
        public List <List <string> > getKeyValuePairs(string section)
        {
            if (!getSections().Contains(section))
            {
                return(null);
            }

            SqlQuery query = new SqlQuery();
            //query.Password = mPassword;

            SqlStringBuilder builder = SqlStringBuilderFactory.createSELECT();
            {
                var table = builder;
                table.addTable(section);
                table.addColumn("Key");
                table.addColumn("Json");
            }
            string qs = builder.ToString();
            Dictionary <string, object> @params = builder.getParameterValues();
            List <List <string> >       dt      = query.execute(qs, mDatabase, @params);

            if (dt == null || dt.Count == 0)
            {
                return(new List <List <string> >());//new List<KeyValuePair<string, string>>();
            }
            return(dt);
            //(from row in dt
            //    select new KeyValuePair<string, string>(row[0].ToString(), row[1].ToString())).ToList();
        }
Ejemplo n.º 2
0
        public object readEntry(string section, string key)
        {
            if (!getSections().Contains(section))
            {
                return(null);
            }

            SqlQuery query = new SqlQuery();
            //query.Password = mPassword;

            SqlStringBuilder builder = SqlStringBuilderFactory.createSELECT();
            {
                var withBlock = builder;
                withBlock.addTable(section);
                withBlock.addColumn("Json");
                withBlock.addCondition("Key", "=", key);
            }
            string qs = builder.ToString();
            Dictionary <string, object> @params = builder.getParameterValues();
            List <List <string> >       dt      = query.execute(qs, mDatabase, @params);

            if (dt == null || dt.Count == 0)
            {
                return(null);
            }

            return(dt[0][0]);
        }
Ejemplo n.º 3
0
        private ArrayList getTables()
        {
            ArrayList result = new ArrayList();

            SqlQuery query = new SqlQuery();
            //query.Password = mPassword;

            SqlStringBuilder builder = SqlStringBuilderFactory.createSELECT();
            {
                var withBlock = builder;
                withBlock.addTable("sqlite_master");
                withBlock.addColumn("name");
                withBlock.addCondition("type", "=", "table");
            }

            string qs = builder.ToString();
            Dictionary <string, object> @params = builder.getParameterValues();
            List <List <string> >       dt      = query.execute(qs, mDatabase, @params);

            if (dt == null || dt.Count == 0)
            {
                return(result);
            }

            foreach (List <string> row in dt)
            {
                result.Add(row[0]);
            }

            return(result);
        }