note 71351 added to function.mysqli-rpl-probe

From: Date: Thu, 23 Nov 2006 15:54:46 +0000
Subject: note 71351 added to function.mysqli-rpl-probe
Groups: php.notes 
Request: Send a blank email to php-notes+get-120027@lists.php.net to get a copy of this message
my_bool STDCALL mysql_rpl_probe(MYSQL* mysql) { MYSQL_RES *res= 0; MYSQL_ROW row; my_bool error= 1; DBUG_ENTER("mysql_rpl_probe"); /* First determine the replication role of the server we connected to the most reliable way to do this is to run SHOW SLAVE STATUS and see if we have a non-empty master host. This is still not fool-proof - it is not a sin to have a master that has a dormant slave thread with a non-empty master host. However, it is more reliable to check for empty master than whether the slave thread is actually running */ if (mysql_query(mysql, "SHOW SLAVE STATUS") || !(res = mysql_store_result(mysql))) { expand_error(mysql, CR_PROBE_SLAVE_STATUS); DBUG_RETURN(1); } row= mysql_fetch_row(res); /* Check master host for emptiness/NULL For MySQL 4.0 it's enough to check for row[0] */ if (row && row[0] && *(row[0])) { /* this is a slave, ask it for the master */ if (get_master(mysql, res, row) || get_slaves_from_master(mysql)) goto err; } else { mysql->master = mysql; if (get_slaves_from_master(mysql)) goto err; } error = 0; err: if (res) mysql_free_result(res); DBUG_RETURN(error); } ---- Server IP: 217.174.203.10 Probable Submitter: 81.93.12.188 ---- Manual Page -- http://www.php.net/manual/en/function.mysqli-rpl-probe.php Edit -- https://master.php.net/note/edit/71351 Del: integrated -- https://master.php.net/note/delete/71351/integrated Del: useless -- https://master.php.net/note/delete/71351/useless Del: bad code -- https://master.php.net/note/delete/71351/bad+code Del: spam -- https://master.php.net/note/delete/71351/spam Del: non-english -- https://master.php.net/note/delete/71351/non-english Del: in docs -- https://master.php.net/note/delete/71351/in+docs Del: other reasons-- https://master.php.net/note/delete/71351 Reject -- https://master.php.net/note/reject/71351 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120027) next »