Index: main/trunk/greenstone2/perllib/plugins/GreenstoneSQLPlugin.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugins/GreenstoneSQLPlugin.pm	(revision 32538)
+++ main/trunk/greenstone2/perllib/plugins/GreenstoneSQLPlugin.pm	(revision 32541)
@@ -39,7 +39,7 @@
 
 # TODO:
-# - Run TODOs here and in plugout by Dr Bainbridge. Ask about docsql naming convention adopted
-# to identify OID. Better way?
-# collection names -> table names: hyphens not allowed? Changed to underscores.
+# - Run TODOs here, in Plugout and in gssql.pm by Dr Bainbridge.
+# Ask about docsql naming convention adopted to identify OID. Better way?
+# collection names -> table names: it seems hyphens not allowed. Changed to underscores.
 # - Startup parameters
 # - incremental building: where do we need to add code to delete rows from our sql table after
@@ -48,5 +48,6 @@
 # - Have not yet tested writing out just meta or just fulltxt to sql db and reading just that 
 # back in from the sql db while the remainder is to be read back in from the docsql .xml files.
-
+# - Ask if I can assume that all SQL dbs (not just MySQL) will preserve the order of inserted nodes
+# (sections) which in this case had made it easy to reconstruct the doc_obj in memory in the correct order
 
 # GreenstoneSQLPlugin inherits from GreenstoneXMLPlugin so that it if meta or fulltext
@@ -55,4 +56,10 @@
 # is written out by GreenstoneSQLPlugout into the SQL db).
 
+# TODO:
+# no more docoid in docsql .xml filename, set OID as attribute of root element inside docsql.xml file instead
+# and parse it out
+
+# TODO: deal with incremental vs removeold. If docs removed from import folder, then import step
+# won't delete it from archives but buildcol step will. Need to implement this with this database plugin or wherever the actual flow is
 
 sub BEGIN {
@@ -83,10 +90,35 @@
 	'deft' => &get_default_process_exp(),
 	'reqd' => "no" },
-       { 'name' => "process_mode", 
-	 'desc' => "{GreenstoneSQLPlug.process_mode}",
-	 'type' => "enum",
-	 'list' => $process_mode_list,
-	 'deft' => "all",
-	 'reqd' => "no"}
+      { 'name' => "process_mode", 
+	'desc' => "{GreenstoneSQLPlug.process_mode}",
+	'type' => "enum",
+	'list' => $process_mode_list,
+	'deft' => "all",
+	'reqd' => "no"},
+      { 'name' => "db_driver", 
+	'desc' => "{GreenstoneSQLPlug.db_driver}",
+	'type' => "string",	
+	'deft' => "mysql",
+	'reqd' => "yes"},
+      { 'name' => "db_client_user", 
+	'desc' => "{GreenstoneSQLPlug.db_client_user}",
+	'type' => "string",	
+	'deft' => "root",
+	'reqd' => "yes"},
+      { 'name' => "db_client_pwd", 
+	'desc' => "{GreenstoneSQLPlug.db_client_pwd}",
+	'type' => "string",
+	'deft' => "",
+	'reqd' => "yes"}, # pwd required?
+      { 'name' => "db_host", 
+	'desc' => "{GreenstoneSQLPlug.db_host}",
+	'type' => "string",
+	'deft' => "127.0.0.1",
+	'reqd' => "yes"},
+      { 'name' => "db_encoding", 
+	'desc' => "{GreenstoneSQLPlug.db_encoding}",
+	'type' => "string",
+	'deft' => "utf8",
+	'reqd' => "yes"}
     ];
 
@@ -200,5 +232,5 @@
 	    #$sid =~ s@^root@@;
 	    $sid = $doc_obj->get_top_section() if ($sid eq "root");
-	    print $outhandle "### did: $did, sid: |$sid|, fulltext: <TXT NOT PRINTED>\n"
+	    print $outhandle "### did: $did, sid: |$sid|, fulltext: <TXT>\n"
 		if $self->{'verbosity'} > 1;
 
@@ -229,23 +261,18 @@
     $self->SUPER::init(@_); # super (GreenstoneXMLPlugin) will not yet be trying to read from doc.xml (docsql .xml) files in init().
 
-        # TODO: how do we know what site we're dealing with unless this is passed in, by buildcol?
-    ###########
+    ####################
 #    print "@@@ SITE NAME: ". $self->{'site_name'} . "\n" if defined $self->{'site_name'};
 #    print "@@@ COLL NAME: ". $ENV{'GSDLCOLLECTION'} . "\n";
-    
-    $self->{'db_driver'} = "mysql";
-    $self->{'site_name'} = "localsite";    
-    $self->{'db_client_user'} = "root";
-    $self->{'db_client_pwd'} = "6reenstone3";
-    $self->{'build_mode'} = "removeold";
-    $self->{'db_host'} = "127.0.0.1";
-    $self->{'db_encoding'} = "utf8";
-    ###########
+
+#    print STDERR "@@@@ db_pwd: " . $self->{'db_client_pwd'} . "\n";
+#    print STDERR "@@@@ user: " . $self->{'db_client_user'} . "\n";
+#    print STDERR "@@@@ db_host: " . $self->{'db_host'} . "\n";
+#    print STDERR "@@@@ db_enc: " . $self->{'db_encoding'} . "\n";
+#    print STDERR "@@@@ db_driver: " . $self->{'db_driver'} . "\n";
+    ####################
     
     my $gs_sql = new gssql({
 	'collection_name' => $ENV{'GSDLCOLLECTION'},	
 	'db_encoding' => $self->{'db_encoding'}
-	#'db_name' => $self->{'site_name'},
-	#'build_mode' => $self->{'build_mode'},
 			   }
 	);
@@ -265,5 +292,5 @@
     }
     
-    my $db_name = $self->{'site_name'} || "localsite"; # one database per GS3 site
+    my $db_name = $self->{'site_name'} || "greenstone2"; # one database per GS3 site, for GS2 the db is called greenstone2
     #my $build_mode = $self->{'build_mode'} || "removeold";
 
@@ -274,5 +301,5 @@
 	# PrintError would already have displayed the warning message on load fail
 	$gs_sql->disconnect_from_db()
-	    || warn("Unable to disconnect from database " . $self->{'site_name'} . "\n");
+	    || warn("Unable to disconnect from database.\n");
 	die("Could not use db $db_name. Can't proceed.\n");
     }
