Click here to Skip to main content
12,552,801 members (60,115 online)
Rate this:
Please Sign up or sign in to vote.
See more: C MySQL
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 | Mobile
Web02 | 2.8.161021.1 | Last Updated 2 Aug 2012
Copyright © CodeProject, 1999-2016
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