예제 #1
0
        /// <summary>
        /// Creates new PDO DB connection.
        /// </summary>
        public override PDOConnection OpenConnection(ScriptContext context, string dsn_data, string username, string password, object argdriver_options)
        {
            ////Determine file path
            //string filename = dsn_data.Replace('/', Path.DirectorySeparatorChar);
            //string filePath = Path.GetFullPath(Path.Combine(context.WorkingDirectory, filename));

            var csb = new MySqlConnectionStringBuilder();

            SetupConnectionString(csb, dsn_data);
            csb.AllowUserVariables = true;
            csb.AllowZeroDateTime  = true;
            if (username != null)
            {
                csb.UserID = username;
            }
            if (password != null)
            {
                csb.Password = password;
            }
            if (argdriver_options is PhpArray)
            {
                // TODO: process argdriver_options
            }

            var con = new PDOConnection(csb.GetConnectionString(true), new MySqlConnection(), "PDO mysql connection");

            con.Connect();
            return(con);
        }
예제 #2
0
        public override PDOConnection OpenConnection(ScriptContext context, string dsn_data, string username, string password, object argdriver_options)
        {
            //Determine file path
            string filename = dsn_data.Replace('/', Path.DirectorySeparatorChar);
            string filePath = Path.GetFullPath(Path.Combine(context.WorkingDirectory, filename));

            SQLiteConnectionStringBuilder csb = new SQLiteConnectionStringBuilder();
            csb.DataSource = filePath;
            csb.Version = 3;

            var con = new PDOConnection(csb.ConnectionString, new SQLiteConnection(), "PDO sqllite connection");
            con.Connect();

            return con;
        }
예제 #3
0
        public override PDOConnection OpenConnection(ScriptContext context, string dsn_data, string username, string password, object argdriver_options)
        {
            //Determine file path
            string filename = dsn_data.Replace('/', Path.DirectorySeparatorChar);
            string filePath = Path.GetFullPath(Path.Combine(context.WorkingDirectory, filename));

            SQLiteConnectionStringBuilder csb = new SQLiteConnectionStringBuilder();

            csb.DataSource = filePath;
            csb.Version    = 3;

            var con = new PDOConnection(csb.ConnectionString, new SQLiteConnection(), "PDO sqllite connection");

            con.Connect();

            return(con);
        }
예제 #4
0
        /// <summary>
        /// Creates new PDO DB connection.
        /// </summary>
        public override PDOConnection OpenConnection(ScriptContext context, string dsn_data, string username, string password, object argdriver_options)
        {
            ////Determine file path
            //string filename = dsn_data.Replace('/', Path.DirectorySeparatorChar);
            //string filePath = Path.GetFullPath(Path.Combine(context.WorkingDirectory, filename));

            var csb = new MySqlConnectionStringBuilder();
            SetupConnectionString(csb, dsn_data);
            csb.AllowUserVariables = true;
            csb.AllowZeroDateTime = true;
            if (username != null) csb.UserID = username;
            if (password != null) csb.Password = password;
            if (argdriver_options is PhpArray)
            {
                // TODO: process argdriver_options
            }

            var con = new PDOConnection(csb.GetConnectionString(true), new MySqlConnection(), "PDO mysql connection");
            con.Connect();
            return con;
        }