Обсуждение: What is Dialect

Поиск
Список
Период
Сортировка

What is Dialect

От
Adarsh Sharma
Дата:
Dear all,

I am reading about Dialects of different databases. Yet I can't
understand what is the need of dialect in Postgres or any other like
Hibernate uses Dialect of all Databases for ORM.
What is it &
How can we create our own Dialect ?

Thanks in Advance
Adarsh Sharma

Re: What is Dialect

От
Mike Christensen
Дата:
If I understand your question correctly, a Dialect is an abstraction
layer that allows Hibernate to talk with different database backends
(MySQL, PG, Oracle, SQLServer, etc).  Since different databases have
different syntaxes, various features, etc.  This seems more of a
Hibernate question though, unless there's a "Dialect" feature in PG
that I'm unaware of.

On Sun, Nov 21, 2010 at 11:32 PM, Adarsh Sharma
<adarsh.sharma@orkash.com> wrote:
> Dear all,
>
> I am reading about Dialects of different databases. Yet I can't understand
> what is the need of dialect in Postgres or any other like Hibernate uses
> Dialect of all Databases for ORM.
> What is it &
> How can we create our own Dialect ?
>
> Thanks in Advance
> Adarsh Sharma
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

Re: What is Dialect

От
Andreas
Дата:
Am 22.11.2010 08:32, schrieb Adarsh Sharma:
> I am reading about Dialects of different databases. Yet I can't
> understand what is the need of dialect in Postgres or any other like
> Hibernate uses Dialect of all Databases for ORM.
> What is it &


As far as I know, the term dialect is used to express the fact that each
DBMS has it's own implementation of SQL though they have a lot that
works the same.
Like you might find that most of PG's commands work similar to say
Oracle but there are still differences.
Or Postgresql has "serials" while MySQL has "autoincrement" (not sure)
and MS-Access has "AutoValue" or however it might be in english. Thats 3
times a different name for basically the same thing.

That's what I understood as dialect in the realm of IT systems.
Maybe Hibernate uses just a certain subset of commands that is proven to
work the same in every "dialect". This has the benefit that there is no
special Hibernate for every DBMS but on the otherhand it omits
advantages of individual DBMS which are not to be found in other DBMS'
"dialects" of SQL.


> How can we create our own Dialect ?

You don't.
They happen.


Re: What is Dialect

От
Mike Christensen
Дата:
On Mon, Nov 22, 2010 at 12:26 AM, Andreas <maps.on@gmx.net> wrote:
> Am 22.11.2010 08:32, schrieb Adarsh Sharma:
>>
>> I am reading about Dialects of different databases. Yet I can't understand
>> what is the need of dialect in Postgres or any other like Hibernate uses
>> Dialect of all Databases for ORM.
>> What is it &
>
>
> As far as I know, the term dialect is used to express the fact that each
> DBMS has it's own implementation of SQL though they have a lot that works
> the same.
> Like you might find that most of PG's commands work similar to say Oracle
> but there are still differences.
> Or Postgresql has "serials" while MySQL has "autoincrement" (not sure) and
> MS-Access has "AutoValue" or however it might be in english. Thats 3 times a
> different name for basically the same thing.
>
> That's what I understood as dialect in the realm of IT systems.
> Maybe Hibernate uses just a certain subset of commands that is proven to
> work the same in every "dialect". This has the benefit that there is no
> special Hibernate for every DBMS but on the otherhand it omits advantages of
> individual DBMS which are not to be found in other DBMS' "dialects" of SQL.
>
>
>> How can we create our own Dialect ?
>
> You don't.
> They happen.

Well in Hibernate, you /could/ create your own Dialect if you wanted
to (it's an abstract base class) but they already have them
implemented for most any DBMS you can think of these days.  It's more
common you'd override something in the dialect class that you want to
work differently.

Re: What is Dialect

От
Craig Ringer
Дата:
On 11/22/2010 03:32 PM, Adarsh Sharma wrote:
> Dear all,
>
> I am reading about Dialects of different databases. Yet I can't
> understand what is the need of dialect in Postgres or any other like
> Hibernate uses Dialect of all Databases for ORM.
> What is it &
> How can we create our own Dialect ?

If you have to ask that question, you probably shouldn't do it. Seriously.

Perhaps you can explain *why* you want to make a new dialect in a bit
more detail? What you are trying to achieve? Most things you might want
to do via the dialect are better done with a UserType or by fixing your
schema.

BTW, there is already a PostgreSQL dialect in Hibernate. It's
automatically selected when Hibernate is used with PostgreSQL.

--
Craig Ringer