|
From: <sv...@de...> - 2005-05-25 19:54:05
|
Author: pcamacho
Date: 2005-05-25 15:54:05 -0400 (Wed, 25 May 2005)
New Revision: 1148
Modified:
humano2/trunk/core/db/mssql/mssqlComplex.cs
humano2/trunk/core/db/mssql/mssqlCrud.cs
Log:
ADD: implementation of to functions (GetBasicAttributeSysName and findSql=
TypeForAttribute) for MSSQL.
Modified: humano2/trunk/core/db/mssql/mssqlComplex.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- humano2/trunk/core/db/mssql/mssqlComplex.cs 2005-05-25 19:46:20 UTC (=
rev 1147)
+++ humano2/trunk/core/db/mssql/mssqlComplex.cs 2005-05-25 19:54:05 UTC (=
rev 1148)
@@ -1174,9 +1174,27 @@
=20
override public string GetBasicAttributeSysName(int classId)
{
- //FIXME: this method must be implemented
- throw new MetaModelException("Method GetBasicAttributeSysNam=
e must be implemented.");
- return null; =20
+ int parentId =3D classId;
+ int oldParentId =3D 0;
+ =20
+ while(parentId !=3D 5)
+ {
+ oldParentId =3D parentId;
+ Logger.Log("GetBasicAttributeSysName: parentId=3D " + pa=
rentId, LogLevel.Trace);
+ string queryParent =3D "select \"parentId\" from class w=
here id_entity=3D" + parentId;
+ object resParent =3D conn.doScalar(queryParent);
+ if(resParent =3D=3D null)
+ {
+ throw new MetaModelException("The attribute of class=
Id " + classId + " has a null parent ID.");
+ }
+ parentId =3D Convert.ToInt32(resParent);
+ }
+ //Now I look for the sysName of basic attribute
+ string querySysName =3D "select \"sysName\" from class where=
id_entity=3D" + oldParentId;
+ object resSysName =3D conn.doScalar(querySysName);
+ string sysName =3D resSysName.ToString();
+ =20
+ return sysName;
}
=20
}
Modified: humano2/trunk/core/db/mssql/mssqlCrud.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- humano2/trunk/core/db/mssql/mssqlCrud.cs 2005-05-25 19:46:20 UTC (rev=
1147)
+++ humano2/trunk/core/db/mssql/mssqlCrud.cs 2005-05-25 19:54:05 UTC (rev=
1148)
@@ -1757,9 +1757,32 @@
///</summary>
override protected string findSqlTypeForAttribute(StringDictiona=
ry attMap, string name)
{
- //FIXME: this method has to be implemented...=20
- throw new MetaModelException("The method findSqlTypeForAttri=
bute is not yet implemented...");
- return ""; =20
+ absCrud crud =3D Factory.Crud();
+ absComplex complex =3D crud.GetCore().Complex;
+ Logger.Log("finSqlTypeForAttribute: name=3D " + name,LogLeve=
l.Trace);
+ =20
+ string [] nameSplit =3D name.Split((".").ToCharArray());
+ string aux =3D nameSplit[1]; //The before last element of sp=
lit has got the good data (sysName of attribute)
+ aux =3D aux.Replace("\"",""); //Remove "
+ Logger.Log("findSqlTypeForAttribute: aux =3D " + aux, LogLe=
vel.Trace);
+ =20
+ int id_entity =3D complex.ConvertSysAttNameToIdAttName(aux);
+ =20
+ string res;
+ =20
+ if(id_entity =3D=3D -1)
+ {
+ Logger.Log("findSqlTypeForAttribute: id_entity =3D=3D -1=
",LogLevel.Trace);
+ res =3D null;
+ }
+ else
+ { =20
+ int classIdOfAttribute =3D complex.getClassIdofInstance(=
id_entity);=20
+ string basicAttributeSysName =3D complex.GetBasicAttribu=
teSysName(classIdOfAttribute);
+ Logger.Log("findSqlTypeForAttribute: basicAttributeSysNa=
me=3D " + basicAttributeSysName,LogLevel.Trace);
+ res =3DattMap[basicAttributeSysName];
+ }
+ return res;
}
}
}
|