[OpenSER-Devel] SF.net SVN: openser: [3563] trunk

Henning Westerholt henning.westerholt at 1und1.de
Thu Jan 24 11:51:22 UTC 2008


On Tuesday 22 January 2008, Dan Pascu wrote:
> Henning Westerholt wrote:
> > Revision: 3563
> > [..]
> > - port database interface (almost) complete from 'const char*' to 'str'
> >   for more safety (e.g. not null terminated strings) and performance
> > (save
>
> I think that for convenience and ease of use they should be null
> terminated (in fact there is no issue with doing so considering that the
> database drivers actually returns char* and not str). This way we can
> access them as both a str or a char* depending how the code using the
> database needs them. Otherwise one needs to fake the null termination if
> they need to be accessed as a char*

Hi Dan,

yes, i've already added null-termination to the str that is used for all query 
operations, because the query function from postgres depends on this. For the 
internal API types (e.g. db_key_t) this is not necessary, because they are 
not exposed to the underlying database library.

The queries (insert, update..) uses a str, that consists of a const char* of 
length N, with a null at position N+1. 

I did not changed the datatype at the 'return' side of the database drivers, 
because they are not visible, the DB API types (columns, rows etc..) are 
returned.

Cheers,

Henning



More information about the Devel mailing list