Quoting Alex Dubov <[EMAIL PROTECTED]>:
from here everything works just like with
printf - if you push pointer incompatible to
specifier, it's most likely a crash.
Ah, right. I think I'm starting to understand this now - I thought we
were going to end up with a bunch of backend specific stuff (which I
don't like much :-), but it doesn't have to be that way.
So, it seems that we need to define, on DBD level, what identifiers
mean. They have to convey both the meaning in C and SQL, because
drivers needs hints on how to map C types to SQL types in _prepare.
Getting the stuff once the select is done is easier, but we should
probably stick with the same letters, to make it easier for callers.
We already have:
- %s - string (i.e. char *, varchar in SQL)
- %d - integer
- %f - float
I think we should stick with a single letter convention, for
simplicity of parsing. So, how about:
- %S - string (i.e. char *, text in SQL)
- %D - unsigned integer
- %c - char
- %C - unsigned char
- %h - short
- %H - unsigned short
- %l - long
- %L - unsigned long
- %q - quad (i.e. long long)
- %Q - unsigned quad
- %F - double
- %b - blob (brigade, backend specific blob type 1 in SQL*)
- %B - blob (brigade, backend specific blob type 2 in SQL*)
- %o - blob (brigade, backend specific blob type 3 in SQL*)
- %O - blob (brigade, backend specific blob type 4 in SQL*)
- %i - time (string, time in SQL)
- %a - date (string, date in SQL)
- %A - datetime (string, datetime in SQL)
- %t - timestamp (string, timestamp in SQL)
- %T - timestamp with zone (string, timestamp with zone in SQL)
I'm sure there are many more combos that we can consider, but these
should be a decent start.
Let the flame wars begin... ;-)
* Blob types vary between backends a lot (e.g. MySQL has four types,
Oracle at least 3 and so on). We should pick a few we'd like to
implement in each.
--
Bojan