Specific algorithm for realizing the structure of the forum tree

xiaoxiao2021-03-06  87

Forum specific algorithm tree structure http://www.chinaunix.net Author: eclipse Posted: 2001-11-20 10:18:03

Author: flyblue implement many algorithms forum tree structure, you can go to a specific full-text search www.chinaasp.com the query. The current JSP forum is also a kind of: do not use the algorithm for achieving the tree structure, now I will introduce the specific algorithms of the forum tree structure and everyone to communicate with everyone. 1. Structure: Table Name: Mybbslist field data type Description BBSID Auto number rootid int root post ID Depth INT Root post Level = 0, other depth of reply, increment BBSSUBJECT CHAR topics 2. Creating a table: Create Table Mybbslist (ForumID INT (20) Not Null, BBSID Int Auto_Increment Primary Key, Rootid Int (20) Not Null, FID INT (20) Not Null, Depth Int (20) Not Null, UserId Int (20) NOT NULL, BBSUSER VARCHAR (24) Not NULL, BBSSUBJECT VARCHAR (100) Not NULL, BBSCONTENT TEXT, BBSTIME VARCHAR (30), BBSRead Int (20), BBSReply Int (20), INDEX ForumID (forumID) 3.

MYSQL database connection BEAN package netzero; import java.sql *;. Public class mydb {String driverName = "org.gjt.mm.mysql.Driver"; Connection conn = null; Statement stmt = null; ResultSet rs = null; String connURL = "? jdbc: mysql: // localhost / mybbs user = root & password = how & useUnicode = true & characterEncode = 8859_1"; // String connURL = "jdbc:? mysql: // localhost / netzerobbs user = root & password = how"; public mydb ( ) {Try {class.forname (drivername);} catch (java.lang.classnotnetfoundexception e) {system.err.println ("Netzero (String): E.getMessage ());}}}} sql) throws SQLException {conn = DriverManager.getConnection (connURL); stmt = conn.createStatement (); rs = stmt.executeQuery (sql); return rs;}! public boolean closeConn () {try {if (rs = null) rs.close (); if (stmt! = null) stmt.close (); if (conn! = null) conn.close (); Return True;} catch (Sqlexception Ex {System.err.Println ("CloseConn: " EX.GetMessage ()); Return False;}}} 4.

转载请注明原文地址:https://www.9cbs.com/read-106152.html

New Post(0)