Abstract
Contemporary frameworks offer essentially two methods of accessing data in relational databases. The one using plain SQL requires writing a lot of boilerplate code and storing the SQL in a string, which is error prone and denies the benefits of static query analysis. The other one enforces the use of an additional (usually object oriented) abstraction layer which incurs additional runtime costs and hinders the use of advanced SQL capabilities. In this paper we present a working implementation of a radically different approach. Our tool uses the database engine to analyze the native SQL queries prepared by the user, and generates all the necessary classes representing query responses, single result rows and database connections. The use of native queries allows to utilize advanced and highly optimized SQL features. On the other hand, the use of the generated classes ensures that data access happens in a statically checked, type-safe way.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Java Data Objects, http://db.apache.org/jdo/
Libpq — C Library, http://www.postgresql.org/docs/9.3/static/libpq.html , chapter in [3]
PostgreSQL 9.3.2 Documentation, http://www.postgresql.org/docs/9.3
PREPARE command, http://www.postgresql.org/docs/9.3/static/sql-prepare.html
Web4j java web application framework, http://www.web4j.com/Java_Web_Application_Framework.jsp
Clavel, M., Durán, F., Eker, S., Lincoln, P., Martí-Oliet, N., Meseguer, J., Talcott, C.: The maude 2.0 system. In: Nieuwenhuis, R. (ed.) RTA 2003. LNCS, vol. 2706, pp. 76–87. Springer, Heidelberg (2003)
Cook, W., Rai, S.: Safe query objects: statically typed objects as remotely executable queries. In: Proceedings of 27th International Conference on Software Engineering, ICSE 2005, pp. 97–106 (May 2005)
Date, C.: An Introduction to Database Systems. Addison-Wesley (2003)
Fowler, M.: Patterns of Enterprise Application Architecture. A Martin Fowler signature book. Addison-Wesley (2003)
Fowler, M.: Domain-Specific Languages. Addison-Wesley Signature Series (Fowler). Pearson Education (2010)
Gil, J.Y., Lenz, K.: Simple and safe SQL queries with C++ templates. In: Proceedings of the 6th International Conference on Generative Programming and Component Engineering, GPCE 2007, pp. 13–24. ACM, New York (2007)
Gould, C., Su, Z., Devanbu, P.: Static checking of dynamically generated queries in database applications. In: Proceedings of 26th International Conference on Software Engineering, ICSE 2004, pp. 645–654. IEEE (2004)
Maier, D.: Representing Database Programs As Objects. In: Advances in Database Programming Languages, pp. 377–386. ACM, New York (1990)
McClure, R., Kruger, I.: Sql dom: compile time checking of dynamic sql statements. In: Proceedings of 27th International Conference on Software Engineering, ICSE 2005, pp. 88–96 (May 2005)
Pustelnik, J., Sobieski, Ś.: Metagen — the text tool for generating sql database descriptions from ER diagrams (in polish). In: Bazy Danych - Modele, Technologie, Narzędzia, pp. 309–314. WKL Gliwice (2005)
Sobieski, S., Zieliński, B.: Using maude rewriting system to modularize and extend sql. In: Proceedings of the 28th Annual ACM Symposium on Applied Computing, SAC 2013, pp. 853–858. ACM, New York (2013)
Wegrzynowicz, P.: Performance antipatterns of one to many association in hibernate. In: 2013 Federated Conference on Computer Science and Information Systems (FedCSIS), pp. 1475–1481 (September 2013)
Wiśniewski, P., Burzańska, M., Stencel, K.: The impedance mismatch in light of the unified state model. Fundamenta Informaticae 120(3), 359–374 (2012)
Wiśniewski, P., Szumowska, A., Burzańska, M., Boniewicz, A.: Hibernate the recursive queries - defining the recursive queries using hibernate orm. In: ADBIS (2), pp. 190–199 (2011)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this paper
Cite this paper
Sysak, M., Zieliński, B., Kruszyński, P., Sobieski, Ś., Maślanka, P. (2014). Static Integration of SQL Queries in C++ Programs. In: Manolopoulos, Y., Trajcevski, G., Kon-Popovska, M. (eds) Advances in Databases and Information Systems. ADBIS 2014. Lecture Notes in Computer Science, vol 8716. Springer, Cham. https://doi.org/10.1007/978-3-319-10933-6_10
Download citation
DOI: https://doi.org/10.1007/978-3-319-10933-6_10
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-10932-9
Online ISBN: 978-3-319-10933-6
eBook Packages: Computer ScienceComputer Science (R0)