From bd349addb5be3f3bc33bd725c2574fcb0081fe38 Mon Sep 17 00:00:00 2001
From: Cruz Fernandez <cruz@chuchuwa.com.ar>
Date: Thu, 8 Oct 2015 09:10:08 -0700
Subject: Make forgetsql-generate work with the MySQLdb module

Origin: other, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=324919#5
Bug-Debian: http://bugs.debian.org/324919

Patch-Name: fix-mysqldb-support
---
 bin/forgetsql-generate | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/bin/forgetsql-generate b/bin/forgetsql-generate
index bfe0d9a..3452a81 100755
--- a/bin/forgetsql-generate
+++ b/bin/forgetsql-generate
@@ -220,7 +220,10 @@ stdin or as a file using option --tables."""
     else:
         params = {}
         if options.database:
-            params['database'] = options.database
+            if options.dbmodule == "MySQLdb":
+                params['db'] = options.database
+            else:
+                params['database'] = options.database
         else:
             print >>sys.stderr, "Missing required option --database or --connect"     
             sys.exit(7)
@@ -229,7 +232,11 @@ stdin or as a file using option --tables."""
         if options.username:
             params['user'] = options.username    
         if options.password:
-            params['password'] = options.password    
+            if options.dbmodule == "MySQLdb":
+                params['passwd'] = options.password
+            else:
+                params['password'] = options.password
+        
         connectstring = ", ".join(["%s=%r" % (key, value)
                                   for (key,value) in params.items()
                            # filter out password for 'security reasons'
