Click here to Skip to main content
13,148,889 members (54,929 online)
Rate this:
Please Sign up or sign in to vote.
See more:
MySql version: 5.1.62
OS: Gentoo Linux

In mysql-5.1.62\mysql-5.1.62\sql-common\client.c, at line 1889

mysql->methods = &client_methods;

It set MYSQL* methods funtion pointer address to static MYSQL_METHODS client_methods array.

My question is why not initialized it in mysql_init just like OOP`s construct.
Posted 1-Aug-12 21:40pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Actually it is initialized (to 0) in mysql_init.
Why do you prefer 'an earlier' link to the static struct?
Xiang Zhai 2-Aug-12 21:28pm
Thank CPanllini, it might be MYSQL mysql static struct object, then mysql_init(&mysql), it is bad 'an earlier' link to static mysql struct object;

But in my situation, MYSQL* mysql = mysql_init(NULL); it my_malloc mysql pointer object, it is suitable to set the funtion pointer address.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170924.2 | Last Updated 2 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100