Frustration [Was: mysql binding/wrapper?]

Ary Manzana ary at esperanto.org.ar
Mon Apr 30 19:04:01 PDT 2012


On 5/1/12 2:44 AM, simendsjo wrote:
> On Mon, 30 Apr 2012 20:55:45 +0200, Ary Manzana <ary at esperanto.org.ar>
> wrote:
>> Looking at the code of mysql.d I see a big switch with many cases like
>> "case 0x01: // TINYINT". But then there's the SQLType enum with those
>> constants. Why the enum values are not used in the cases? (and also in
>> other parts of the code?)
>
> It's not finished: http://www.britseyeview.com/software/mysqln/

Ah, I see.

The last commit is 6 months old.

I tried to compile mysql.d

---
 > dmd -c mysql.d
/usr/share/dmd/src/phobos/std/exception.d(492): Error: constructor 
mysql.MySQLException.this (string msg, string file, uint line) is not 
callable using argument types (string,string,ulong)
/usr/share/dmd/src/phobos/std/exception.d(492): Error: cannot implicitly 
convert expression (line) of type ulong to uint
mysql.d(105): Error: template instance 
std.exception.enforceEx!(MySQLException).enforceEx!(ulong) error 
instantiating
(...)
(and more...)
---

It's sad. I always want to give D a chance. And when I do I always bump 
into errors and inconveniences.

I thought, maybe the project is 6 months old, it's not compatible 
anymore with the current DMD (but my code really doesn't break at all 
with new Ruby versions, for example). I thought of trying to fix the 
error. Apparently I need to compile it with -m32 so that lengths of 
arrays are uint instead of ulong.

---
 > dmd -c -m32 mysql.d
mysql.d(4185): Error: cannot cast r.opIndex(cast(uint)j).get!(ulong)
mysql.d(4201): Error: cannot cast r.opIndex(cast(uint)j).get!(ulong)
mysql.d(4204): Error: cannot cast r.opIndex(cast(uint)j).get!(ulong)
---

(What does it mean "cannot cast"? Give me the reason, please...)

Or maybe instead of the flag the code is wrong and instead of uint it 
needs to be size_t. But I still get errors.

Every time I want to start coding in D, or helping some project, I 
stumble into all kind of troubles.

But I wonder... is this case in particular D's fault or the library's 
fault? (if the answer is "the project is 6 months old, of course it 
won't compile" then it's D's fault)


More information about the Digitalmars-d-learn mailing list