Обсуждение: pgMigrate

Поиск
Список
Период
Сортировка

pgMigrate

От
"Brett Maton"
Дата:
Hi,

  I have a problem with the Migration wizard, basically it chokes on a date
field for some reason, it reckons that the exported date is something like
06/06/101.  Not sure where it's getting this from as it's certainly not in
the DB.

I tried to alter pgMigrate to display the query string that was causing the
problem (VB is not my thing so I probably just being stupid),

Err_Handler:
  txtStatus.Text = txtStatus.Text & vbCrLf & "An error occured at: " & Now &
": " & vbCrLf & Err.Number & ": " & Replace(Err.Description, vbLf, vbCrLf) &
vbCrLf & vbCrLf & "Rolling back..."
  txtStatus.SelStart = Len(txtStatus.Text)

**Added these two lines
  txtStatus.Text = txtStatus.Text & vbCrLf & "Query was : " & szQryStr
  txtStatus.SelStart = Len(txtStatus.Text)

  svr.Databases(szDatabase).Execute "ROLLBACK"
  txtStatus.Text = txtStatus.Text & " Done."
  txtStatus.SelStart = Len(txtStatus.Text)


but I get an error message when I try to run my modified plugin:

An error has occured in pgAdmin II:frmMain.mnuPluginsPlg_Click:

Number: 13
Description: Type mismatch

I'm not sure how the date / time is being passed to Postgres, but was
thinking if it's sent over in a long string format (11 January 2002) pg will
store it correctly

Brett.

_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com


Re: pgMigrate

От
Dave Page
Дата:

> -----Original Message-----
> From: Brett Maton [mailto:matonb@hotmail.com]
> Sent: 11 January 2002 15:15
> To: pgadmin-hackers@postgresql.org
> Subject: [pgadmin-hackers] pgMigrate
>
>
> Hi,
>
>   I have a problem with the Migration wizard, basically it
> chokes on a date
> field for some reason, it reckons that the exported date is
> something like
> 06/06/101.  Not sure where it's getting this from as it's
> certainly not in
> the DB.
>
> I tried to alter pgMigrate to display the query string that
> was causing the
> problem (VB is not my thing so I probably just being stupid),
>

This should'nt be necessary (though your code looks OK. Under Tools ->
Options in pgAdmin, just set the Log Level to 'Debug' and then reconnect to
the target database. All the SQL & error messages should then end up in the
logfile (usually C:\pgAdmin_nnnn.log).

>
> but I get an error message when I try to run my modified plugin:
>
> An error has occured in pgAdmin II:frmMain.mnuPluginsPlg_Click:
>
> Number: 13
> Description: Type mismatch

That's a common one. Just make sure you have a complete matched set of dlls
- in particular pgAbsPlg.dll and pgSchema.dll. You should also make sure
your build is compatible with a stock pgMigration.dll.

> I'm not sure how the date / time is being passed to Postgres, but was
> thinking if it's sent over in a long string format (11
> January 2002) pg will
> store it correctly

Actually we normally use yyyy-MM-dd hh:mm:ss (ISO-8601?) which should work
no matter what your locale is. However, this doesn't appear to be the case
in this code - I'll look into it (probably be later today now).

Regards, Dave.

Re: pgMigrate

От
Dave Page
Дата:

> -----Original Message-----
> From: Brett Maton [mailto:matonb@hotmail.com]
> Sent: 14 January 2002 13:47
> To: dpage@vale-housing.co.uk
> Cc: pgadmin-support@postgresql.org
> Subject: RE: [pgadmin-hackers] pgMigrate
>
>
> Hi Dave,
>
>   Your absolutly right that the syntax is likely to be
> incompatible, but you
> can get the select statement from the DB some how, I down
> loaded ADO Query
> Tool from this guys site todo on the fly SQL with the Access
> DB and it
> manages to get the SQL statements from views....
>

I tried ADO Query - could be quite useful, though it only found the first
column in PostgreSQL views (that may be the ODBC driver though).
Unfortunately the source code on the site is for an old version which
doesn't have this functionality so I can't see how that app is doing it.
I've tried playing the ADOX which is what pgMigration uses, and that refuses
to give the information required with Access, SQL Server or ODBC OLE DB
providers :-(

Anyway, let me know if you come across anything...

Regards, Dave

Re: pgMigrate

От
"Brett Maton"
Дата:
Sure will,  nothings ever easy is it :)

Regards, Brett

_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com


Re: pgMigrate

От
"Brett Maton"
Дата:
Hi Dave,

  Found it !

  I've been playing around with the views stuff this afternoon and this is
what I found out:

  There is a View object in the catalog catLocal which can be accessed like
so

  Dim viewTemp As View
  For Each viewTemp In catLocal.Views
    szString = viewTemp.Command.CommandText()
    app.LogEvent "SQL : '" & szString & "'\n\n"
  Next


and ya get something like this:

'SELECT myTable.myField1, myTable.myField2, myTable.myField3, etc etc FROM
myTable
WHERE (((MyTable.Fieldn)="whatever"));


Hope this helps with the view stuff,  (starting to get the hang of VB :>)

Regards, Brett


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


Re: pgMigrate

От
Dave Page
Дата:

> -----Original Message-----
> From: Brett Maton [mailto:matonb@hotmail.com]
> Sent: 14 January 2002 17:23
> To: dpage@vale-housing.co.uk
> Cc: pgadmin-hackers@postgresql.org
> Subject: RE: [pgadmin-hackers] pgMigrate
>
>
> Hi Dave,
>
>   Found it !
>
>   I've been playing around with the views stuff this
> afternoon and this is
> what I found out:
>
>   There is a View object in the catalog catLocal which can be
> accessed like
> so
>
>   Dim viewTemp As View
>   For Each viewTemp In catLocal.Views
>     szString = viewTemp.Command.CommandText()
>     app.LogEvent "SQL : '" & szString & "'\n\n"
>   Next
>

Yeah, this is what I was trying only I was browsing cat.Views in the watch
window. I kept getting a 'provider doesn't support this' type error. Your
code works OK though - odd...

Anyway, what should we do with it - it's still going to be incompatible code
from Access, possibly from SQL Server if it uses [...] (in case you didn't
know, the CVS code for pgMigration supports SQL Server natively now) and the
ODBC support definitely won't work as the ODBC provider doesn't support the
return of View definitions (probably because it's not in the ODBC spec)? Any
ideas? :-)

Cheers, Dave.