public void CreateOnRequestStartPhp(StringCollection code)
 {
     code.Add(string.Format(CultureInfo.InvariantCulture,
                            "$this->{0}->DEBUG=$this->DEBUG;\r\n", this.Site.Name));
     code.Add(string.Format(CultureInfo.InvariantCulture,
                            "$this->{0}->TransferType={1};\r\n", this.Site.Name, (int)(this.EndPointType)));
     code.Add(string.Format(CultureInfo.InvariantCulture,
                            "$this->{0}->PhpTimeoutInMinutes={1};\r\n", this.Site.Name, this.PhpTimeoutInMinutes));
     if (DataDestination.DatabaseDestination.ConnectionID == Guid.Empty)
     {
         code.Add(string.Format(CultureInfo.InvariantCulture,
                                "$this->{0}->destinationCredential='';\r\n", this.Site.Name));
     }
     else
     {
         code.Add(string.Format(CultureInfo.InvariantCulture,
                                "$this->{0}->destinationCredential=$this->{1};\r\n", this.Site.Name,
                                ServerCodeutility.GetPhpMySqlConnectionName(DataDestination.DatabaseDestination.ConnectionID)));
     }
     if (DataSource.DatabaseSource.DatabaseConnection.ConnectionGuid == Guid.Empty)
     {
         code.Add(string.Format(CultureInfo.InvariantCulture,
                                "$this->{0}->sourceCredential='';\r\n", this.Site.Name));
     }
     else
     {
         code.Add(string.Format(CultureInfo.InvariantCulture,
                                "$this->{0}->sourceCredential=$this->{1};\r\n", this.Site.Name, ServerCodeutility.GetPhpMySqlConnectionName(DataSource.DatabaseSource.ConnectionID)));
     }
 }
Ejemplo n.º 2
0
 public void OnGeneratePhpCode(StringCollection pageCode, StringCollection methods, StringCollection requestExecutes)
 {
     if (IsValid && UseDataFromDatabase)
     {
         StringBuilder sb = new StringBuilder();
         sb.Append("function ");
         sb.Append(TableName);
         sb.Append("()\r\n");
         sb.Append("{\r\n");
         sb.Append("  $sql = '");
         sb.Append(SqlString.Replace("'", "\\'"));
         sb.Append("';\r\n");
         sb.Append("  $tbl = $this->AddDataTable('");
         sb.Append(TableName);
         sb.Append("');\r\n");
         sb.Append("  $ps = array();\r\n");
         sb.Append("  $msql = new JsonSourceMySql();\r\n");
         sb.Append("  $msql->SetCredential($this->");
         sb.Append(ServerCodeutility.GetPhpMySqlConnectionName(this.ConnectionID));
         sb.Append(");\r\n");
         sb.Append("  $msql->SetDebug($this->DEBUG);\r\n");
         sb.Append("  $msql->GetData($tbl,$sql,$ps);\r\n");
         //
         sb.Append("}\r\n");
         //
         methods.Add(sb.ToString());
         //
         sb = new StringBuilder();
         sb.Append("if($method == '");
         sb.Append(TableName);
         sb.Append("') $this->");
         sb.Append(TableName);
         sb.Append("();\r\n");
         requestExecutes.Add(sb.ToString());
     }
 }
 public string GetConnectionCodeName()
 {
     return(ServerCodeutility.GetPhpMySqlConnectionName(this.ConnectionID));
 }