[Gambas-user] can a result database object be copy to other database (of different type)

PICCORO McKAY Lenz mckaygerhard at ...626...
Mon May 22 20:48:23 CEST 2017


2017-05-22 13:48 GMT-04:00 Tobias Boege <taboege at ...626...>:

>   1. Copy the database users (Connection.Users), then the databases
>      (Connection.Databases) and after that the table schemas
> (Connection.Tables)
>      for each database. I don't think you can expect to transfer anything
>      else like permissions because it is not supported by the gb.db
>      interface (sqlite doesn't even support users).
>
works.. some mistakes in schemas for postgres but no mayor problem in
odbc/sybase and mysql, a shema its a complete database


>      You can use the gb.db objects for this, e.g. to copy the schema of a
>      database table, you get the corresponding Table object and iterate
>      through its Fields member to get all the fields. Luckily the field
>      types are db.String, db.Integer, etc., i.e. *Gambas* constants. You
>      can easily transfer this common representation of the table schema to
>      your destination database.
>
works.. for create thanks


>   2. Copy all the records. hSrc.Find(tablename) (or so) gives you all the
>      records in the given table. Recreate all the records in the
> appropriate
>      destination database table, using hDst.Create(tablename).
>
problems with odbc.. for mysql vs sqlite works. umm i must debug i think
the problem its again in odbc sybase, seems datatypes convertion internals
respect gambas representation, theres some strange as nchar and so..


>
> I'm reasonably sure that there is no less manual way. But beware that you
> might run into problems of all thinkable kinds, e.g. with auto-increment
> fields which you may or may not be allowed to set on your own when you
> create a record, or maybe one database type stores milliseconds together
> with a date while the other is incapable of that. What do I know?
>
of course any specific database as autoincrement in mysql case are out of
this ...


>
> Regards,
> Tobi
>
thanks for now for the step 2 i must made dinamyc querys of inserts
oobjects, later i debug more over the odbc sybase datatypes


>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list