Exemplo n.º 1
0
    public static bool Connect()
    {
        bool result;

        if (!MySQL1.Initialized || MySQL1.SQL == IntPtr.Zero)
        {
            result = false;
        }
        else if (MySQL1.mysql_real_connect(MySQL1.SQL, MySQL1.HostName, MySQL1.Username, MySQL1.Password, MySQL1.Database, MySQL1.HostPort, MySQL1.UnixSocket, MySQL1.ConnectFlags) == IntPtr.Zero)
        {
            result = false;
        }
        else
        {
            MySQL1.ServerVersion = new Version(MySQL1.mysql_get_server_version(MySQL1.SQL).ToString("#-##-##").Replace("-", "."));
            result = (MySQL1.IsReady = true);
        }
        return(result);
    }