While you are free to connect to MySQL yourself and use PHP's vanilla MySQL extensions, BigTree bootstraps its own connection to MySQL through use of SQL Wrappers. These provide several benefits:
- They are agnostic so that in the event that other SQL servers are supported it's as simple as including a separate set of wrappers and having your code work.
- They automatically detect whether the query you're executing is a write or read and route to the correct database (when load balancing).
- They automatically log queries and errors when you have $bigtree["config"]["debug"] enabled.
The SQL wrappers are:
- sqlquery — The equivalent of mysqli_query or mysql_query
- sqlfetch — The equivalent of mysqli_fetch_assoc or mysql_fetch_assoc
- sqlrows — The equivalent of mysqli_num_rows or mysql_num_rows
- sqlid — The equivalent of mysqli_insert_id or mysql_insert_id
- sqlescape — The equivalent of mysqli_real_escape_string or mysql_real_escape_string
All of BigTree's core code uses these wrappers and it is encouraged, but not required, that they are used.