protected virtual void bindParms(Object[] ptb) { int pos = 1; if (ptb != null) { _gxDbCommand.ClearParameters(); foreach (Object[] p in ptb) { if (p.Length > 4 && p[4].Equals("rt")) { continue; } _gxDbCommand.AddParameter((string)p[0], p[1], (int)(p[2]), (int)(p[3])); pos++; } } }
public void ReorganizeCliente( ) { String cmdBuffer = ""; /* Indices for table Cliente */ try { cmdBuffer = " CREATE TABLE [GXA0004] ([ClienteId] smallint NOT NULL IDENTITY(1,1), [ClienteNombre] char(20) NOT NULL ) " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception ex) { try { DropTableConstraints("[GXA0004]"); cmdBuffer = " DROP TABLE [GXA0004] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex1) { try { DropTableConstraints("[GXA0004]"); cmdBuffer = " DROP VIEW [GXA0004] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex2) { try { DropTableConstraints("[GXA0004]"); cmdBuffer = " DROP FUNCTION [GXA0004] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex3) { } } } cmdBuffer = " CREATE TABLE [GXA0004] ([ClienteId] smallint NOT NULL IDENTITY(1,1), [ClienteNombre] char(20) NOT NULL ) " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } cmdBuffer = " SET IDENTITY_INSERT [GXA0004] ON " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); cmdBuffer = " INSERT INTO [GXA0004] ([ClienteId], [ClienteNombre]) SELECT [ClienteId], [ClienteNombre] FROM [Cliente] T1 " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); cmdBuffer = " SET IDENTITY_INSERT [GXA0004] OFF " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); try { DropTableConstraints("[Cliente]"); cmdBuffer = " DROP TABLE [Cliente] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex1) { try { DropTableConstraints("[Cliente]"); cmdBuffer = " DROP VIEW [Cliente] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex2) { try { DropTableConstraints("[Cliente]"); cmdBuffer = " DROP FUNCTION [Cliente] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex3) { } } } RGZ = new GxCommand(dsDefault.Db, "sp_rename", dsDefault, 0, true, false, null); RGZ.CommandType = CommandType.StoredProcedure; RGZ.AddParameter("@objname", "[GXA0004]"); RGZ.AddParameter("@newname", "Cliente"); RGZ.ExecuteStmt(); cmdBuffer = " ALTER TABLE [Cliente] ADD PRIMARY KEY([ClienteId]) " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); }
public void ReorganizePropiedad( ) { String cmdBuffer = ""; /* Indices for table Propiedad */ try { cmdBuffer = " CREATE TABLE [GXA0002] ([PropiedadId] smallint NOT NULL , [PropiedadDescripcion] char(50) NOT NULL , [PropiedadFoto] VARBINARY(MAX) NOT NULL , [PropiedadFoto_GXI] varchar(2048) NOT NULL , [PropiedadDireccion] char(50) NOT NULL , [BarrioId] smallint NOT NULL ) " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception ex) { try { DropTableConstraints("[GXA0002]"); cmdBuffer = " DROP TABLE [GXA0002] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex1) { try { DropTableConstraints("[GXA0002]"); cmdBuffer = " DROP VIEW [GXA0002] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex2) { try { DropTableConstraints("[GXA0002]"); cmdBuffer = " DROP FUNCTION [GXA0002] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex3) { } } } cmdBuffer = " CREATE TABLE [GXA0002] ([PropiedadId] smallint NOT NULL , [PropiedadDescripcion] char(50) NOT NULL , [PropiedadFoto] VARBINARY(MAX) NOT NULL , [PropiedadFoto_GXI] varchar(2048) NOT NULL , [PropiedadDireccion] char(50) NOT NULL , [BarrioId] smallint NOT NULL ) " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } new propiedadconversion(context).execute( ); try { DropTableConstraints("[Propiedad]"); cmdBuffer = " DROP TABLE [Propiedad] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex1) { try { DropTableConstraints("[Propiedad]"); cmdBuffer = " DROP VIEW [Propiedad] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex2) { try { DropTableConstraints("[Propiedad]"); cmdBuffer = " DROP FUNCTION [Propiedad] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception sqlex3) { } } } RGZ = new GxCommand(dsDefault.Db, "sp_rename", dsDefault, 0, true, false, null); RGZ.CommandType = CommandType.StoredProcedure; RGZ.AddParameter("@objname", "[GXA0002]"); RGZ.AddParameter("@newname", "Propiedad"); RGZ.ExecuteStmt(); cmdBuffer = " ALTER TABLE [Propiedad] ADD PRIMARY KEY([PropiedadId]) " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); try { cmdBuffer = " CREATE NONCLUSTERED INDEX [IPROPIEDAD1] ON [Propiedad] ([BarrioId] ) " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } catch (Exception ex) { cmdBuffer = " DROP INDEX [IPROPIEDAD1] ON [Propiedad] " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); cmdBuffer = " CREATE NONCLUSTERED INDEX [IPROPIEDAD1] ON [Propiedad] ([BarrioId] ) " ; RGZ = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null); RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK; RGZ.ExecuteStmt(); RGZ.Drop(); } }