Re: New Patch file for MS SQL autonumbers - Mailing list pgadmin-hackers

From John McCawley
Subject Re: New Patch file for MS SQL autonumbers
Date
Msg-id 3D0E6D4F.6080409@worleyco.com
Whole thread Raw
In response to Re: New Patch file for MS SQL autonumbers  ("Dave Page" <dpage@vale-housing.co.uk>)
List pgadmin-hackers
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)

pgadmin-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: Re: New Patch file for MS SQL autonumbers
Next
From: "Dave Page"
Date:
Subject: Re: New Patch file for MS SQL autonumbers