Skip to main content

Static Integration of SQL Queries in C++ Programs

  • Conference paper
Advances in Databases and Information Systems (ADBIS 2014)

Part of the book series: Lecture Notes in Computer Science ((LNISA,volume 8716))

  • 1036 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Java Data Objects, http://db.apache.org/jdo/

  2. Libpq — C Library, http://www.postgresql.org/docs/9.3/static/libpq.html , chapter in [3]

  3. PostgreSQL 9.3.2 Documentation, http://www.postgresql.org/docs/9.3

  4. PREPARE command, http://www.postgresql.org/docs/9.3/static/sql-prepare.html

  5. Web4j java web application framework, http://www.web4j.com/Java_Web_Application_Framework.jsp

  6. 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)

    Chapter  Google Scholar 

  7. 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)

    Google Scholar 

  8. Date, C.: An Introduction to Database Systems. Addison-Wesley (2003)

    Google Scholar 

  9. Fowler, M.: Patterns of Enterprise Application Architecture. A Martin Fowler signature book. Addison-Wesley (2003)

    Google Scholar 

  10. Fowler, M.: Domain-Specific Languages. Addison-Wesley Signature Series (Fowler). Pearson Education (2010)

    Google Scholar 

  11. 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)

    Google Scholar 

  12. 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)

    Google Scholar 

  13. Maier, D.: Representing Database Programs As Objects. In: Advances in Database Programming Languages, pp. 377–386. ACM, New York (1990)

    Google Scholar 

  14. 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)

    Google Scholar 

  15. 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)

    Google Scholar 

  16. 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)

    Chapter  Google Scholar 

  17. 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)

    Google Scholar 

  18. 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)

    MATH  MathSciNet  Google Scholar 

  19. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics