Пример #1
0
        static public string SqlString(string sSql)
        {
            string sResult = "";

            using (QMySql s = new QMySql())
            {
                s.Open(sSql);
                if (s.GetRow())
                {
                    sResult = s.GetString(0);
                }
            }

            return(sResult);
        }
Пример #2
0
        static public IEnumerable <string> SqlList(string sql)
        {
            List <string> result = new List <string>();

            using (QMySql s = new QMySql())
            {
                s.Open(sql);
                while (s.GetRow())
                {
                    result.Add(s.GetString(0));
                }
            }

            return(result);
        }
Пример #3
0
        static public int Exec(string sSql, string connectString = null)
        {
            if (connectString == null)
            {
                connectString = ConnectString;
            }

            int nResult = 0;

            using (QMySql s = new QMySql(connectString))
            {
                nResult = s.Execute(sSql);
            }

            return(nResult);
        }
Пример #4
0
        static public int SqlInt(bool useRawValues, string sql, params object[] args)
        {
            int nResult = 0;

            AddArgsToQuery(useRawValues, ref sql, args);

            using (QMySql s = new QMySql())
            {
                s.Open(sql);
                if (s.GetRow())
                {
                    nResult = s.GetInt(0);
                }
            }

            return(nResult);
        }
Пример #5
0
 public static void Connect(string host, string database, string user, string password)
 {
     QMySql.ConnectString = "Server=" + host + ";Encrypt=false;Database=" + database + ";Uid=" + user + ";Pwd=" + password + ";Allow User Variables=True;";
     QMySql.SqlInt("select count(*) FROM INFORMATION_SCHEMA.TABLES");
 }