Sharing shape reading logic between client and database