Click here to Skip to main content
Rate this: bad
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 at 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
0 OriginalGriff 489
1 ChintanShukla 295
2 RyanDev 250
3 Richard Deeming 250
4 Sergey Alexandrovich Kryukov 218
0 Sergey Alexandrovich Kryukov 8,906
1 OriginalGriff 7,601
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,923

Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 2 Aug 2012
Copyright © CodeProject, 1999-2014
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