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

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


Index: plugins/migration/frmWizard.frm
===================================================================
RCS file: /disk1/cvsroot/pgadmin2/plugins/migration/frmWizard.frm,v
retrieving revision 1.13
diff -u -r1.13 frmWizard.frm
--- plugins/migration/frmWizard.frm    2002/06/13 10:10:29    1.13
+++ plugins/migration/frmWizard.frm    2002/06/17 13:57:13
@@ -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)=   "lstDatabase"
-      Tab(1).Control(1)=   "Label2(0)"
+      Tab(1).Control(0)=   "Label2(0)"
+      Tab(1).Control(1)=   "lstDatabase"
       Tab(1).ControlCount=   2
       TabCaption(2)   =   " "
       TabPicture(2)   =   "frmWizard.frx":1899
       Tab(2).ControlEnabled=   0   'False
-      Tab(2).Control(0)=   "lstNamespace"
-      Tab(2).Control(1)=   "Label2(1)"
+      Tab(2).Control(0)=   "Label2(1)"
+      Tab(2).Control(1)=   "lstNamespace"
       Tab(2).ControlCount=   2
       TabCaption(3)   =   " "
       TabPicture(3)   =   "frmWizard.frx":18B5
       Tab(3).ControlEnabled=   0   'False
-      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).Control(0)=   "Label1(1)"
+      Tab(3).Control(1)=   "cmdDeselect(0)"
+      Tab(3).Control(2)=   "cmdSelect(0)"
+      Tab(3).Control(3)=   "lstTables"
       Tab(3).ControlCount=   4
       TabCaption(4)   =   " "
       TabPicture(4)   =   "frmWizard.frx":18D1
       Tab(4).ControlEnabled=   0   'False
-      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).Control(0)=   "Label1(9)"
+      Tab(4).Control(1)=   "cmdDeselect(1)"
+      Tab(4).Control(2)=   "cmdSelect(1)"
+      Tab(4).Control(3)=   "lstData"
       Tab(4).ControlCount=   4
       TabCaption(5)   =   " "
       TabPicture(5)   =   "frmWizard.frx":18ED
       Tab(5).ControlEnabled=   0   'False
-      Tab(5).Control(0)=   "lstForeignKeys"
-      Tab(5).Control(1)=   "cmdSelect(2)"
+      Tab(5).Control(0)=   "Label1(8)"
+      Tab(5).Control(1)=   "Label1(10)"
       Tab(5).Control(2)=   "cmdDeselect(2)"
-      Tab(5).Control(3)=   "Label1(10)"
-      Tab(5).Control(4)=   "Label1(8)"
+      Tab(5).Control(3)=   "cmdSelect(2)"
+      Tab(5).Control(4)=   "lstForeignKeys"
       Tab(5).ControlCount=   5
       TabCaption(6)   =   " "
       TabPicture(6)   =   "frmWizard.frx":1909
       Tab(6).ControlEnabled=   0   'False
-      Tab(6).Control(0)=   "txtStatus"
-      Tab(6).Control(1)=   "pbStatus"
+      Tab(6).Control(0)=   "pbStatus"
+      Tab(6).Control(1)=   "txtStatus"
       Tab(6).ControlCount=   2
       Begin VB.Frame Frame1
          Caption         =   "Shift to lower case"
@@ -1332,7 +1332,7 @@
     '****
     'Johnm - MSSQL Autonumber code NOTE: using some of the variables defined for the Access autonumber code
     'NOTE: currently only tested on MSSQL Server 7.0/NT4
-    If InStr(1, cnLocal.ConnectionString, "PROVIDER=SQLOLEDB") <> 0 Then
+    If optType(2).Value = True Then
         'The following query should pull a record that contains the autonumber column if one exists for the table
         auto_increment_query = "select (syscolumns.status & 128) as isidentity ," & _
         " sysobjects.name as tablename, syscolumns.name as columnname " & _

pgadmin-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: pgAdmin II v1.3.60
Next
From: "Dave Page"
Date:
Subject: Re: New Patch file for MS SQL autonumbers