public virtual object prepare(ScriptContext context, object statement, [Optional] object driver_options) { string query = PHP.Core.Convert.ObjectToString(statement); Dictionary <int, object> options = new Dictionary <int, object>(); if (driver_options is PhpArray) { PhpArray arr = (PhpArray)driver_options; foreach (var key in arr.Keys) { Debug.Assert(!key.IsInteger); int keyInt = key.Integer; options.Add(keyInt, arr[key]); } } PDOStatement stmt = this.m_driver.CreateStatement(context, this); stmt.Prepare(context, query, options); return(stmt); }
public virtual object query(ScriptContext context, object statement, [Optional] object fetch_to_mode, [Optional] object fetch_to_dest, [Optional] object fetch_to_args) { string query = PHP.Core.Convert.ObjectToString(statement); PDOStatement stmt = this.m_driver.CreateStatement(context, this); stmt.Init(query, null); if (fetch_to_mode != null && fetch_to_mode != Arg.Default) { stmt.setFetchMode(context, fetch_to_mode, (fetch_to_dest != Arg.Default) ? fetch_to_dest : null, (fetch_to_args != Arg.Default) ? fetch_to_args : null); } if (stmt.ExecuteStatement()) { return(stmt); } else { return(false); } }