João Henrique Freitas writes:
 > char *dbi_get_value(dbi_result *result, int row_number, unsigned int
 > column_number);
 > 
 > int dbi_bind_value(dbi_result *result, int row_number, unsigned int
 > column_number, char *value);
 > 

I'd prefer to model these functions after the existing interface. The
names are open for discussion (the f prefix means "force"), but in
terms of the functionality I thought about something like:

char* dbi_result_fget_string_copy(dbi_result Result, const char*
fieldname);
char* dbi_result_fget_string_copy_idx(dbi_result Result, unsigned int
fieldidx);
int dbi_result_fbind_string_copy(dbi_result Result, const char*
fieldname, char** bindto);

These resemble the dbi_result_get_string_copy() et al. functions. As
all values which are not strings will have to be provided in
an allocated buffer anyway, this seems the most logical approach to such
a function. Obviously, the calling function has to free the returned
buffer eventually.

In addition, I'd suggest another group of functions that retrieves
integers regardless of the storage type:

long long dbi_result_fget_longlong(dbi_result Result, const char* filename);
long long dbi_result_fget_longlong_idx(dbi_result Result, unsigned int
fieldidx);
int dbi_result_fbind_longlong(dbi_result Result, const char* fieldname,
long long* bindto);

These functions would convert and return all numerical values
(integers, floats, datetime, even strings if they happen to contain a
number) as long long integers which the calling function can cast to
whatever it needs.

Let me know if that would meet your needs.

regards,
Markus


-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users

Reply via email to