Cargar Estructura de una tabla Mysql

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
AidTIC
Posts: 117
Joined: Mon Apr 22, 2013 8:29 am
DBs Used: DBF
Contact:

Cargar Estructura de una tabla Mysql

Post by AidTIC »

Hola amigos, estoy intentando cargar la Estructura de una tabla de MySql a un array, igual que haria dbStruct() para los ficheos DBf. pero no se por donde tirar.

La forma que estoy gastando para conectar es:


oServer := TMySQLServer():New(cHostName, cUser, cPassWord)

// Check For Error

If oServer:NetErr()
MsgStop(oServer:Error())
Win_1.Title := 'Sincronizador Sky-Line - Not Connected'
Else

MsgInfo("Connected")
Win_1.Title := 'Sincronizador Sky-Line - Connected'

EndIf
oServer:SelectDB( cDataBase )



Y con esta linea trato de grabar la estructura al array


eTabla := oServer:Query( "SELECT * FROM COLUMNS WHERE TABLE_SCHEMA = cDatabase AND TABLE_NAME = 'tabla01')


Pero no me devuelve nada.

Podrian ayudarme? Gracias.


* * * * * Traduccion by Google * * * *
Hello friends, I am trying to load the structure of a MySQL table to an array, just as you would DBSTRUCT () to DBF ficheos. but do not know where to shoot.

The way I'm spending to connect is:



oServer := TMySQLServer():New(cHostName, cUser, cPassWord)

// Check For Error

If oServer:NetErr()
MsgStop(oServer:Error())
Win_1.Title := 'Sincronizador Sky-Line - Not Connected'
Else

MsgInfo("Connected")
Win_1.Title := 'Sincronizador Sky-Line - Connected'

EndIf
oServer:SelectDB( cDataBase )


And with this line try to burn the structure to the array


eTabla := oServer:Query( "SELECT * FROM COLUMNS WHERE TABLE_SCHEMA = cDatabase AND TABLE_NAME = 'tabla01')


But I do not return anything.

Could help me? Thank you.
Skydone Solutions
www.skydone.com
User avatar
dragancesu
Posts: 931
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Cargar Estructura de una tabla Mysql

Post by dragancesu »

Try this, it work

Only need libmysql.dll
Attachments
mysqlfunc.ZIP
(3.37 KiB) Downloaded 282 times
User avatar
AidTIC
Posts: 117
Joined: Mon Apr 22, 2013 8:29 am
DBs Used: DBF
Contact:

Re: Cargar Estructura de una tabla Mysql

Post by AidTIC »

Muchas Gracias, me ha resultado de gran utilidad.

Otra pregunta, habría alguna manera de comprobar si una tabla especifica de mi base de datos a sido modificada, desde la ultima vez que la comprobe?

Si te sirve de ayuda, la tabla lleva un campo que indica el día y hora que ha sido modificada, pero no esta indexada por ese orden.

Gracias de nuevo.
Skydone Solutions
www.skydone.com
User avatar
dragancesu
Posts: 931
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Cargar Estructura de una tabla Mysql

Post by dragancesu »

If I understand you want to know whether the record changed

Add fields status_insert and status_update as datetime and make a trigger before insert and before update to fill in the value of these fields
User avatar
AidTIC
Posts: 117
Joined: Mon Apr 22, 2013 8:29 am
DBs Used: DBF
Contact:

Re: Cargar Estructura de una tabla Mysql

Post by AidTIC »

Te explico, tengo un programa de gestion con una base de datos es MySql.

Y estoy haciendo un programa paralelo, que cuando alguien desde el programa de gestion, actualice o añada algun registro de una derterminada tabla, el programa que estoy haciendo realizar unos procesos.

Es por eso que necesito controla cuando se modifica esa tabla.
La tabla tiene un campo donde esta guardando la ultima vez que se ha modificado el registro.


* * * * * Traduccion by Google * * * *

I mean, I have a management program with a database is MySQL.

And I'm doing a parallel program, when someone from the management program, update or add some derterminada register a table, the program I'm doing make some processes.

That's why I need to control when the table is modified.
The table has a field where you are saving the last time the record was modified.
Skydone Solutions
www.skydone.com
User avatar
dragancesu
Posts: 931
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Cargar Estructura de una tabla Mysql

Post by dragancesu »

User avatar
AidTIC
Posts: 117
Joined: Mon Apr 22, 2013 8:29 am
DBs Used: DBF
Contact:

Re: Cargar Estructura de una tabla Mysql

Post by AidTIC »

No.
Skydone Solutions
www.skydone.com
Post Reply