From: NHibernate J. <mik...@us...> - 2006-10-24 06:54:38
|
[ http://jira.nhibernate.org/browse/NH-628?page=comments#action_14161 ] Sergey Koshcheyev commented on NH-628: -------------------------------------- After applying the last patch three tests fail for me in SimpleFunctionsTest: ClassicSum, ClassicAvg, ClassicCount. Is this expected? The failure messages are like this: NUnit.Framework.AssertionException: String lengths differ. Expected length=17, but was length=18. Strings differ at index 12. expected: <"avg(distinct va1)"> but was: <"avg(distinct, va2)"> ------------------------^ at NUnit.Framework.Assert.AreEqual(Object expected, Object actual) at NHibernate.Test.HQLFunctionTest.SimpleFunctionsTest.ClassicAvg() in SimpleFunctionsTest.cs:line 214 > HQL functions mapping > --------------------- > > Key: NH-628 > URL: http://jira.nhibernate.org/browse/NH-628 > Project: NHibernate > Type: Improvement > Components: Data Providers > Versions: 1.2.0.Beta1 > Reporter: Fabio Maulo > Assignee: Fabio Maulo > Attachments: NH628CastFunction.patch, NH628First.patch, NH628Next1.patch, NH628Next2.patch > > For columns types we have RegisterColumnType in the dialect to registr the supported types for a specific dialect. > With RegisterColumnType we can map a DbType with a equivalent specific dialect type although it isn't directly supported (a DbType.Guid can be mapped to a CHAR(38)). > Functions haven't mapping so if i write "from Person p where lenght(p.Name) > 10" i can't sure that work with all, or many, dialect. If the "lenght" function is not supported by an specific dialect i don't recive a NHibernate excetion directly with the message "lenght is not supported by XYZ dialect". > I think that he would be useful to have a collection of "basic" HQL function that can be specialized for a specific > dialect. > For example NHb can have in it's HQLfunctionList: > -a function named "hblenstr" that recive a parameter type NHibernateUtil.String (or a property with type NHibernateUtil.String) and return a NHibernateUtil.Int32. > -a function named "hbNullToInt" that recive two parameter; the first is a NHibernateUtil.Int16 or NHibernateUtil.Int32 or NHibernateUtil.Int64 (or a property...); the 2th is a constant of type NHibernateUtil.Int16 .. etc. > Heach dialect can have an overload of RegisterFunction( string hbFunctionName, dialectFunctionName ). > For the two function in the example we can have: > for Oracle9Dialect > RegisterFunction("hblenstr","length"); > RegisterFunction("hbNullToInt","nvl"); > for MsSql2000Dialect > RegisterFunction("hblenstr","length"); > for FirebirdDialect (or a specific FirebirdDialect with extended UDFs ;) ) > RegisterFunction("hblenstr","strlen"); > RegisterFunction("hbNullToInt","invl"); > Now we can write an HQL like this "from Person p where hblenstr(p.Name) > 10" and NHb can substitue "hblenstr" with apropiate dialect function (before substitution can control that the hblenstr revive de apropiate param type etc.). > This posible implementation don't have problems if an hbXYZ function have the same name of specific dialect function (i think the probability is very low but there are no problems). > The actual implementation of RegisterFunction don't need any adjustment because all continue to work. > Finally: > -If a dialect use actual implementation of RegisterFunction and a developer use this function in a HQL he can't be sure that all work fine when he need to change de hibernate.cfg.xml to change the dialect. > -If a dialect was implemented with RegisterFunction( string hbFunctionName, dialectFunctionName ) mapping and a developer use the hbXYZ function in a HQL he can have an hight probability that all work fine. > Bye. > Fabio. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-10-24 07:51:01
|
[ http://jira.nhibernate.org/browse/NH-628?page=comments#action_14164 ] Ayende Rahien commented on NH-628: ---------------------------------- The result seems like it fails to understand the meaning of distinct in the query. (not a different parameter). I would say tha tthis is not good. > HQL functions mapping > --------------------- > > Key: NH-628 > URL: http://jira.nhibernate.org/browse/NH-628 > Project: NHibernate > Type: Improvement > Components: Data Providers > Versions: 1.2.0.Beta1 > Reporter: Fabio Maulo > Assignee: Fabio Maulo > Attachments: NH628CastFunction.patch, NH628First.patch, NH628Next1.patch, NH628Next2.patch > > For columns types we have RegisterColumnType in the dialect to registr the supported types for a specific dialect. > With RegisterColumnType we can map a DbType with a equivalent specific dialect type although it isn't directly supported (a DbType.Guid can be mapped to a CHAR(38)). > Functions haven't mapping so if i write "from Person p where lenght(p.Name) > 10" i can't sure that work with all, or many, dialect. If the "lenght" function is not supported by an specific dialect i don't recive a NHibernate excetion directly with the message "lenght is not supported by XYZ dialect". > I think that he would be useful to have a collection of "basic" HQL function that can be specialized for a specific > dialect. > For example NHb can have in it's HQLfunctionList: > -a function named "hblenstr" that recive a parameter type NHibernateUtil.String (or a property with type NHibernateUtil.String) and return a NHibernateUtil.Int32. > -a function named "hbNullToInt" that recive two parameter; the first is a NHibernateUtil.Int16 or NHibernateUtil.Int32 or NHibernateUtil.Int64 (or a property...); the 2th is a constant of type NHibernateUtil.Int16 .. etc. > Heach dialect can have an overload of RegisterFunction( string hbFunctionName, dialectFunctionName ). > For the two function in the example we can have: > for Oracle9Dialect > RegisterFunction("hblenstr","length"); > RegisterFunction("hbNullToInt","nvl"); > for MsSql2000Dialect > RegisterFunction("hblenstr","length"); > for FirebirdDialect (or a specific FirebirdDialect with extended UDFs ;) ) > RegisterFunction("hblenstr","strlen"); > RegisterFunction("hbNullToInt","invl"); > Now we can write an HQL like this "from Person p where hblenstr(p.Name) > 10" and NHb can substitue "hblenstr" with apropiate dialect function (before substitution can control that the hblenstr revive de apropiate param type etc.). > This posible implementation don't have problems if an hbXYZ function have the same name of specific dialect function (i think the probability is very low but there are no problems). > The actual implementation of RegisterFunction don't need any adjustment because all continue to work. > Finally: > -If a dialect use actual implementation of RegisterFunction and a developer use this function in a HQL he can't be sure that all work fine when he need to change de hibernate.cfg.xml to change the dialect. > -If a dialect was implemented with RegisterFunction( string hbFunctionName, dialectFunctionName ) mapping and a developer use the hbXYZ function in a HQL he can have an hight probability that all work fine. > Bye. > Fabio. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-10-24 08:02:34
|
[ http://jira.nhibernate.org/browse/NH-628?page=comments#action_14165 ] Sergey Koshcheyev commented on NH-628: -------------------------------------- Yes, I just don't know whether Fabio intended this test to fail or not. > HQL functions mapping > --------------------- > > Key: NH-628 > URL: http://jira.nhibernate.org/browse/NH-628 > Project: NHibernate > Type: Improvement > Components: Data Providers > Versions: 1.2.0.Beta1 > Reporter: Fabio Maulo > Assignee: Fabio Maulo > Attachments: NH628CastFunction.patch, NH628First.patch, NH628Next1.patch, NH628Next2.patch > > For columns types we have RegisterColumnType in the dialect to registr the supported types for a specific dialect. > With RegisterColumnType we can map a DbType with a equivalent specific dialect type although it isn't directly supported (a DbType.Guid can be mapped to a CHAR(38)). > Functions haven't mapping so if i write "from Person p where lenght(p.Name) > 10" i can't sure that work with all, or many, dialect. If the "lenght" function is not supported by an specific dialect i don't recive a NHibernate excetion directly with the message "lenght is not supported by XYZ dialect". > I think that he would be useful to have a collection of "basic" HQL function that can be specialized for a specific > dialect. > For example NHb can have in it's HQLfunctionList: > -a function named "hblenstr" that recive a parameter type NHibernateUtil.String (or a property with type NHibernateUtil.String) and return a NHibernateUtil.Int32. > -a function named "hbNullToInt" that recive two parameter; the first is a NHibernateUtil.Int16 or NHibernateUtil.Int32 or NHibernateUtil.Int64 (or a property...); the 2th is a constant of type NHibernateUtil.Int16 .. etc. > Heach dialect can have an overload of RegisterFunction( string hbFunctionName, dialectFunctionName ). > For the two function in the example we can have: > for Oracle9Dialect > RegisterFunction("hblenstr","length"); > RegisterFunction("hbNullToInt","nvl"); > for MsSql2000Dialect > RegisterFunction("hblenstr","length"); > for FirebirdDialect (or a specific FirebirdDialect with extended UDFs ;) ) > RegisterFunction("hblenstr","strlen"); > RegisterFunction("hbNullToInt","invl"); > Now we can write an HQL like this "from Person p where hblenstr(p.Name) > 10" and NHb can substitue "hblenstr" with apropiate dialect function (before substitution can control that the hblenstr revive de apropiate param type etc.). > This posible implementation don't have problems if an hbXYZ function have the same name of specific dialect function (i think the probability is very low but there are no problems). > The actual implementation of RegisterFunction don't need any adjustment because all continue to work. > Finally: > -If a dialect use actual implementation of RegisterFunction and a developer use this function in a HQL he can't be sure that all work fine when he need to change de hibernate.cfg.xml to change the dialect. > -If a dialect was implemented with RegisterFunction( string hbFunctionName, dialectFunctionName ) mapping and a developer use the hbXYZ function in a HQL he can have an hight probability that all work fine. > Bye. > Fabio. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-10-24 11:04:38
|
[ http://jira.nhibernate.org/browse/NH-628?page=comments#action_14166 ] Fabio Maulo commented on NH-628: -------------------------------- Well... this is the matter.... - The HQLFunction is a port from H3.2. - Test are no present in H3.2. - For ClassicSum, ClassicAvg, ClassicCount i write the test using a sintax, for aggregate, that a user expect work like now in NHb but... with the H3.2 implementation it no work (the hinstory of this issue let me know that is better to have a real issue before to have a different implementation than H3). But.... the real problem with HQLFunction and NHb is another.... the parser... but this is another story. I'm working on the parser... > HQL functions mapping > --------------------- > > Key: NH-628 > URL: http://jira.nhibernate.org/browse/NH-628 > Project: NHibernate > Type: Improvement > Components: Data Providers > Versions: 1.2.0.Beta1 > Reporter: Fabio Maulo > Assignee: Fabio Maulo > Attachments: NH628CastFunction.patch, NH628First.patch, NH628Next1.patch, NH628Next2.patch > > For columns types we have RegisterColumnType in the dialect to registr the supported types for a specific dialect. > With RegisterColumnType we can map a DbType with a equivalent specific dialect type although it isn't directly supported (a DbType.Guid can be mapped to a CHAR(38)). > Functions haven't mapping so if i write "from Person p where lenght(p.Name) > 10" i can't sure that work with all, or many, dialect. If the "lenght" function is not supported by an specific dialect i don't recive a NHibernate excetion directly with the message "lenght is not supported by XYZ dialect". > I think that he would be useful to have a collection of "basic" HQL function that can be specialized for a specific > dialect. > For example NHb can have in it's HQLfunctionList: > -a function named "hblenstr" that recive a parameter type NHibernateUtil.String (or a property with type NHibernateUtil.String) and return a NHibernateUtil.Int32. > -a function named "hbNullToInt" that recive two parameter; the first is a NHibernateUtil.Int16 or NHibernateUtil.Int32 or NHibernateUtil.Int64 (or a property...); the 2th is a constant of type NHibernateUtil.Int16 .. etc. > Heach dialect can have an overload of RegisterFunction( string hbFunctionName, dialectFunctionName ). > For the two function in the example we can have: > for Oracle9Dialect > RegisterFunction("hblenstr","length"); > RegisterFunction("hbNullToInt","nvl"); > for MsSql2000Dialect > RegisterFunction("hblenstr","length"); > for FirebirdDialect (or a specific FirebirdDialect with extended UDFs ;) ) > RegisterFunction("hblenstr","strlen"); > RegisterFunction("hbNullToInt","invl"); > Now we can write an HQL like this "from Person p where hblenstr(p.Name) > 10" and NHb can substitue "hblenstr" with apropiate dialect function (before substitution can control that the hblenstr revive de apropiate param type etc.). > This posible implementation don't have problems if an hbXYZ function have the same name of specific dialect function (i think the probability is very low but there are no problems). > The actual implementation of RegisterFunction don't need any adjustment because all continue to work. > Finally: > -If a dialect use actual implementation of RegisterFunction and a developer use this function in a HQL he can't be sure that all work fine when he need to change de hibernate.cfg.xml to change the dialect. > -If a dialect was implemented with RegisterFunction( string hbFunctionName, dialectFunctionName ) mapping and a developer use the hbXYZ function in a HQL he can have an hight probability that all work fine. > Bye. > Fabio. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-10-24 22:20:35
|
[ http://jira.nhibernate.org/browse/NH-628?page=comments#action_14178 ] Fabio Maulo commented on NH-628: -------------------------------- Continue in SVN... > HQL functions mapping > --------------------- > > Key: NH-628 > URL: http://jira.nhibernate.org/browse/NH-628 > Project: NHibernate > Type: Improvement > Components: Data Providers > Versions: 1.2.0.Beta1 > Reporter: Fabio Maulo > Assignee: Fabio Maulo > Attachments: NH628CastFunction.patch, NH628First.patch, NH628Next1.patch, NH628Next2.patch > > For columns types we have RegisterColumnType in the dialect to registr the supported types for a specific dialect. > With RegisterColumnType we can map a DbType with a equivalent specific dialect type although it isn't directly supported (a DbType.Guid can be mapped to a CHAR(38)). > Functions haven't mapping so if i write "from Person p where lenght(p.Name) > 10" i can't sure that work with all, or many, dialect. If the "lenght" function is not supported by an specific dialect i don't recive a NHibernate excetion directly with the message "lenght is not supported by XYZ dialect". > I think that he would be useful to have a collection of "basic" HQL function that can be specialized for a specific > dialect. > For example NHb can have in it's HQLfunctionList: > -a function named "hblenstr" that recive a parameter type NHibernateUtil.String (or a property with type NHibernateUtil.String) and return a NHibernateUtil.Int32. > -a function named "hbNullToInt" that recive two parameter; the first is a NHibernateUtil.Int16 or NHibernateUtil.Int32 or NHibernateUtil.Int64 (or a property...); the 2th is a constant of type NHibernateUtil.Int16 .. etc. > Heach dialect can have an overload of RegisterFunction( string hbFunctionName, dialectFunctionName ). > For the two function in the example we can have: > for Oracle9Dialect > RegisterFunction("hblenstr","length"); > RegisterFunction("hbNullToInt","nvl"); > for MsSql2000Dialect > RegisterFunction("hblenstr","length"); > for FirebirdDialect (or a specific FirebirdDialect with extended UDFs ;) ) > RegisterFunction("hblenstr","strlen"); > RegisterFunction("hbNullToInt","invl"); > Now we can write an HQL like this "from Person p where hblenstr(p.Name) > 10" and NHb can substitue "hblenstr" with apropiate dialect function (before substitution can control that the hblenstr revive de apropiate param type etc.). > This posible implementation don't have problems if an hbXYZ function have the same name of specific dialect function (i think the probability is very low but there are no problems). > The actual implementation of RegisterFunction don't need any adjustment because all continue to work. > Finally: > -If a dialect use actual implementation of RegisterFunction and a developer use this function in a HQL he can't be sure that all work fine when he need to change de hibernate.cfg.xml to change the dialect. > -If a dialect was implemented with RegisterFunction( string hbFunctionName, dialectFunctionName ) mapping and a developer use the hbXYZ function in a HQL he can have an hight probability that all work fine. > Bye. > Fabio. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2007-03-27 14:55:38
|
[ http://jira.nhibernate.org/browse/NH-628?page=comments#action_15373 ] Sergey Koshcheyev commented on NH-628: -------------------------------------- Review A few spelling mistakes: - sintax -> syntax - grammer -> grammar - casted -> cast (CastedFunction -> maybe FunctionNestedInCast?) - know argument -> known argument Technical: - ClassicCountFunction should return Int32, not Int64 - that was the whole reason for its existence. - You don't need to pass the second argument (message) to ArgumentNullException - the default message is good enough. If all tests pass, commit the patch after you fix the problems, I will probably play with it some more after you do. > HQL functions mapping > --------------------- > > Key: NH-628 > URL: http://jira.nhibernate.org/browse/NH-628 > Project: NHibernate > Type: Improvement > Components: Data Providers > Versions: 1.2.0.Beta1 > Reporter: Fabio Maulo > Assignee: Fabio Maulo > Fix For: LATER > Attachments: HQLFunctionsFinal.zip, HQLFunctionsPreview.7z, NH628CastFunction.patch, NH628First.patch, NH628Next1.patch, NH628Next2.patch > > For columns types we have RegisterColumnType in the dialect to registr the supported types for a specific dialect. > With RegisterColumnType we can map a DbType with a equivalent specific dialect type although it isn't directly supported (a DbType.Guid can be mapped to a CHAR(38)). > Functions haven't mapping so if i write "from Person p where lenght(p.Name) > 10" i can't sure that work with all, or many, dialect. If the "lenght" function is not supported by an specific dialect i don't recive a NHibernate excetion directly with the message "lenght is not supported by XYZ dialect". > I think that he would be useful to have a collection of "basic" HQL function that can be specialized for a specific > dialect. > For example NHb can have in it's HQLfunctionList: > -a function named "hblenstr" that recive a parameter type NHibernateUtil.String (or a property with type NHibernateUtil.String) and return a NHibernateUtil.Int32. > -a function named "hbNullToInt" that recive two parameter; the first is a NHibernateUtil.Int16 or NHibernateUtil.Int32 or NHibernateUtil.Int64 (or a property...); the 2th is a constant of type NHibernateUtil.Int16 .. etc. > Heach dialect can have an overload of RegisterFunction( string hbFunctionName, dialectFunctionName ). > For the two function in the example we can have: > for Oracle9Dialect > RegisterFunction("hblenstr","length"); > RegisterFunction("hbNullToInt","nvl"); > for MsSql2000Dialect > RegisterFunction("hblenstr","length"); > for FirebirdDialect (or a specific FirebirdDialect with extended UDFs ;) ) > RegisterFunction("hblenstr","strlen"); > RegisterFunction("hbNullToInt","invl"); > Now we can write an HQL like this "from Person p where hblenstr(p.Name) > 10" and NHb can substitue "hblenstr" with apropiate dialect function (before substitution can control that the hblenstr revive de apropiate param type etc.). > This posible implementation don't have problems if an hbXYZ function have the same name of specific dialect function (i think the probability is very low but there are no problems). > The actual implementation of RegisterFunction don't need any adjustment because all continue to work. > Finally: > -If a dialect use actual implementation of RegisterFunction and a developer use this function in a HQL he can't be sure that all work fine when he need to change de hibernate.cfg.xml to change the dialect. > -If a dialect was implemented with RegisterFunction( string hbFunctionName, dialectFunctionName ) mapping and a developer use the hbXYZ function in a HQL he can have an hight probability that all work fine. > Bye. > Fabio. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2007-03-27 15:12:43
|
[ http://jira.nhibernate.org/browse/NH-628?page=comments#action_15374 ] Fabio Maulo commented on NH-628: -------------------------------- Ok. The NHibernate.Dialect.FirebirdDialect.CastedFunction is because FB need cast for some function. An FB-SQL example: SELECT CAST('TODAY' as TIMESTAMP) FROM .... is the right syntax for today() function. The name i need is something that mean: A function that need cast. Please send me the right name or change it after commit. Thanks. Fabio. > HQL functions mapping > --------------------- > > Key: NH-628 > URL: http://jira.nhibernate.org/browse/NH-628 > Project: NHibernate > Type: Improvement > Components: Data Providers > Versions: 1.2.0.Beta1 > Reporter: Fabio Maulo > Assignee: Fabio Maulo > Fix For: LATER > Attachments: HQLFunctionsFinal.zip, HQLFunctionsPreview.7z, NH628CastFunction.patch, NH628First.patch, NH628Next1.patch, NH628Next2.patch > > For columns types we have RegisterColumnType in the dialect to registr the supported types for a specific dialect. > With RegisterColumnType we can map a DbType with a equivalent specific dialect type although it isn't directly supported (a DbType.Guid can be mapped to a CHAR(38)). > Functions haven't mapping so if i write "from Person p where lenght(p.Name) > 10" i can't sure that work with all, or many, dialect. If the "lenght" function is not supported by an specific dialect i don't recive a NHibernate excetion directly with the message "lenght is not supported by XYZ dialect". > I think that he would be useful to have a collection of "basic" HQL function that can be specialized for a specific > dialect. > For example NHb can have in it's HQLfunctionList: > -a function named "hblenstr" that recive a parameter type NHibernateUtil.String (or a property with type NHibernateUtil.String) and return a NHibernateUtil.Int32. > -a function named "hbNullToInt" that recive two parameter; the first is a NHibernateUtil.Int16 or NHibernateUtil.Int32 or NHibernateUtil.Int64 (or a property...); the 2th is a constant of type NHibernateUtil.Int16 .. etc. > Heach dialect can have an overload of RegisterFunction( string hbFunctionName, dialectFunctionName ). > For the two function in the example we can have: > for Oracle9Dialect > RegisterFunction("hblenstr","length"); > RegisterFunction("hbNullToInt","nvl"); > for MsSql2000Dialect > RegisterFunction("hblenstr","length"); > for FirebirdDialect (or a specific FirebirdDialect with extended UDFs ;) ) > RegisterFunction("hblenstr","strlen"); > RegisterFunction("hbNullToInt","invl"); > Now we can write an HQL like this "from Person p where hblenstr(p.Name) > 10" and NHb can substitue "hblenstr" with apropiate dialect function (before substitution can control that the hblenstr revive de apropiate param type etc.). > This posible implementation don't have problems if an hbXYZ function have the same name of specific dialect function (i think the probability is very low but there are no problems). > The actual implementation of RegisterFunction don't need any adjustment because all continue to work. > Finally: > -If a dialect use actual implementation of RegisterFunction and a developer use this function in a HQL he can't be sure that all work fine when he need to change de hibernate.cfg.xml to change the dialect. > -If a dialect was implemented with RegisterFunction( string hbFunctionName, dialectFunctionName ) mapping and a developer use the hbXYZ function in a HQL he can have an hight probability that all work fine. > Bye. > Fabio. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |