예제 #1
0
 function generate()
 {
     $thisTable = $this->tableObject;
     if ($thisTable->getDatabase() == "") {
         $dbName = "database";
     } else {
         $dbName = $thisTable->getDatabase();
     }
     $thisDatabaseQuery = new databaseQuery();
     $sql = "SELECT * FROM " . $thisTable->getTableName();
     $fieldNames = $thisTable->getFieldNameArray();
     $result = $thisDatabaseQuery->executeDirectQuery($sql);
     $code = "";
     $code .= "<?xml version=\"1.0\" ?>\n";
     $code .= "<" . $dbName . ">\n";
     while (!$result->EOF) {
         $code .= "\t<" . $thisTable->getTableName() . ">\n";
         $fields = $result->fields;
         for ($a = 0; $a < count($fieldNames); $a++) {
             $thisFieldName = $fieldNames[$a];
             $code .= "\t\t<" . $thisFieldName . ">";
             $code .= $fields[$thisFieldName];
             $code .= "</" . $thisFieldName . ">\n";
         }
         $code .= "\t</" . $thisTable->getTableName() . ">\n";
         $result->MoveNext();
     }
     // end while
     $code .= "</" . $dbName . ">\n";
     highlight_string($code);
     exit;
     $code = "";
     // Returning Generated Code
     return $code;
 }
 function generate()
 {
     $thisTable = $this->getTableObject();
     $fieldNames = $thisTable->getFieldNameArray();
     $query = "select  *  from " . $thisTable->getTableName();
     $thisDatabaseQuery = new databaseQuery();
     $adodbResults = $thisDatabaseQuery->executeDirectQuery($query);
     echo "<pre>";
     //print_r($adodbResults);
     echo "</pre>";
     $sql = "";
     $allSql = "";
     $sqlFields = "";
     $sqlValues = "";
     for ($a = 0; $a < count($fieldNames); $a++) {
         $sqlFields .= $fieldNames[$a] . ",";
     }
     $sqlFields = $this->removeTrailingComma($sqlFields);
     while (!$adodbResults->EOF) {
         $sql = "";
         $sqlValues = "";
         $sql .= "INSERT INTO " . $thisTable->getTableName() . " (";
         $sql .= $sqlFields;
         $sql .= ") VALUES (";
         for ($a = 0; $a < count($fieldNames); $a++) {
             $sqlValues .= "'" . $adodbResults->fields[$fieldNames[$a]] . "',";
         }
         $sqlValues = $this->removeTrailingComma($sqlValues);
         $sql .= $sqlValues;
         $sql .= ");\n";
         $allSql .= $sql;
         $adodbResults->MoveNext();
     }
     return $allSql;
 }
예제 #3
0
 function generate()
 {
     $code = "";
     $query = "select * from  user_col_comments where table_name='" . $this->table . "'";
     $thisDatabaseQuery = new databaseQuery();
     $adodbResults = $thisDatabaseQuery->executeDirectQuery($query);
     $rows = $adodbResults->_array;
     $code .= "<table cellpadding=8 cellspacing=0 border=1>\n";
     for ($a = 0; $a < count($rows); $a++) {
         $thisRow = $rows[$a];
         $tableName = $thisRow['TABLE_NAME'];
         $columnName = $thisRow['COLUMN_NAME'];
         $comments = $thisRow['COMMENTS'];
         if ($comments == "") {
             $comments = "<i>none</i>";
         }
         $code .= "<tr>\n";
         $code .= "<td align=right bgcolor=\"#CCCCCC\">" . $columnName . "</td>\n";
         $code .= "<td width=300>" . $comments . " &nbsp; </td>\n";
         $code .= "</tr>\n";
     }
     $code .= "</table>\n";
     // Returning Generated Code
     return $code;
 }
 function generateSave()
 {
     $code = "";
     $query = "select * from  user_col_comments where table_name='" . $this->table . "'";
     $thisDatabaseQuery = new databaseQuery();
     $adodbResults = $thisDatabaseQuery->executeDirectQuery($query);
     $rows = $adodbResults->_array;
     $code .= "<?\n";
     $code .= "\$thisTableName = \$_REQUEST['tableName'];\n";
     $code .= "\$thisDatabaseQuery = new databaseQuery();\n";
     for ($a = 0; $a < count($rows); $a++) {
         $thisRow = $rows[$a];
         $columnName = $thisRow['COLUMN_NAME'];
         $code .= "\n\$thisComments = \$_REQUEST['" . $columnName . "'];\n";
         $code .= "\$sql = \"COMMENT ON COLUMN " . $this->table . "." . $columnName . " IS '\".\$thisComments.\"'\";\n";
         $code .= "echo \$sql.\"<br><br>\";\n";
         $code .= "\$commentsQueryResults = \$thisDatabaseQuery->executeDirectQuery(\$sql);\n\n";
     }
     $code .= "?>\n";
     // Returning Generated Code
     return $code;
 }