[sword-devel] modules to relational database

Troy A. Griffitts scribe at crosswire.org
Mon Nov 6 15:42:49 MST 2006


I'll leave the question alone as to the value of a relational database 
for this data over using the SWORD API.

You can do this a few ways depending on your familiarity of tools.

If you can process raw text files, you can use of one the SWORD provided 
export utilities to produce plain text data from a SWORD module: 
mod2osis, mod2imp.

If you are familiar with programming you can use your favorite 
programming language and the SWORD bindings for such with a simple loop 
like:

#include <swmgr.h>
#include <swmodule.h>
using namespace sword;

SWMgr library;
SWModule &book = *(library.getModuleByName("KJV"));
const char *sql = "insert into bookdata (bookid, entrykey, entrydata) 
values (?, ?, ?)";
// "prepare" your sql statement
for (book = TOP; !book.Error(); book++) {
	// sqlStatement.bind(1, "KJV");
	// sqlStatement.bind(2, module.KeyText());
	// sqlStatement.bind(3, module.getRawEntry());
	// sqlStatement.execute();
}
//sqlStatement.commit();


Hope this helps.  Please consider using / contributing to the usefulness 
of the API itself to meet your purposes.  I'm sure your additions would 
add to the usefulness of the project for many others after you.

	-Troy.




lumin8 wrote:
> I am interested transferring a couple of the Sword bible and lexicon
> modules into a relational database (mysql most likely) for my own
> indexing purposes.
> 
> Is there already a tool available that can move the data over?  If
> not, what would be the best way of accomplishing this?
> 
> Thanks so much,
> nathan
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page




More information about the sword-devel mailing list