コード例 #1
0
 /// <summary>
 /// 初始化一个Mysql代理的基本信息
 /// </summary>
 /// <param name="sSQLyogTunnel">安装目录下的SQLyogTunnel.php的url,必须将此文件传送到您的服务器上,使用前确保你的服务器能访问数据库。</param>
 /// <param name="DBHost">数据库IP地址</param>
 /// <param name="DBUser">用户名</param>
 /// <param name="DBPassword">密码</param>
 /// <param name="DBName">数据名称</param>
 /// <param name="port">端口</param>
 /// <param name="charset">字符集</param>
 public static void InitMySQLProxy(string sSQLyogTunnel, string DBHost, string DBUser, string DBPassword, string DBName, int port, string charset)
 {
     PHPInput.init(DBHost, DBUser, DBPassword, DBName);
     PHPInput.charset = charset;
     PHPInput.port    = port.ToString();
     PHPInput.isinit  = true;
     SQLyogTunnel     = sSQLyogTunnel;
 }
コード例 #2
0
        /// <summary>
        /// 执行MySQL语句
        /// </summary>
        /// <param name="sql">要执行的语句</param>
        /// <returns>返回一个xml文件</returns>
        private static string Execute(string sql)
        {
            if (!PHPInput.isinit)
            {
                throw new MySqlProxyException(-1, "未初始化MySQLProxy代理");
            }
            string phpinput = PHPInput.getxml(sql);

            System.Net.WebClient wc = new System.Net.WebClient();
            byte[]    buffer        = wc.UploadData(SQLyogTunnel, System.Text.Encoding.UTF8.GetBytes(phpinput));
            string    result        = System.Text.Encoding.UTF8.GetString(buffer);
            Exception ex            = new XmlParser(result).GetException();

            if (ex != null)
            {
                throw ex;
            }
            return(result);
        }
コード例 #3
0
 /// <summary>
 /// 初始化一个Mysql代理的基本信息
 /// </summary>
 /// <param name="sSQLyogTunnel">安装目录下的SQLyogTunnel.php的url,必须将此文件传送到您的服务器上,使用前确保你的服务器能访问数据库。</param>
 /// <param name="DBHost">数据库IP地址</param>
 /// <param name="DBUser">用户名</param>
 /// <param name="DBPassword">密码</param>
 /// <param name="DBName">数据名称</param>
 public static void InitMySQLProxy(string sSQLyogTunnel, string DBHost, string DBUser, string DBPassword, string DBName)
 {
     PHPInput.init(DBHost, DBUser, DBPassword, DBName);
     SQLyogTunnel = sSQLyogTunnel;
 }