Architecture of plugins in piwik

i want to know flow of code from view to database in plugins.in which file they are calling the database calls in plugins.