Thread: Re: New Patch file for MS SQL autonumbers

Re: New Patch file for MS SQL autonumbers

From
"Dave Page"
Date:
Thanks John, change commited, along with the Access fix you suggested.

Regards, Dave.

> -----Original Message-----
> From: John McCawley [mailto:jmccawley@worleyco.com]
> Sent: 17 June 2002 16:58
> To: Dave Page
> Cc: pgadmin-hackers
> Subject: [pgadmin-hackers] New Patch file for MS SQL autonumbers
>
>
> Previously, my code used the contents of cnLocal.ConnectionString to
> determine whether we were migrating from a MS SQL database.
> This is how
> the access code was doing it, so I was mimicing that
> behavior.  However,
> for whatever reason the case of the MSSQL string changed between CVS
> versions (That code hasn't changed, I have no idea what happened).  I
> started to change the comparison to case insensitive, but instead
> changed the line to use the value of the option box to
> determine whether
> we're migrating from a MSSQL server.  I believe that the Access code
> should also be modified in a similar manner.  If the Access connect
> string is changed, more than likely whoever makes the change will not
> remember to also change the "if" that depends on that connect string.
>
> John
>
>
>

Re: New Patch file for MS SQL autonumbers

From
John McCawley
Date:
A bug was introduced into pgMigration when I added the sequence drop
code.  If you were importing a table that had an autonumber, but there
was no conflicting sequence on import, the CREATE SEQUENCE line would
end up with an invalid query.  (The variable would have junk in it from
an earlier query)

The patch is attached, it is simply setting the query to an empty string
before it is used.

John

Index: plugins/migration/frmWizard.frm
===================================================================
RCS file: /disk1/cvsroot/pgadmin2/plugins/migration/frmWizard.frm,v
retrieving revision 1.14
diff -u -r1.14 frmWizard.frm
--- plugins/migration/frmWizard.frm    2002/06/17 20:43:11    1.14
+++ plugins/migration/frmWizard.frm    2002/06/17 21:16:55
@@ -1,5 +1,5 @@
 VERSION 5.00
-Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
+Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
 Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "tabctl32.ocx"
 Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
 Begin VB.Form frmWizard
@@ -113,45 +113,45 @@
       TabCaption(1)   =   " "
       TabPicture(1)   =   "frmWizard.frx":187D
       Tab(1).ControlEnabled=   0   'False
-      Tab(1).Control(0)=   "Label2(0)"
-      Tab(1).Control(1)=   "lstDatabase"
+      Tab(1).Control(0)=   "lstDatabase"
+      Tab(1).Control(1)=   "Label2(0)"
       Tab(1).ControlCount=   2
       TabCaption(2)   =   " "
       TabPicture(2)   =   "frmWizard.frx":1899
       Tab(2).ControlEnabled=   0   'False
-      Tab(2).Control(0)=   "Label2(1)"
-      Tab(2).Control(1)=   "lstNamespace"
+      Tab(2).Control(0)=   "lstNamespace"
+      Tab(2).Control(1)=   "Label2(1)"
       Tab(2).ControlCount=   2
       TabCaption(3)   =   " "
       TabPicture(3)   =   "frmWizard.frx":18B5
       Tab(3).ControlEnabled=   0   'False
-      Tab(3).Control(0)=   "Label1(1)"
-      Tab(3).Control(1)=   "cmdDeselect(0)"
-      Tab(3).Control(2)=   "cmdSelect(0)"
-      Tab(3).Control(3)=   "lstTables"
+      Tab(3).Control(0)=   "lstTables"
+      Tab(3).Control(1)=   "cmdSelect(0)"
+      Tab(3).Control(2)=   "cmdDeselect(0)"
+      Tab(3).Control(3)=   "Label1(1)"
       Tab(3).ControlCount=   4
       TabCaption(4)   =   " "
       TabPicture(4)   =   "frmWizard.frx":18D1
       Tab(4).ControlEnabled=   0   'False
-      Tab(4).Control(0)=   "Label1(9)"
-      Tab(4).Control(1)=   "cmdDeselect(1)"
-      Tab(4).Control(2)=   "cmdSelect(1)"
-      Tab(4).Control(3)=   "lstData"
+      Tab(4).Control(0)=   "lstData"
+      Tab(4).Control(1)=   "cmdSelect(1)"
+      Tab(4).Control(2)=   "cmdDeselect(1)"
+      Tab(4).Control(3)=   "Label1(9)"
       Tab(4).ControlCount=   4
       TabCaption(5)   =   " "
       TabPicture(5)   =   "frmWizard.frx":18ED
       Tab(5).ControlEnabled=   0   'False
-      Tab(5).Control(0)=   "Label1(8)"
-      Tab(5).Control(1)=   "Label1(10)"
+      Tab(5).Control(0)=   "lstForeignKeys"
+      Tab(5).Control(1)=   "cmdSelect(2)"
       Tab(5).Control(2)=   "cmdDeselect(2)"
-      Tab(5).Control(3)=   "cmdSelect(2)"
-      Tab(5).Control(4)=   "lstForeignKeys"
+      Tab(5).Control(3)=   "Label1(10)"
+      Tab(5).Control(4)=   "Label1(8)"
       Tab(5).ControlCount=   5
       TabCaption(6)   =   " "
       TabPicture(6)   =   "frmWizard.frx":1909
       Tab(6).ControlEnabled=   0   'False
-      Tab(6).Control(0)=   "pbStatus"
-      Tab(6).Control(1)=   "txtStatus"
+      Tab(6).Control(0)=   "txtStatus"
+      Tab(6).Control(1)=   "pbStatus"
       Tab(6).ControlCount=   2
       Begin VB.Frame Frame1
          Caption         =   "Shift to lower case"
@@ -1400,6 +1400,9 @@
         If auto_increment_rs.State <> adStateClosed Then auto_increment_rs.Close
         Set auto_increment_rs = Nothing

+        'Reset querystring to empty for reuse
+        auto_increment_query = ""
+
         'Johnm - assuming that if we are to drop conflicting tables, we should also drop conflicting sequences
         If chkDropExistingTables = 1 Then
             auto_increment_sequencename = Left(auto_increment_table & "_" & auto_increment_field_name & "_key", 31)

Re: New Patch file for MS SQL autonumbers

From
"Dave Page"
Date:
Thanks, committed.

Regards, Dave.

> -----Original Message-----
> From: John McCawley [mailto:jmccawley@worleyco.com]
> Sent: 18 June 2002 00:14
> To: Dave Page
> Cc: pgadmin-hackers
> Subject: Re: [pgadmin-hackers] New Patch file for MS SQL autonumbers
>
>
> A bug was introduced into pgMigration when I added the sequence drop
> code.  If you were importing a table that had an autonumber,
> but there
> was no conflicting sequence on import, the CREATE SEQUENCE line would
> end up with an invalid query.  (The variable would have junk
> in it from
> an earlier query)
>
> The patch is attached, it is simply setting the query to an
> empty string
> before it is used.
>
> John
>
>