Skip to content

Commit 1f8bb73

Browse files
committed
fbdoc: CWikiConSql extends CWikiCon
1 parent 6c2b1f1 commit 1f8bb73

File tree

4 files changed

+526
-3
lines changed

4 files changed

+526
-3
lines changed

doc/fbchkdoc/getindex.bas

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
'' fbdoc headers
2323
#include once "CWikiConUrl.bi"
2424
#include once "CWikiConDir.bi"
25+
#include once "CWikiConSql.bi"
2526

2627
'' fbchkdoc headers
2728
#include once "fbchkdoc.bi"
@@ -43,7 +44,8 @@ const def_index_file = hardcoded.default_index_file
4344
'' --------------------------------------------------------
4445

4546
'' private options
46-
dim as boolean blocal = false '' -local given on command line
47+
dim as boolean bLocal = false '' -local given on command line
48+
dim as boolean bUseSql = false '' -usesql given on command line
4749

4850
'' enable url and cache
4951
cmd_opts_init( CMD_OPTS_ENABLE_URL or CMD_OPTS_ENABLE_CACHE )
@@ -55,7 +57,11 @@ while( command(i) > "" )
5557
elseif( left( command(i), 1 ) = "-" ) then
5658
select case lcase(command(i))
5759
case "-local"
58-
blocal = TRUE
60+
bLocal = TRUE
61+
#if defined(HAVE_MYSQL)
62+
case "-usesql"
63+
bUseSql = TRUE
64+
#endif
5965
case else
6066
cmd_opts_unrecognized_die( i )
6167
end select
@@ -77,6 +83,9 @@ if( app_opt.help ) then
7783
print "options:"
7884
print " -local use local cache only, don't query server, just"
7985
print " read the cache dir to get the list of page names"
86+
#if defined(HAVE_MYSQL)
87+
print " -usesql use MySQL connection to read index"
88+
#endif
8089
print
8190
print "if -local is specified, then just read the file names from the cache:"
8291
print " -web get page names from cache_dir"
@@ -103,7 +112,7 @@ dim as CWikiCon ptr wikicon = NULL
103112

104113
'' connect to the wiki and get PageIndex as HTML
105114

106-
if( blocal ) then
115+
if( bLocal ) then
107116

108117
wikicon = new CWikiConDir( app_opt.cache_dir )
109118
if wikicon = NULL then
@@ -113,6 +122,19 @@ if( blocal ) then
113122

114123
print "cache: "; app_opt.cache_dir
115124

125+
#if defined(HAVE_MYSQL)
126+
elseif( bUseSql ) then
127+
128+
'' !!! TODO !!! - load options for host, user, pass, etc
129+
wikicon = new CWikiConSql( "", "", "", "", 0 )
130+
if wikicon = NULL then
131+
print "Unable to create connection " + app_opt.cache_dir
132+
end 1
133+
end if
134+
135+
print "cache: "; app_opt.cache_dir
136+
137+
#endif
116138
else
117139

118140
if( len( app_opt.wiki_url ) = 0 ) then

doc/fbchkdoc/makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ DEPS = ../libfbdoc/libfbdoc.a $(HEADERS)
5959
FBCFLAGS += -exx -g -i ../libfbdoc
6060
FBLFLAGS += -exx -g -p ../libfbdoc -l fbdoc
6161

62+
ifdef HAVE_MYSQL
63+
FBCFLAGS += -d HAVE_MYSQL
64+
FBLFLAGS += -l mysql
65+
endif
66+
6267
ifeq ($(EXEEXT),.exe)
6368
FBLFLAGS += -l ws2_32
6469
endif

0 commit comments

Comments
 (0)