SoFunction
Updated on 2025-04-12

BBS design based on mysql (IV)

5. Layout module design
The so-called classification is more considered for the telnet server. In cq66 mode, users can press
Classify according to your own wishes, and in the end, they are directly accessed based on the version as the basic unit.
For access to page articles, the entire article is used as the parameter when storing them, and the blocks of the articles are from this layer.
Complete. If the upper layer transmits in blocks, all the above layer will be transmitted. After combining, then transfer to this layer.
Decomposition; when reading, this layer is accessed in blocks, if the upper layer wants to access in full text
, then do merge work on the upper layer, and this layer does not care.
As for whether to independently index, it does not affect the upper layer's operations, it mainly has the following database structures.
Mainly consider feasibility, efficiency requirements, etc.
Where to check permissions? It's better to put it in the upper layer, it's actually just the telnet server side.
The client of cq66 will not display a menu of special instructions to ordinary users at all. Of course, users can
The server still needs to check if the command to directly send cq66. But it shouldn't be done under it.
Can check the module layer again
。   Class BoardManage {
  private:

  public:
// Operations related to classification
    int GetClassNameInfo( int maxclass, char **classid,
              char ** classname );
Returns the classification information, Chinese and English names.
    int GetBoardName( int maxboards, char *classid,
              char **boardname );
Return to the layout information in a certain category, general classification, directly select ..
      from sboard
where boardclass == .... For special categories, check the corresponding table. . . .

// Modification requires the privileges above the layout administrator
    int NewClass( char * newclassname, int type );
New classification, ordinary classification or special classification,
    int DeleteClass( char *newclassname );
Delete the classification, but does not cascade, that is, this layer is not responsible for consistency, and the upper layer is responsible for the
Change the classification information of the corresponding layout to something else. Classification name change is also deleted first and then created.
    int AddClassBoard( const char *classname, char *newboardname );
Add the built version to a certain category, specifically for special categories, general categories,
The effect is the same as modifiedboardinfo.
    int DeleteClassBoard( const char *classname, char *boardname );
Deleting a certain version from the classification is also aimed at special categories, and the effect is also on general categories.
Like modifyboardinfo, the classification attribute of a version can be empty, that is, it does not belong to
In any category.

// Operation of information about the version.
    int NewBoard( const char *boardid,char *boardname);
Create a new version and create the corresponding table. Other parameters take the default value.
    int DeleteBoard( const char *boardid );
Delete a version and delete the corresponding table.
    int GetBoardInfo( const char *boardid, char *boardname,
            int& numposts, char *masters, char *class,
            long &level );
Information about the page taken.
    int ModifyBoardId( const char *oldid, char *newid );
The English id of the changed version must also be changed.
    int ModifyBoardInfo( const char *boardid, char *boardname,
            int numposts, char *masters, char *class,
            long level );
To modify the layout information, privileges are required.

// Operation of related articles.
    int AddText( char *boardid, char *title, char *writer,
            char *text );
Add articles to the page and divide the long articles into 2k blocks.
    int DeleteText( char *boardid, int num );
Deleting the article is just a mark, and not modifying the corresponding table immediately.
    int FlushTable( char *boardid );
Refresh the page and delete the corresponding records of the deleted article.
    int MarkText( char *boardid, int num, char mark );
Tag the article.
    int ModifyTitle( char *boardid, int num, char *newtitle );
Modify the title of the article.
    int ModifyText( char *boardid, int num, char *newtext );
Modifying the content of the article does not require privileges for your own article.
    int GetTextInfo( const char *boardid, int num, char *title,
            char *writer, char& mark );
Obtain the title information of the article.
    int GetText( const char *boardid, int num, int block,
            char *text );
Read the content of the article in blocks.

// Inquiry of articles and authors
// Return all the results of the query at once?
    int QueryWriter( const char *boardid, char *writer,
            char **result );
Inquiry, an article by a certain author on the page.
    int QueryTitle( const char *boardid, char *title,
            char **result );
On the query page, the title contains the specified content.
  }
Parameter transfer is a rather annoying thing. From an abstract perspective, I hope the returned data will be
The underlying layer is irrelevant, so it should be processed, but from the perspective of efficiency, you do not want the data to be performed multiple times.
Copy, on the other hand, is the application release of space completed in the upper layer or in this layer
Woolen cloth? If you are not careful, you can easily have memory errors.