replaced read and search functions from datastore.php to sql