Can somebody tell me what's wrong with my code...

Can somebody tell me what's wrong with my code. I'm using sqllite and when i execute this code along other code this give me "Sqlite error: Could not prepare sql." I'm beginner in sql and i'm using libsqlite.hpp

manners cost nothing

I haven't used sqllite, but maybe it's the last comma on the vitality line

Holy shit, it actually worked

Why are you not Using an ORM? You should be doing that first.

I was writing some c++ code for my school project and they want some sql database from me. I don't even know what is ORM

...

An object mapper is a library that looks at your SQL code and the domain objects you write to hold the responses. It can automatically generate an object you can use to open the database connection and methods that run each of the queries and return your domain objects.

An object resolution mapper (ORM) just looks at your domain objects and automatically generates the database tables and sql queries. It also sets up the database connection for you and makes an object for each of the tables that you can use to run queries.

Nosql databases go one step further than that, and take the sql out of it completely, You just use classes and objects to set up every part of your database. They also have different consistency properties so be careful.

Using a mapper library, ORM, or nosql can save you from writing a lot of repetitive code. Most of your time with sql is spent just setting up the connection and turning the responses into objects. Don't listen to the other guy, you don't have to use one if you're not allowed or don't want to, but they can be kinda useful to learn.

I'll make research it sounds very helpful so i think i'll try it.

I wouldn't start off by learning ORM.
There are limits to what ORM can do and it's pretty tied to hipster trends such as the javascript frameworks.

SQL is the way to go. You'll have to learn it sooner or later.
ORM was created mostly for copy-paste programmers who want a quick solution over the quality choice.

Hey It's the overly long explanation guy again.

Don't do it now, get your assignment in first.

ORMs are good for stateful CRUD applications. Who the fuck wants to manage sql queries for basic shit?

Yea I agree it's easier to do some really inefficient shit in an ORM (getting all objects from db, iterating in your code, tallying them etc).

ORMs are available for literally just about every language. There's good reason to use them, however, knowing SQL well and the ORM means you can debug and tweak the calls to the ORM to get better or more efficient results.

source: that's pretty much what our team used to do now and then, just find inefficient ORM SQL statements and find a way to better utilize the ORM to cut down on the amount of cruft it generated per statement.

>Manually sets bind 1 to 9
You know there's this cool new feature in C++ called for loops.

I'm not experienced programmer there could be some mistakes in my code but yeah thank you i'll changed that as well

I was thinking he should define a sql variable but a loop would do nicely too.

I don't wanna be a dick, but if you don't even know what a for loop is, you should learn the essentials before you go balls deep with external libraries.

I know the essentials but implementing sql in my c++ code is hard for me and i'm trying to create something at first and then i'll start optimizing my code. It a text based rpg-game and sql is for my save and load feature in the game.

This. Not even a please

Hey it's explanation guy again.

Just had a google for a decent mapper or ORM for c++ and they all look pretty shite.

Don't bother. Write the sql.

We should update the sticky
>Sup Forums is not your personal Stack Overflow