1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-02 19:16:23 -07:00

Impl. GetAllSectionsOrCreateDefault & GetBoardUris

This commit is contained in:
comraderat 2020-05-04 14:21:53 +02:00
parent ebde565479
commit 1020e3ed24

View file

@ -285,20 +285,21 @@ func CreateBoard(values *Board) error {
//GetBoardUris gets a list of all existing board URIs //GetBoardUris gets a list of all existing board URIs
func GetBoardUris() (URIS []string, err error) { func GetBoardUris() (URIS []string, err error) {
/* const sql = `SELECT uri FROM DBPREFIXboards`
rows, err = querySQL("SELECT dir FROM DBPREFIXboards") rows, err := QuerySQL(sql)
defer closeHandle(rows) if err != nil {
if err != nil { return nil, err
return html + gclog.Print(lErrorLog, "Error getting board list: ", err.Error()) }
} var uris []string
for rows.Next() {
for rows.Next() { var uri string
var boardDir string err = rows.Scan(&uri)
rows.Scan(&boardDir) if err != nil {
html += "<option>" + boardDir + "</option>" return nil, err
} }
*/ uris = append(uris, uri)
return nil, errors.New("Not implemented") }
return uris, nil
} }
//GetAllSections gets a list of all existing sections //GetAllSections gets a list of all existing sections
@ -311,18 +312,12 @@ func GetAllSections() (sections []BoardSection, err error) {
// GetAllSectionsOrCreateDefault gets all sections in the database, creates default if none exist // GetAllSectionsOrCreateDefault gets all sections in the database, creates default if none exist
// Deprecated: This method was created to support old functionality during the database refactor of april 2020 // Deprecated: This method was created to support old functionality during the database refactor of april 2020
// The code should be changed to reflect the new database design // The code should be changed to reflect the new database design
func GetAllSectionsOrCreateDefault() (sections []BoardSection, err error) { func GetAllSectionsOrCreateDefault() ([]BoardSection, error) {
// allSections, _ = getSectionArr("") err := CreateDefaultSectionIfNotExist()
// if len(allSections) == 0 { if err != nil {
// if _, err = execSQL( return nil, err
// "INSERT INTO DBPREFIXsections (hidden,name,abbreviation) VALUES(0,'Main','main')", }
// ); err != nil { return GetAllSections()
// gclog.Print(lErrorLog, "Error creating new board section: ", err.Error())
// }
// }
// allSections, _ = getSectionArr("")
// return allSections
return nil, errors.New("Not implemented")
} }
//CreateDefaultSectionIfNotExist creates the default section if it does not exist yet //CreateDefaultSectionIfNotExist creates the default section if it does not exist yet