![]() |
![]() |
![]() |
||||||
SCR/AL1 - TOME III. Les librairies utilitaires
Syntaxe
OTBL *OGetTableInfo(ODSN *odsn, char *tblname)
Description
Construit une structure contenant la définition d'une table.
Valeur retournée
Pointeur vers une structure OTBL qui contient les informations sur les colonnes de la table tblname. Pointeur nul en cas d'erreur.
Exemple
ODSN *odsn = 0;
OTBL *otbl = 0;
int k;
if(OInit()) {
printf("Cannot initialize ODBC\n");
return(-1);
}
odsn = OOpenDSN(dsname, user, pwd);
if(odsn == 0) {
printf("Error : Cannot open %s\n", ARG_VALUES[pos + 1]);
}
else {
otbl = OGetTableInfo(odsn, "MyTable");
if(otbl == 0)
printf("Cannot read table MyTable: %s\n", OError());
else {
for(k = 0 ; k < otbl->ncols ; k++)
printf("%d : %s[%d]\n",
k, otbl->cols[k].typename,
otbl->cols[k].len);
OFreeOTBL(otbl);
}
}
OCloseDSN(odsn);
OEnd();
Voir également
OCloseDSN(), OInit(), OEnd(), ODisplayTable()
Copyright © 1998-2001 Jean-Marc and Bernard PAUL - Envoyez vos remarques ou commentaires à bp@xon.be