Oops. Forgot log and source....
Oops. Forgot log and source....
От:
apollo@enigma.net
Дата:
Log:
------------------------------------------------------------------------------
Global Options: Version='06.40.0006', fetch=100, socket=4096,
unknown_sizes=0, max_varchar_size=254, max_longvarchar_size=8190 disable_optimizer=1, ksqo=1, unique_index=1,
use_declarefetch=1 text_as_longvarchar=0, unknowns_as_longvarchar=0,
bools_as_char=0 extra_systable_prefixes='dd_;', conn_settings=''
conn=168376136, query=' '
conn=168376136, query='set DateStyle to 'ISO''
conn=168376136, query='set geqo to 'OFF''
conn=168376136, query='set ksqo to 'ON''
conn=168376136, query='BEGIN'
conn=168376136, query='declare SQL_CUR0A0A0040 cursor for select oid from
pg_type where typname='lo''
conn=168376136, query='fetch 100 in SQL_CUR0A0A0040' [ fetched 0 rows ]
conn=168376136, query='close SQL_CUR0A0A0040'
conn=168376136, query='END'
conn=168376136,
SQLDriverConnect(out)='DSN=PADUnix;DATABASE=pad;SERVER=betty;PORT=5432;UID=p
ostgres;PWD=;READONLY=0;PROTOCOL=6.4;FAKEOIDINDEX=0;SHOWOIDCOLUMN=0;ROWVERSI
ONING=1;SHOWSYSTEMTABLES=0;CONNSETTINGS='
conn=168376136, query='BEGIN'
conn=168376136, query='DELETE FROM AUDIT_LOG'
conn=168376136, query='COMMIT'
conn=168376136, query='BEGIN'
conn=168376136, query='declare SQL_CUR0A0B0BA0 cursor for SELECT * FROM
AUDIT_LOG'
conn=168376136, query='fetch 100 in SQL_CUR0A0B0BA0' [ fetched 0 rows ]
conn=168376136, query='declare SQL_CUR0A0D0D40 cursor for select u.usename,
c.relname, a.attname, a.atttypid,t.typname, a.attnum, a.attlen,
a.atttypmod, a.attnotnull from pg_user u, pg_class c, pg_attribute a,
pg_type t where int4out(u.usesysid) = int4out(c.relowner) and c.oid=
a.attrelid and a.atttypid = t.oid and (a.attnum > 0) and c.relname like
'AUDIT_LOG' order by attnum'
conn=168376136, query='fetch 100 in SQL_CUR0A0D0D40' [ fetched 0 rows ]
conn=168376136, query='close SQL_CUR0A0D0D40'
conn=168376136, query='close SQL_CUR0A0B0BA0'
conn=168376136, query='END'
conn=168376136, SQLDisconnect
Source:
-----------------------------------------------------------------------------
Dim RemoteWK As Workspace
Dim RemoteDB As Database
Dim InRS As Recordset
Dim OutRS As Recordset
Dim Tbl As TableDef
Dim Fld As Field
Dim Cnt As Long
Dim Okay As Boolean
Okay = True On Error GoTo DBErr Set RemoteWK = DBEngine.CreateWorkspace("EPAD", "", "", dbUseODBC) ODBC$ = "ODBC;DSN=PADUnix;DATABASE=pad;SERVER=betty;PORT=5432" ODBC$ = ODBC$ + ";UID=postgres;PWD=;READONLY=0;PROTOCOL=6.4" ODBC$ = ODBC$ + ";FAKEOIDINDEX=0;SHOWOIDCOLUMN=0;ROWVERSIONING=1" ODBC$ = ODBC$ + ";SHOWSYSTEMTABLES=0;CONNSETTINGS=" Set RemoteDB = RemoteWK.OpenDatabase(ODBC$) For Each Tbl In CurrentDb.TableDefs If Left$(Tbl.Name, 4) <> "dbo_" And Left$(Tbl.Name, 4) <> "MSys" Then Debug.Print "Processing " + Tbl.Name + "..." DoEvents RemoteDB.Execute "DELETE FROM " + Tbl.Name Stmt$ = "SELECT * FROM " + Tbl.Name Set InRS = CurrentDb.OpenRecordset(Stmt$, dbOpenForwardOnly, 0,
dbReadOnly) Set OutRS = RemoteDB.OpenRecordset(Stmt$, dbOpenDynaset, 0,
dbOptimistic) Cnt = 0 If Okay Then Do Until InRS.EOF OutRS.AddNew ' <----- BREAKS HERE If Okay = False Then Exit Do FldCnt% = 1 FldOkay% = False For Each Fld In Tbl.Fields If FldCnt% = 1 Then If (Fld.Attributes And dbAutoIncrField) <>
dbAutoIncrField Then FldOkay% = True Else FldOkay% = True End If If FldOkay% Then OutRS.Fields(Fld.Name) = InRS.Fields(Fld.Name) End If FldCnt% = FldCnt% + 1 If Okay = False Then Exit For Next Fld OutRS.Update If Okay = False Then Exit Do InRS.MoveNext Cnt = Cnt + 1 If Cnt Mod 10 = 0 Then Debug.Print "."; DoEvents End If If Cnt Mod 100 = 0 Then Debug.Print Debug.Print Format$(Cnt); DoEvents End If Loop OutRS.Close End If Debug.Print InRS.Close If Okay = False Then Exit For End If Next Tbl RemoteDB.Close Set RemoteWK = Nothing On Error GoTo 0 Exit Function
DBErr: Okay = False Call DaoErr Resume Next