public void CreateActionPhpScript(string objectName, string methodName, StringCollection code, StringCollection parameters, string returnReceiver)
        {
            if (string.CompareOrdinal(methodName, "StartWithParameterValues") == 0)
            {
                if (!phpSupported())
                {
                    return;
                }
                if (DataDestination != null && DataDestination.DatabaseDestination != null && DataDestination.DatabaseDestination.Fields.Count > 0)
                {
                    if (this.PhpTimeoutInMinutes > 0)
                    {
                        addCode(code, "if($this->{0}->PhpTimeoutInMinutes>0) ini_set('max_execution_time', $this->{0}->PhpTimeoutInMinutes * 60);\r\n", this.Site.Name);
                    }
                    string tblVar = string.Format(CultureInfo.InvariantCulture, "tbl{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                    if (DataSource.SourceType == EnumDataSource.Database)
                    {
                        EasyQuery qry = DataSource.DatabaseSource.QueryDef;
                        if (qry != null)
                        {
                            //===fetch data==================================================================
                            string mySql = string.Format(CultureInfo.InvariantCulture, "mysql{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                            addCode(code, "\t${0} = new JsonSourceMySql();\r\n", mySql);
                            //
                            addCode(code, "\t${0}->SetCredential($this->{1}->sourceCredential);\r\n", mySql, this.Site.Name);
                            addCode(code, "\t${0}->SetDebug($this->DEBUG);\r\n", mySql);
                            string sql = qry.SqlQuery;
                            //sqlParams contains parameter names orderred by the appearance in sql, may duplicate
                            string[] sqlParams = EasyQuery.GetParameterNames(sql, qry.NameDelimiterBegin, qry.NameDelimiterEnd);
                            if (this.Parameters != null)
                            {
                                for (int i = 0; i < this.Parameters.Count; i++)
                                {
                                    sql = sql.Replace(this.Parameters[i].Name, "?");
                                }
                            }
                            string sqlVar = string.Format(CultureInfo.InvariantCulture, "sql{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                            addCode(code, "\t${0} = \"{1} \";\r\n", sqlVar, sql);
                            addCode(code, "\t${0} = new JsonDataTable();\r\n", tblVar);
                            addCode(code, "\t${0}->TableName = '{1}';\r\n", tblVar, qry.TableName);
                            string psVar = string.Format(CultureInfo.InvariantCulture, "ps{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                            addCode(code, "\t${0} = array();\r\n", psVar);
                            if (qry.Parameters != null)
                            {
                                DbParameterList dbps = new DbParameterList(qry.Parameters);
                                for (int i = 0; i < sqlParams.Length; i++)
                                {
                                    int k = dbps.GetIndex(sqlParams[i]);
                                    if (k < 0)
                                    {
                                        throw new ExceptionLimnorDatabase("Query Parameter [{0}] not found", sqlParams[i]);
                                    }
                                    DbCommandParam dp   = dbps[k];
                                    string         pVar = string.Format(CultureInfo.InvariantCulture, "p{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                                    addCode(code, "\t${0} = new SqlClientParameter();\r\n", pVar);
                                    addCode(code, "\t${0}->name = '{1}';\r\n", pVar, dp.Name);
                                    addCode(code, "\t${0}->type = '{1}';\r\n", pVar, ValueConvertor.OleDbTypeToPhpMySqlType(dp.Type));
                                    addCode(code, "\t${0}->value = {1};\r\n", pVar, parameters[k]);
                                    addCode(code, "\t${0}[] = ${1};\r\n//\r\n", psVar, pVar);
                                }
                            }
                            addCode(code, "\t${0}->GetData(${1},${2},${3});\r\n", mySql, tblVar, sqlVar, psVar);
                            addCode(code, "\t$this->{0}->ErrorMessage = ${1}->errorMessage;\r\n", this.Site.Name, mySql);
                            //===data fetched on tblVar=============================================================
                        }
                    }
                    else if (DataSource.SourceType == EnumDataSource.TextFile)
                    {
                        string tblName    = string.Format(CultureInfo.InvariantCulture, "srcTbl{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                        string txtFileVar = string.Format(CultureInfo.InvariantCulture, "txtFile{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                        addCode(code, "${0} = new DataSourceTextFile();\r\n", txtFileVar);
                        addCode(code, "\t${0} = new JsonDataTable();\r\n", tblVar);
                        addCode(code, "\t${0}->TableName = '{1}';\r\n", tblVar, tblName);
                        //
                        if (this.DataSource.TextSource.Delimiter == enumSourceTextDelimiter.Comma)
                        {
                            addCode(code, "\t${0}->delimiter=',';\r\n", txtFileVar);
                        }
                        else if (this.DataSource.TextSource.Delimiter == enumSourceTextDelimiter.TAB)
                        {
                            addCode(code, "\t${0}->delimiter='\\t';\r\n", txtFileVar);
                        }
                        if (this.DataSource.TextSource.HasHeader)
                        {
                            addCode(code, "\t${0}->hasHeader=true;\r\n", txtFileVar);
                        }
                        else
                        {
                            addCode(code, "\t${0}->hasHeader=false;\r\n", txtFileVar);
                        }
                        IPropertyValueLink fnl = this.DataSource.TextSource.GetPropertyLink("Filename");
                        if (fnl != null && fnl.IsValueLinkSet())
                        {
                            addCode(code, "\t${0}->filepath={1};\r\n", txtFileVar, fnl.GetPhpScriptReferenceCode(code));
                        }
                        else
                        {
                            addCode(code, "\t${0}->filepath='{1}';\r\n", txtFileVar, this.DataSource.TextSource.Filename);
                        }
                        //
                        addCode(code, "\t${0}->GetData(${1});\r\n", txtFileVar, tblVar);
                        addCode(code, "\t$this->{0}->ErrorMessage = ${1}->errorMessage;\r\n", this.Site.Name, txtFileVar);
                        addCode(code, "\tif(strlen(${0}->errorMessage) > 0)\r\n", txtFileVar);
                        code.Add("\t{\r\n");
                        code.Add("\t\tif($this->DEBUG)\r\n\t\t{\r\n");
                        addCode(code, "\t\t\techo 'Error reading text file: '.${0}->filepath.' Error message:'.${0}->errorMessage;\r\n", txtFileVar);
                        code.Add("\t\t\treturn;\r\n");
                        code.Add("\t\t}\r\n");
                        code.Add("\t}\r\n");
                    }
                    //
                    string mySqlTVar = string.Format(CultureInfo.InvariantCulture, "mySqlT{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                    addCode(code, "\t${0} = new JsonSourceMySql();\r\n", mySqlTVar);
                    addCode(code, "\t${0}->SetCredential($this->{1}->destinationCredential);\r\n", mySqlTVar, this.Site.Name);
                    addCode(code, "\t${0}->SetDebug($this->DEBUG);\r\n", mySqlTVar);
                    //
                    StringBuilder sbSql       = new StringBuilder();
                    StringBuilder sbSqlValues = new StringBuilder();
                    sbSql.Append("Insert into ");
                    sbSql.Append(DataDestination.DatabaseDestination.DatabaseConnection.NameDelimiterBegin);
                    sbSql.Append(DataDestination.DatabaseDestination.TableName);
                    sbSql.Append(DataDestination.DatabaseDestination.DatabaseConnection.NameDelimiterEnd);
                    sbSql.Append(" (");
                    sbSql.Append(DataDestination.DatabaseDestination.DatabaseConnection.NameDelimiterBegin);
                    sbSql.Append(DataDestination.DatabaseDestination.Fields[0].Name);
                    sbSql.Append(DataDestination.DatabaseDestination.DatabaseConnection.NameDelimiterEnd);
                    sbSqlValues.Append("?");
                    for (int i = 1; i < DataDestination.DatabaseDestination.Fields.Count; i++)
                    {
                        sbSql.Append(",");
                        sbSql.Append(DataDestination.DatabaseDestination.DatabaseConnection.NameDelimiterBegin);
                        sbSql.Append(DataDestination.DatabaseDestination.Fields[i].Name);
                        sbSql.Append(DataDestination.DatabaseDestination.DatabaseConnection.NameDelimiterEnd);
                        sbSqlValues.Append(",?");
                    }
                    sbSql.Append(") values (");
                    sbSql.Append(sbSqlValues.ToString());
                    sbSql.Append(")");
                    //
                    string myIVar = string.Format(CultureInfo.InvariantCulture, "mySqlI{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                    addCode(code, "\t${0} = ${1}->GetMySqli();\r\n", myIVar, mySqlTVar);
                    string statementVar = string.Format(CultureInfo.InvariantCulture, "state{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                    addCode(code, "\t${0}=${1}->prepareStatement(${2},\"{3}\");\r\n", statementVar, mySqlTVar, myIVar, sbSql.ToString());
                    //
                    string paramsVar = string.Format(CultureInfo.InvariantCulture, "params{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                    //
                    code.Add("\t//loop through rows of $tbl\r\n");
                    string idxVar = string.Format(CultureInfo.InvariantCulture, "idx{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                    string rowVar = string.Format(CultureInfo.InvariantCulture, "row{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                    addCode(code, "\tforeach (${0}->Rows as ${1} => ${2})\r\n", tblVar, idxVar, rowVar);
                    code.Add("\t{\r\n");
                    addCode(code, "\t\t${0}=array();\r\n", paramsVar);
                    string paramVar = string.Format(CultureInfo.InvariantCulture, "param{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));
                    for (int i = 0; i < DataDestination.DatabaseDestination.Fields.Count; i++)
                    {
                        addCode(code, "\t\t${0}=new SqlClientParameter();\r\n", paramVar);

                        addCode(code, "\t\t${0}->name = '{1}';\r\n", paramVar, DataDestination.DatabaseDestination.Fields[i].Name);
                        addCode(code, "\t\t${0}->type = '{1}';\r\n", paramVar, ValueConvertor.OleDbTypeToPhpMySqlType(DataDestination.DatabaseDestination.Fields[i].OleDbType));
                        addCode(code, "\t\t${0}->value = ${1}->ItemArray[{2}];\r\n", paramVar, rowVar, i);
                        addCode(code, "\t\t${0}[] = ${1};\r\n//\r\n", paramsVar, paramVar);
                    }
                    addCode(code, "\t\t${0}->executeStatement(${1},${2}, ${3});\r\n", mySqlTVar, myIVar, statementVar, paramsVar);
                    //
                    code.Add("\t}\r\n");
                    //
                    addCode(code, "\t${0}->free_result();\r\n", statementVar);
                    addCode(code, "\t${0}->close();\r\n", statementVar);
                    addCode(code, "\t${0}->close();\r\n", myIVar);
                }
                //
                code.Add(string.Format(CultureInfo.InvariantCulture, "\t$this->SetServerComponentName('{0}');\r\n", this.Site.Name));
            }
        }