On Sun, 07 Nov 2010 16:56:16 -0800, Darren Duncan
<[email protected]>
wrote:
> Arthur, I don't know if this would be useful in your situation, but Rudy
> Lippan
> is working to make a Perl 5 DBI driver to MongoDB. Since your
challenges
> are
> related he might know something that could help. -- Darren Duncan
>
I just got Tim's OK on the prefix today... ask me in a week ;-)
> ARTHUR WOLF wrote:
>> Hello list !
>>
...
>> So I end up with the following code ( C ) :
>>
>> mongo_connection_options * make_mongo_connection_options( char
host[255],
>> int port ){
>> mongo_connection_options *opts =
>> malloc(sizeof(mongo_connection_options));
>> strcpy( opts->host , host );
^^^^^^
I can't speak to the Perl 6 stuff, but if you are not getting a null
terminated string (or
one that is too long) from Perl, the strcpy(2) could cause a segfault.
Either way, you might
want to replace that with a strncpy(2).
There were a few things that bothered me about the C driver, but I can't
remember what they
were right now. It might have been that the C driver is "a very basic
MongoDB c driver" and
"is an alpha release", and nothing more. You might also want to take a
look at the MongoDB
driver as a reference.
-r