can a result database object be copy to other database (of different type)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

can a result database object be copy to other database (of different type)

PICCORO McKAY Lenz
i mean, due the now well knowed problem of odbc,

i have two databases, db1 can be mysql, odbc, etc, and the other target db
must be sqlite..

can be possible to port from the db1 to the memory table in sqlite3 db2 ?
or at leas ina normal sqlite3 table?


Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: can a result database object be copy to other database (of different type)

Tobias Boege-2
On Mon, 22 May 2017, PICCORO McKAY Lenz wrote:
> i mean, due the now well knowed problem of odbc,
>
> i have two databases, db1 can be mysql, odbc, etc, and the other target db
> must be sqlite..
>
> can be possible to port from the db1 to the memory table in sqlite3 db2 ?
> or at leas ina normal sqlite3 table?
>

This is not a Gambas problem anymore is it? Did you consider the solutions
that the obvious web search yields, e.g. [1] ?

Regards,
Tobi

[1] https://stackoverflow.com/questions/3890518/convert-mysql-to-sqlite

--
"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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: can a result database object be copy to other database (of different type)

PICCORO McKAY Lenz
umm usefully, but the source its odbc.. was my faul...

in any case, there's posible to cpy between results object of differents
connections? that the right quiestion!

the case its important to make a special daemon for webservices..

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-05-22 13:11 GMT-04:00 Tobias Boege <[hidden email]>:

> On Mon, 22 May 2017, PICCORO McKAY Lenz wrote:
> > i mean, due the now well knowed problem of odbc,
> >
> > i have two databases, db1 can be mysql, odbc, etc, and the other target
> db
> > must be sqlite..
> >
> > can be possible to port from the db1 to the memory table in sqlite3 db2 ?
> > or at leas ina normal sqlite3 table?
> >
>
> This is not a Gambas problem anymore is it? Did you consider the solutions
> that the obvious web search yields, e.g. [1] ?
>
> Regards,
> Tobi
>
> [1] https://stackoverflow.com/questions/3890518/convert-mysql-to-sqlite
>
> --
> "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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: can a result database object be copy to other database (of different type)

Tobias Boege-2
On Mon, 22 May 2017, PICCORO McKAY Lenz wrote:
> umm usefully, but the source its odbc.. was my faul...
>
> in any case, there's posible to cpy between results object of differents
> connections? that the right quiestion!
>

Ok, after I formulated my answer, I can see how you may want to use Gambas
for this task.

Assume you have hSrc and hDst two Connections -- hSrc is the source database
and hDst is the destination database. The DB types don't matter! I would do
the conversion in two stages:

  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).

     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.

  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).

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?

Regards,
Tobi

--
"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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: can a result database object be copy to other database (of different type)

PICCORO McKAY Lenz
2017-05-22 13:48 GMT-04:00 Tobias Boege <[hidden email]>:

>   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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: can a result database object be copy to other database (of different type)

PICCORO McKAY Lenz
In reply to this post by Tobias Boege-2
hi again tobias.. only a informative mail: the tools that refers your first
links all does not usefully, due

with huge data no one its working!.. all the solutions are script based
over a mysql dump so all are a disc I/O operation when are using...



Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-05-22 12:41 GMT-04:30 Tobias Boege <[hidden email]>:

> On Mon, 22 May 2017, PICCORO McKAY Lenz wrote:
> > i mean, due the now well knowed problem of odbc,
> >
> > i have two databases, db1 can be mysql, odbc, etc, and the other target
> db
> > must be sqlite..
> >
> > can be possible to port from the db1 to the memory table in sqlite3 db2 ?
> > or at leas ina normal sqlite3 table?
> >
>
> This is not a Gambas problem anymore is it? Did you consider the solutions
> that the obvious web search yields, e.g. [1] ?
>
> Regards,
> Tobi
>
> [1] https://stackoverflow.com/questions/3890518/convert-mysql-to-sqlite
>
> --
> "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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user