#pragma once

#include "sqlite3.h"
#include <nlite_common\define.h>
#include <nlite_common\raii.h>
#include <memory>
#include "namespace_start.h"


class CStatement;
class CDB:public RAIIT<CDB,sqlite3*>{
public:

	
	

public:
	
	///
	///DBオープン
	///
	Int Open(const U16String& path,Int flags,const Char *vfs = nullptr);
	
	///
	///プリペアードステートメント作成
	///
	Int Prepare(const U16String& sql,CStatement &stmt,const Void ** tail = nullptr);

	Void Dispose();



};


class CStatement:public RAIIT<CStatement,sqlite3_stmt*>{
	friend CDB;

public:

	Int Step();

	const CharU16* Column(Int no);

	Int Bind(Int no,const U16String &text,Void(*destractor)(Void*) = SQLITE_TRANSIENT);

	Void Dispose();

};



#include "namespace_end.h"