Skip to content

Commit

Permalink
fbdoc: CWikiConSql extends CWikiCon
Browse files Browse the repository at this point in the history
  • Loading branch information
jayrm committed May 21, 2019
1 parent 6c2b1f1 commit 1f8bb73
Show file tree
Hide file tree
Showing 4 changed files with 526 additions and 3 deletions.
28 changes: 25 additions & 3 deletions doc/fbchkdoc/getindex.bas
Expand Up @@ -22,6 +22,7 @@
'' fbdoc headers
#include once "CWikiConUrl.bi"
#include once "CWikiConDir.bi"
#include once "CWikiConSql.bi"

'' fbchkdoc headers
#include once "fbchkdoc.bi"
Expand All @@ -43,7 +44,8 @@ const def_index_file = hardcoded.default_index_file
'' --------------------------------------------------------

'' private options
dim as boolean blocal = false '' -local given on command line
dim as boolean bLocal = false '' -local given on command line
dim as boolean bUseSql = false '' -usesql given on command line

'' enable url and cache
cmd_opts_init( CMD_OPTS_ENABLE_URL or CMD_OPTS_ENABLE_CACHE )
Expand All @@ -55,7 +57,11 @@ while( command(i) > "" )
elseif( left( command(i), 1 ) = "-" ) then
select case lcase(command(i))
case "-local"
blocal = TRUE
bLocal = TRUE
#if defined(HAVE_MYSQL)
case "-usesql"
bUseSql = TRUE
#endif
case else
cmd_opts_unrecognized_die( i )
end select
Expand All @@ -77,6 +83,9 @@ if( app_opt.help ) then
print "options:"
print " -local use local cache only, don't query server, just"
print " read the cache dir to get the list of page names"
#if defined(HAVE_MYSQL)
print " -usesql use MySQL connection to read index"
#endif
print
print "if -local is specified, then just read the file names from the cache:"
print " -web get page names from cache_dir"
Expand All @@ -103,7 +112,7 @@ dim as CWikiCon ptr wikicon = NULL

'' connect to the wiki and get PageIndex as HTML

if( blocal ) then
if( bLocal ) then

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

print "cache: "; app_opt.cache_dir

#if defined(HAVE_MYSQL)
elseif( bUseSql ) then

'' !!! TODO !!! - load options for host, user, pass, etc
wikicon = new CWikiConSql( "", "", "", "", 0 )
if wikicon = NULL then
print "Unable to create connection " + app_opt.cache_dir
end 1
end if

print "cache: "; app_opt.cache_dir

#endif
else

if( len( app_opt.wiki_url ) = 0 ) then
Expand Down
5 changes: 5 additions & 0 deletions doc/fbchkdoc/makefile
Expand Up @@ -59,6 +59,11 @@ DEPS = ../libfbdoc/libfbdoc.a $(HEADERS)
FBCFLAGS += -exx -g -i ../libfbdoc
FBLFLAGS += -exx -g -p ../libfbdoc -l fbdoc

ifdef HAVE_MYSQL
FBCFLAGS += -d HAVE_MYSQL
FBLFLAGS += -l mysql
endif

ifeq ($(EXEEXT),.exe)
FBLFLAGS += -l ws2_32
endif
Expand Down

0 comments on commit 1f8bb73

Please sign in to comment.