import java.text.MessageFormat;
-import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin;
-import net.sourceforge.phpdt.sql.sql.TableRow;
-import net.sourceforge.phpdt.sql.view.PHPSourceConsole;
-import net.sourceforge.phpdt.sql.view.tableview.TableAdapter;
-
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin;
+import net.sourceforge.phpdt.sql.sql.TableRow;
+import net.sourceforge.phpdt.sql.view.PHPSourceConsole;
+import net.sourceforge.phpdt.sql.view.tableview.TableAdapter;
+
public class PHPSelectRowPage extends WizardPage implements SQLPage {
TableRow row;
String[] columnNames;
System.out.println("Data is null");
}
}
+
columnNames = row.getColumnNames();
String[] data = row.getTableData();
-
- if (DEBUG) {
- for (int i = 0; i < row.getColumnCount(); i++) {
- System.out.println("data = " + i + "=" + data[i]);
- System.out.println("column = " + i + "=" + columnNames[i]);
- }
+
+ for (int i = 0; i < row.getColumnCount(); i++) {
+ System.out.println("data = " + i + "=" + data[i]);
+ System.out.println("column = " + i + "=" + columnNames[i]);
}
-
+
whereValues = new Text[row.getColumnCount()];
// newValues = new Text[row.getColumnCount()];
primaryKeys = new Button[row.getColumnCount()];
} else {
whereValues[i].setText(data[i]);
}
-
+
whereValues[i].addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateQuery();
setClause.deleteCharAt(setClause.length() - 1);
setClause.deleteCharAt(setClause.length() - 1);
}
-
- String[] arguments = { setClause.toString(), row.getTable(), whereClause.toString() };
+
+ String[] arguments = { setClause.toString(), row.getTable(), whereClause.toString()};
MessageFormat form = new MessageFormat(fStore.getString("phpeclipse.sql.select.template"));
String query = form.format(arguments);
-// String query = "$results = mysql_query(\"SELECT " + setClause.toString();
-// query += " FROM " + row.getTable();
-// query += " WHERE " + whereClause.toString() + "\");";
+ // String query = "$results = mysql_query(\"SELECT " + setClause.toString();
+ // query += " FROM " + row.getTable();
+ // query += " WHERE " + whereClause.toString() + "\");";
this.query.setText(query);
}