Giter Club home page Giter Club logo

sqlpp11-connector-stl's Introduction

sqlpp11-connector-stl

An experimental SQL connector for containers and streams of the C++ Standard Library

Motivation:

Well, sqlpp11 has this wonderful expression tree. It makes it really easy to connect to databases. And you know what? You can even treat containers or streams from the C++ Standard Library as databases! How cool is that?

namespace sql = sqlpp::container;

struct sample
{
	int64_t alpha;
	std::string beta;
	bool gamma;
};

int main()
{
	using container = std::vector<sample>;
	container data;

	sql::connection<container> db(data);
	sample tab;

	db.run(insert_into(tab).set(tab.alpha = 17));
	db.run(insert_into(tab).set(tab.beta = "cheesecake"));
	db.run(insert_into(tab).set(tab.alpha = 42, tab.beta = "hello", tab.gamma = true));
	db.run(insert_into(tab).set(tab.gamma = true));

	for (const sample& row: db.run(select(all_of(tab(tab))
	                                 .from(tab)
	                                 .where(tab.alpha < 18)))
	{
		std::cerr << "alpha=" << row.alpha << 
		           ", beta=" << row.beta << 
		           ", gamma=" << row.gamma << std::endl;
	}

	return 0;
}

That works???

Oh yes! Check it out. You need:

Stay tuned for more :-)

sqlpp11-connector-stl's People

Contributors

markwright avatar nixman avatar rbock avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.