You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Jalud Abdulmenan <te...@rogers.com> on 2004/09/19 05:19:37 UTC

[PATCH] minor bugs in dblook

Patch to fix the following minor bugs in dblook tool:
-  generates error when correct connection url is specified as
"jdbc:derby:test"

-  generates error when correct connection url is in single quotes as
'jdbc:derby:test'

-  usage text specifies Cloudscape
-  error message specifies cslook
-  erroneous command line arguments do not generate expected error, e.g.
          java org.apache.derby.tools.dblook -d 'jdbc:derby:test'
-oqwerty a.log
          generates ddl on the console instead of displaying usage text


Re: [PATCH] minor bugs in dblook

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Actually committed this as
http://svn.apache.org/viewcvs.cgi?root=Apache-SVN&view=rev&rev=53903

Satheesh

Jalud Abdulmenan wrote:

>Patch to fix the following minor bugs in dblook tool:
>-  generates error when correct connection url is specified as
>"jdbc:derby:test"
>
>-  generates error when correct connection url is in single quotes as
>'jdbc:derby:test'
>
>-  usage text specifies Cloudscape
>-  error message specifies cslook
>-  erroneous command line arguments do not generate expected error, e.g.
>          java org.apache.derby.tools.dblook -d 'jdbc:derby:test'
>-oqwerty a.log
>          generates ddl on the console instead of displaying usage text
>
>
>-------------------------
>
>Index: java/tools/org/apache/derby/tools/dblook.java
>===================================================================
>--- java/tools/org/apache/derby/tools/dblook.java    (revision 46313)
>+++ java/tools/org/apache/derby/tools/dblook.java    (working copy)
>@@ -231,16 +231,20 @@
>             case 'd':
>                 if (!haveVal)
>                     return -1;
>-                if (args[start].length() == 2)
>-                    sourceDBUrl = args[++start];
>-                return start;
>+                if (args[start].length() == 2) {
>+                    sourceDBUrl = stripQuotes(args[++start]);
>+                    return start;
>+                }
>+                return -1;
>
>             case 'z':
>                 if (!haveVal)
>                     return -1;
>-                if (args[start].length() == 2)
>+                if (args[start].length() == 2) {
>                     schemaParam = args[++start];
>-                return start;
>+                    return start;
>+                }
>+                return -1;
>
>             case 't':
>                 if (!haveVal)
>@@ -256,9 +260,11 @@
>             case 'o':
>                 if (!haveVal)
>                     return -1;
>-                if ((args[start].length() == 2) &&
(args[start+1].length() > 0))
>+                if ((args[start].length() == 2) &&
(args[start+1].length() > 0)){
>                     ddlFileName = args[++start];
>-                return start;
>+                    return start;
>+                }
>+                return -1;
>
>             case 'a':
>                 if (args[start].equals("-append")) {
>@@ -342,9 +348,9 @@
>         start = dbUrl.indexOf("net://");
>         if (start == -1)
>         // standard url (jdbc:derby:<dbname>).  Database
>-        // name starts right after "cloudscape:".  The "11" in
>-        // the following line is the length of "cloudscape:".
>-            start = dbUrl.indexOf("cloudscape:") + 11;
>+        // name starts right after "derby:".  The "6" in
>+        // the following line is the length of "derby:".
>+            start = dbUrl.indexOf("derby:") + 6;
>         else
>         // Network Server url.  Database name starts right
>         // after next slash (":net://hostname:port/<dbname>).
>Index: java/tools/org/apache/derby/loc/toolsmessages.properties
>===================================================================
>--- java/tools/org/apache/derby/loc/toolsmessages.properties   
(revision 46313)
>+++ java/tools/org/apache/derby/loc/toolsmessages.properties   
(working copy)
>@@ -181,7 +181,7 @@
> \ USAGE:\n\ java org.apache.derby.tools.dblook -d <sourceDBUrl>
[OPTIONS]\n\n\
> \ \twhere the source URL is the full URL, including the connection
protocol\n\
> \ \tand any connection attributes that might apply.  For example, use\n\
>-\ \t'jdbc:cloudscape:myDB', or
'jdbc:cloudscape:net://localhost:1527/myDB:user=usr;'. \n\n\
>+\ \t'jdbc:derby:myDB', or
'jdbc:derby:net://localhost:1527/myDB:user=usr;'. \n\n\
> \ \toptions include: \n\n\
> \ \t-z <schemaName> to specify a schema to which the DDL generation\n\
> \ \t should be limited.  Only database objects with that schema will
have\n\
>@@ -199,19 +199,19 @@
> \ \t will be written.\n\
> \ \t\tIf not specified, default is the console.\
> \ \n
>-CSLOOK_FileCreation=This file was created using Cloudscape's cslook
utility.
>+CSLOOK_FileCreation=This file was created using Derby's dblook utility.
> CSLOOK_OutputLocation=Output will be sent to file {0}\n
> CSLOOK_Timestamp=Timestamp: {0}
> CSLOOK_DBName=Source database is: {0}
> CSLOOK_DBUrl=Connection URL is: {0}
>-CSLOOK_TargetTables=The cslook utility will consider only specified
tables.
>+CSLOOK_TargetTables=The dblook utility will consider only specified
tables.
> CSLOOK_TargetSchema=Specified schema is: {0}
> # Directory com/ibm/db2j/tools/cslookImpl/...
> CSLOOK_Header=DDL Statements for {0}
> CSLOOK_Jar_Note=\
> **** NOTE **** In order for jar files to be loaded correctly,\n\
> -- you must either 1) ensure that the CSJARS directory (created\n\
>--- automatically by cslook) exists where it was created (i.e. at\n\
>+-- automatically by dblook) exists where it was created (i.e. at\n\
> -- the path shown in the statements below), or else 2) change the\n\
> -- path in the statements below to reflect the current location of\n\
> -- CSJARS.  If the CSJARS directory does not exist, or if it\n\
>@@ -222,6 +222,6 @@
> CSLOOK_DefaultSchema=Reverting back to default schema 'APP'
> CSLOOK_AtLeastOneDebug=\
> -- Note: At least one unexpected error/warning message was\n\
>--- encountered during DDL generation.  See cslook.log\n\
>+-- encountered during DDL generation.  See dblook.log\n\
> -- to review the message(s).\n\
> \n
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
iD8DBQFBZFWUENVNIY6DZ7ERAn21AJ44eg8pDCdPD4sW1AJP0dQwVm1VDACgh9vf
I2y3esYFOg0MdiTQFnJDieY=
=83dO
-----END PGP SIGNATURE-----


Re: [PATCH] minor bugs in dblook

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Applied patch 53895 to commit this fix along with my dblook message
localization fix.

Satheesh

Jalud Abdulmenan wrote:

>Patch to fix the following minor bugs in dblook tool:
>-  generates error when correct connection url is specified as
>"jdbc:derby:test"
>
>-  generates error when correct connection url is in single quotes as
>'jdbc:derby:test'
>
>-  usage text specifies Cloudscape
>-  error message specifies cslook
>-  erroneous command line arguments do not generate expected error, e.g.
>          java org.apache.derby.tools.dblook -d 'jdbc:derby:test'
>-oqwerty a.log
>          generates ddl on the console instead of displaying usage text
>
>
>-------------------------
>
>Index: java/tools/org/apache/derby/tools/dblook.java
>===================================================================
>--- java/tools/org/apache/derby/tools/dblook.java    (revision 46313)
>+++ java/tools/org/apache/derby/tools/dblook.java    (working copy)
>@@ -231,16 +231,20 @@
>             case 'd':
>                 if (!haveVal)
>                     return -1;
>-                if (args[start].length() == 2)
>-                    sourceDBUrl = args[++start];
>-                return start;
>+                if (args[start].length() == 2) {
>+                    sourceDBUrl = stripQuotes(args[++start]);
>+                    return start;
>+                }
>+                return -1;
>
>             case 'z':
>                 if (!haveVal)
>                     return -1;
>-                if (args[start].length() == 2)
>+                if (args[start].length() == 2) {
>                     schemaParam = args[++start];
>-                return start;
>+                    return start;
>+                }
>+                return -1;
>
>             case 't':
>                 if (!haveVal)
>@@ -256,9 +260,11 @@
>             case 'o':
>                 if (!haveVal)
>                     return -1;
>-                if ((args[start].length() == 2) &&
(args[start+1].length() > 0))
>+                if ((args[start].length() == 2) &&
(args[start+1].length() > 0)){
>                     ddlFileName = args[++start];
>-                return start;
>+                    return start;
>+                }
>+                return -1;
>
>             case 'a':
>                 if (args[start].equals("-append")) {
>@@ -342,9 +348,9 @@
>         start = dbUrl.indexOf("net://");
>         if (start == -1)
>         // standard url (jdbc:derby:<dbname>).  Database
>-        // name starts right after "cloudscape:".  The "11" in
>-        // the following line is the length of "cloudscape:".
>-            start = dbUrl.indexOf("cloudscape:") + 11;
>+        // name starts right after "derby:".  The "6" in
>+        // the following line is the length of "derby:".
>+            start = dbUrl.indexOf("derby:") + 6;
>         else
>         // Network Server url.  Database name starts right
>         // after next slash (":net://hostname:port/<dbname>).
>Index: java/tools/org/apache/derby/loc/toolsmessages.properties
>===================================================================
>--- java/tools/org/apache/derby/loc/toolsmessages.properties   
(revision 46313)
>+++ java/tools/org/apache/derby/loc/toolsmessages.properties   
(working copy)
>@@ -181,7 +181,7 @@
> \ USAGE:\n\ java org.apache.derby.tools.dblook -d <sourceDBUrl>
[OPTIONS]\n\n\
> \ \twhere the source URL is the full URL, including the connection
protocol\n\
> \ \tand any connection attributes that might apply.  For example, use\n\
>-\ \t'jdbc:cloudscape:myDB', or
'jdbc:cloudscape:net://localhost:1527/myDB:user=usr;'. \n\n\
>+\ \t'jdbc:derby:myDB', or
'jdbc:derby:net://localhost:1527/myDB:user=usr;'. \n\n\
> \ \toptions include: \n\n\
> \ \t-z <schemaName> to specify a schema to which the DDL generation\n\
> \ \t should be limited.  Only database objects with that schema will
have\n\
>@@ -199,19 +199,19 @@
> \ \t will be written.\n\
> \ \t\tIf not specified, default is the console.\
> \ \n
>-CSLOOK_FileCreation=This file was created using Cloudscape's cslook
utility.
>+CSLOOK_FileCreation=This file was created using Derby's dblook utility.
> CSLOOK_OutputLocation=Output will be sent to file {0}\n
> CSLOOK_Timestamp=Timestamp: {0}
> CSLOOK_DBName=Source database is: {0}
> CSLOOK_DBUrl=Connection URL is: {0}
>-CSLOOK_TargetTables=The cslook utility will consider only specified
tables.
>+CSLOOK_TargetTables=The dblook utility will consider only specified
tables.
> CSLOOK_TargetSchema=Specified schema is: {0}
> # Directory com/ibm/db2j/tools/cslookImpl/...
> CSLOOK_Header=DDL Statements for {0}
> CSLOOK_Jar_Note=\
> **** NOTE **** In order for jar files to be loaded correctly,\n\
> -- you must either 1) ensure that the CSJARS directory (created\n\
>--- automatically by cslook) exists where it was created (i.e. at\n\
>+-- automatically by dblook) exists where it was created (i.e. at\n\
> -- the path shown in the statements below), or else 2) change the\n\
> -- path in the statements below to reflect the current location of\n\
> -- CSJARS.  If the CSJARS directory does not exist, or if it\n\
>@@ -222,6 +222,6 @@
> CSLOOK_DefaultSchema=Reverting back to default schema 'APP'
> CSLOOK_AtLeastOneDebug=\
> -- Note: At least one unexpected error/warning message was\n\
>--- encountered during DDL generation.  See cslook.log\n\
>+-- encountered during DDL generation.  See dblook.log\n\
> -- to review the message(s).\n\
> \n
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
iD8DBQFBZEafENVNIY6DZ7ERAsNiAJ4w4IPRTjNfemaRcdHV+oXfvSPqFQCghxSS
jjjpYnP7ZpmrsSCW4aykrrc=
=YhNW
-----END PGP SIGNATURE-----