May 06, 2013 Re: HibernateD and DDBC - ORM and DB abstraction layer for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to David | On Monday, 29 April 2013 at 09:38:10 UTC, David wrote: > Null blows up your code, "" doesn't. There's no difference between null and empty string in D. > Also it's a SQL thing, "NotNull" > must be initialized, when the row is filled. Full SQL support is good to have. I question the decision to make it default. |
May 07, 2013 Re: HibernateD and DDBC - ORM and DB abstraction layer for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Monday, 6 May 2013 at 09:14:57 UTC, Kagamin wrote:
> On Monday, 29 April 2013 at 09:38:10 UTC, David wrote:
>> Null blows up your code, "" doesn't.
>
> There's no difference between null and empty string in D.
>
>> Also it's a SQL thing, "NotNull"
>> must be initialized, when the row is filled.
>
> Full SQL support is good to have. I question the decision to make it default.
Current implementation looks consistent:
D type -- SQL type
int -- INT NOT NULL
Int -- INT NULL
long -- BIGINT NOT NULL
Long -- BIGINT NULL
string -- VARCHAR(255) NOT NULL
String -- VARCHAR(255) NULL
Uppercase types are nullable.
@NotNull/@Null annotations are not required. Nullability can be inferred from type name.
|
May 21, 2013 Re: HibernateD and DDBC - ORM and DB abstraction layer for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Mon, 06 May 2013 11:14:56 +0200
"Kagamin" <spam@here.lot> wrote:
> On Monday, 29 April 2013 at 09:38:10 UTC, David wrote:
> > Null blows up your code, "" doesn't.
>
> There's no difference between null and empty string in D.
>
That's not true:
assert("" !is null); // Passes
Or did I misunderstand what you meant?
|
May 22, 2013 Re: HibernateD and DDBC - ORM and DB abstraction layer for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Tuesday, 21 May 2013 at 22:24:06 UTC, Nick Sabalausky wrote:
> On Mon, 06 May 2013 11:14:56 +0200
> "Kagamin" <spam@here.lot> wrote:
>
>> On Monday, 29 April 2013 at 09:38:10 UTC, David wrote:
>> > Null blows up your code, "" doesn't.
>>
>> There's no difference between null and empty string in D.
>>
>
> That's not true:
>
> assert("" !is null); // Passes
>
> Or did I misunderstand what you meant?
Strings are slices which are a pointer and a length. I think a slice compares equal to null only if the pointer part is null. However, a slice with a null pointer and a length of zero is still a valid empty slice, which is slightly odd behaviour compared to other languages...
An empty string literal initialises the pointer to non-null because string literals are null terminated, so the memory block actually has a length of one, even though the slice has length zero.
|
May 22, 2013 Re: HibernateD and DDBC - ORM and DB abstraction layer for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Diggory | On Wed, 22 May 2013 02:10:52 +0200
"Diggory" <diggsey@googlemail.com> wrote:
> On Tuesday, 21 May 2013 at 22:24:06 UTC, Nick Sabalausky wrote:
> > On Mon, 06 May 2013 11:14:56 +0200
> > "Kagamin" <spam@here.lot> wrote:
> >
> >> On Monday, 29 April 2013 at 09:38:10 UTC, David wrote:
> >> > Null blows up your code, "" doesn't.
> >>
> >> There's no difference between null and empty string in D.
> >>
> >
> > That's not true:
> >
> > assert("" !is null); // Passes
> >
> > Or did I misunderstand what you meant?
>
> Strings are slices which are a pointer and a length. I think a slice compares equal to null only if the pointer part is null. However, a slice with a null pointer and a length of zero is still a valid empty slice, which is slightly odd behaviour compared to other languages...
>
> An empty string literal initialises the pointer to non-null because string literals are null terminated, so the memory block actually has a length of one, even though the slice has length zero.
Right, exactly. In other words, there *is* a difference between null and empty string in D (even though it's sometimes a clouded issue since '==' counts them as equal).
|
June 19, 2013 Re: HibernateD and DDBC - ORM and DB abstraction layer for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vadim Lopatin | New version: v0.2.9 Fixed HQL parser bug with underscores in field and table names Fixed compilation error with undefined identifiers in metadata.d Merged pull request to use standard mysql-native library |
June 25, 2013 Re: HibernateD and DDBC - ORM and DB abstraction layer for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Wednesday, 22 May 2013 at 00:19:04 UTC, Nick Sabalausky wrote:
> Right, exactly. In other words, there *is* a difference between null and
> empty string in D (even though it's sometimes a clouded issue since
> '==' counts them as equal).
I meant there's no difference between them in meaningful scenarios (where empty string and null behave the same). Your example is synthetic (its also unclear wheter you compare strings or void*'s). I wouldn't expect this behavior to be reliable as D doesn't need distinction between null and empty string.
|
June 25, 2013 Re: HibernateD and DDBC - ORM and DB abstraction layer for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Wednesday, 22 May 2013 at 00:19:04 UTC, Nick Sabalausky wrote:
> Right, exactly. In other words, there *is* a difference between null and
> empty string in D (even though it's sometimes a clouded issue since
> '==' counts them as equal).
== compare value, is compare identity. Everything is fine on that one.
|
Copyright © 1999-2021 by the D Language Foundation