Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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");
 }