1
这可能是一个非常基本的问题,但stackoverflow如何存储用户发布的代码片段?每个片段只是一个带有文本字段和userid + postid的数据库条目?stackoverflow如何存储代码片段
这可能是一个非常基本的问题,但stackoverflow如何存储用户发布的代码片段?每个片段只是一个带有文本字段和userid + postid的数据库条目?stackoverflow如何存储代码片段
我查看了不同Stack Overflow question的HTML代码。
<p>I'm making a program in java that makes queries into SQL and show the result in a jtable, my problem is if i do Insert, delete or update i want my jtable to show the sql table that was modified, is there any function for that?
This is my method to execute the query:</p>
<pre><code> public void executequery() {
try {
String userQuery = Query.getText();
Statement statement;
statement = conn.createStatement();
statement.execute(userQuery);
ResultSet rs = statement.executeQuery(userQuery);
//in case of a instert, delete or update i want to show
//the modified sql on my jtable
table.setModel(DbUtils.resultSetToTableModel(rs));
rs.close();
statement.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
</code></pre>
您在这里有几个选择。
您可以将问题ID +用户ID作为关键字保存在数据库中的HTML +文本。
您可以使用类型指示器分别保存文本和代码,并使用指示器来创建HTML。
无论哪种方式都行。
好问题,但这属于元。除非你对一般人在任何网站上如何做到这一点有一个普遍的疑问。 –
我正在研究一个类似的项目,所以我想知道网站如何做到这一点。 – CoconutFred