<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.3.2">
</HEAD>
<BODY>
Wouldn't it make sense to abstract the MySQL calls into ast_X functions? Then one ast_mysql_query() could test the beginning of the query and if it contains "SELECT" automatically use the read connections, else use the write connection. Additionally, logic for auto sensing DB connection failures and recovering becomes easier.<BR>
<BR>
Also, by doing this you give the ability to implement multiple load-balancing algorithms, collect stats, use a connection pools with mutexes on the connection handles - instead of global ones thus increasing concurrency. (Does not have to initially, but design it for the future...)<BR>
<BR>
It could be done using the regular MySQL API, but the code will quickly become spaghetti and really hard to track problems.<BR>
<BR>
-Joe<BR>
Thralling Penguin LLC<BR>
<BR>
<BR>
On Tue, 2006-07-11 at 17:19 +1200, Matt Riddell (IT) wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">JR Richardson wrote:</FONT>
<FONT COLOR="#000000">> Just need to bounce this off of you guys, help get my mind right………….</FONT>
<FONT COLOR="#000000"><A HREF="http://bugs.digium.com/view.php?id=5881">http://bugs.digium.com/view.php?id=5881</A></FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>