Hello,
I lunch a query on a MySql db and create a dynamic temp table with the result.
To create the fields of the temp table I take the name of the fields with this code :
OpenEdge Release 10.1B03
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
It's working if I lunch the Debugger cause it will lunch java.exe. Without Debugger I have the error 2914 : Put/Get functions not allowed on uninitialized memory. (2914)
Somebody can help please ? (Or perhaps an other way to use libMysql.dll)
Other thing if somebody knows hows to get the type of the fields it will be perfect (I tried mysql_fetch_field() without result.
(sorry for my english)
Thanks
I lunch a query on a MySql db and create a dynamic temp table with the result.
To create the fields of the temp table I take the name of the fields with this code :
OpenEdge Release 10.1B03
////////////////////////////////////////////////////////////////////////////
Code:
[..]
procedure mysql_fetch_field_direct external "libmysql.dll" persistent:
define input parameter mysql_res as memptr.
define input parameter fieldnr as short.
define return parameter fieldtype as memptr.
end procedure.
[..]
/* Execution de la Requete */
db_query(sBdd,
sServer,
sPort,
sUser,
sPassword,
mMysql,
sRequete).
/* Resultat de la 8requete */
mysql_res = db_use_result(mMysql).
/* Creation de la table temporaire dynamique */
DEFINE VARIABLE tth AS HANDLE.
DEFINE VARIABLE bh AS HANDLE.
DEFINE VARIABLE qh AS HANDLE.
DEFINE VARIABLE fld1 AS HANDLE.
DEFINE VARIABLE nb AS INTEGER.
CREATE TEMP-TABLE tth.
/* Nbre de champs dans la requete */
RUN mysql_num_fields(INPUT mysql_res,OUTPUT iNbreFields).
/* DEBUGGER:INITIATE(). */
SET-SIZE(mTypeField) = 800.
SET-SIZE(mysql_element) = 2000.
/* Creation dynamique des champs de la table temporaire */
DO iInd01 = 1 TO iNbreFields:
/* Nom des champs */
RUN mysql_fetch_field_direct(INPUT mysql_res,INPUT (iInd01 - 1),OUTPUT mTypeField).
iLong = GET-LONG(mTypeField,1).
SET-POINTER-VALUE(mysql_element) = iLong.
sFieldsEnCours = GET-STRING(mysql_element,1).
tth:ADD-NEW-FIELD(sFieldsEnCours,"CHAR",0,"X(256)","",fCapsName(sFieldsEnCours),fCapsName(sFieldsEnCours))
END.
SET-SIZE(mTypeField) = 0.
SET-SIZE(mysql_element) = 0.
tth:TEMP-TABLE-PREPARE("ttMySql").
bh = tth:DEFAULT-BUFFER-HANDLE.
[..]
It's working if I lunch the Debugger cause it will lunch java.exe. Without Debugger I have the error 2914 : Put/Get functions not allowed on uninitialized memory. (2914)
Somebody can help please ? (Or perhaps an other way to use libMysql.dll)
Other thing if somebody knows hows to get the type of the fields it will be perfect (I tried mysql_fetch_field() without result.
(sorry for my english)
Thanks
Last edited by a moderator: