Remove beast's sqdb module.

Conflicts:
	src/beast/beast/module/sqdb/api/backend.h
	src/beast/beast/module/sqdb/api/blob.h
	src/beast/beast/module/sqdb/api/into.h
	src/beast/beast/module/sqdb/api/session.h
	src/beast/beast/module/sqdb/api/statement.h
	src/beast/beast/module/sqdb/api/transaction.h
	src/beast/beast/module/sqdb/api/type_conversion_traits.h
	src/beast/beast/module/sqdb/api/use.h
	src/beast/beast/module/sqdb/detail/error_codes.h
	src/beast/beast/module/sqdb/detail/exchange_traits.h
	src/beast/beast/module/sqdb/detail/into_type.h
	src/beast/beast/module/sqdb/detail/once_temp_type.h
	src/beast/beast/module/sqdb/detail/prepare_temp_type.h
	src/beast/beast/module/sqdb/detail/ref_counted_prepare_info.h
	src/beast/beast/module/sqdb/detail/ref_counted_statement.h
	src/beast/beast/module/sqdb/detail/statement_imp.h
	src/beast/beast/module/sqdb/detail/type_conversion.h
	src/beast/beast/module/sqdb/detail/type_ptr.h
	src/beast/beast/module/sqdb/detail/use_type.h
	src/beast/beast/module/sqdb/sqdb.h
This commit is contained in:
seelabs
2015-02-03 06:56:34 -08:00
committed by Vinnie Falco
parent 44932b170f
commit 4a47ba9b35
38 changed files with 0 additions and 166395 deletions

View File

@@ -1,115 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_API_BACKEND_H_INCLUDED
#define BEAST_MODULE_SQDB_API_BACKEND_H_INCLUDED
#include <cstdint>
namespace beast {
namespace sqdb {
namespace detail {
//signed char
//wchar_t
// supported standard types for intos and uses
enum exchange_type
{
x_null, // only for input variables
x_bool,
x_char, x_uchar,
x_short, x_ushort,
x_int, x_uint,
x_long, x_ulong,
x_longlong, x_ulonglong,
x_float, x_double, x_longdouble,
x_cstring, // null terminated char*, only valid for use_type
x_cwstring, // null terminated wchar*, only valid for use_type
x_stdstring,
x_stdwstring,
x_beastString,
x_stdtm,
x_blob
};
} // detail
// the enum type for indicator variables
enum indicator
{
i_ok,
i_null,
i_truncated
};
// sqlite row id
//typedef sqlite3_int64 rowid;
typedef std::int64_t rowid;
} // sqdb
} // beast
#endif

View File

@@ -1,92 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_API_BLOB_H_INCLUDED
#define BEAST_MODULE_SQDB_API_BLOB_H_INCLUDED
namespace beast {
namespace sqdb {
// BLOB interface
class blob
{
public:
blob();
~blob();
Error select(session& s,
char const* zTable,
char const* zColumn,
rowid id,
bool readAndWrite = false) noexcept;
int get_len();
Error read(int offset, void* buf, int toRead);
Error write(int offset, void const* buf, int toWrite);
void close();
private:
session* m_session;
sqlite3_blob* m_blob;
};
} // sqdb
} // beast
#endif

View File

@@ -1,83 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_API_INTO_H_INCLUDED
#define BEAST_MODULE_SQDB_API_INTO_H_INCLUDED
namespace beast {
namespace sqdb {
template<typename T>
detail::into_type_ptr into(T& t)
{
return detail::do_into(t,
typename detail::exchange_traits<T>::type_family());
}
template<typename T>
detail::into_type_ptr into(T& t, indicator& ind)
{
return detail::do_into(t, ind,
typename detail::exchange_traits<T>::type_family());
}
} // sqdb
} // beast
#endif

View File

@@ -1,151 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_API_SESSION_H_INCLUDED
#define BEAST_MODULE_SQDB_API_SESSION_H_INCLUDED
#include <beast/smart_ptr/SharedPtr.h>
namespace beast {
namespace sqdb {
/*============================================================================*/
/**
@brief A session for the embedded database.
@ingroup vf_db
*/
class session
{
public:
session();
~session();
// DEPRECATED!
// opens the deferred clone
explicit session(session const& deferredClone);
Error clone();
/**
Open a database.
The database at the specified path is opened. The connection string is
a set of "{key}={value}" pairs separated with the pipe symbol ('|').
Choices for key and value are:
@code
timeout = (number) || "infinite"
mode = "read" || "write" || "create"
cache = "shared" || "private"
threads = "single" || "multi"
@endcode
*/
Error open(String fileName,
std::string options = "timeout=infinite|mode=create|threads=multi");
void close();
void begin();
Error commit();
void rollback();
bool in_transaction()
{
return m_bInTransaction;
}
detail::once_type once(Error& error);
detail::prepare_type prepare;
rowid last_insert_rowid();
std::ostringstream& get_query_stream();
void log_query(std::string const& query);
void set_got_data(bool bGotData);
bool got_data() const;
sqlite3* get_connection()
{
return m_connection;
}
private:
Error hard_exec(std::string const& query);
private:
bool m_bInTransaction;
sqlite3* m_connection;
String m_fileName;
std::string m_connectString;
std::ostringstream m_query_stream;
bool m_bGotData;
};
} // sqdb
} // beast
#endif

View File

@@ -1,106 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_API_STATEMENT_H_INCLUDED
#define BEAST_MODULE_SQDB_API_STATEMENT_H_INCLUDED
#include <memory>
namespace beast {
namespace sqdb {
//
// Lightweight copyable handle to a statement. This
// is just a wrapper around the actual statement implementation.
//
class statement
{
public:
statement(session& s);
statement(detail::prepare_temp_type const& prep);
~statement();
statement(statement const& o);
void operator= (statement const& o);
void exchange(detail::into_type_ptr const& i);
void exchange(detail::use_type_ptr const& u);
void prepare(std::string const& query, bool bRepeatable = true);
Error execute();
bool execute_and_fetch(Error& error);
bool fetch(Error& error);
bool got_data() const;
rowid last_insert_rowid();
private:
friend class detail::ref_counted_statement;
void clean_up();
private:
std::shared_ptr <detail::statement_imp> m_imp;
};
} // sqdb
} // beast
#endif

View File

@@ -1,85 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_API_TRANSACTION_H_INCLUDED
#define BEAST_MODULE_SQDB_API_TRANSACTION_H_INCLUDED
#include <beast/utility/Error.h>
namespace beast {
namespace sqdb {
class transaction
{
public:
explicit transaction(session& s);
~transaction();
transaction& operator= (transaction const&) = delete;
Error commit();
void rollback();
private:
session& m_session;
bool m_bHandled;
};
} // sqdb
} // beast
#endif

View File

@@ -1,120 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_API_TYPE_CONVERSION_TRAITS_H_INCLUDED
#define BEAST_MODULE_SQDB_API_TYPE_CONVERSION_TRAITS_H_INCLUDED
#include <beast/module/core/time/Time.h>
#include <cassert>
namespace beast {
namespace sqdb {
// default conversion (copy in to out)
template<typename T>
struct type_conversion
{
typedef T base_type;
static void from_base(base_type const& in, indicator ind, T& out)
{
// null not allowed
assert (ind != i_null);
out = in;
}
static void to_base(T const& in, base_type& out, indicator& ind)
{
out = in;
ind = i_ok;
}
};
// Time
template <>
struct type_conversion <Time>
{
//typedef sqlite3_int64 base_type;
typedef std::int64_t base_type;
static void from_base(const base_type v, indicator ind, Time& result)
{
if (ind == i_null)
{
// bassertfalse
result = Time(0);
}
else
{
result = Time(v);
}
}
static void to_base(const Time& v, base_type& result, indicator& ind)
{
result = v.toMilliseconds();
ind = i_ok;
}
};
} // sqdb
} // beast
#endif

View File

@@ -1,95 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_API_USE_H_INCLUDED
#define BEAST_MODULE_SQDB_API_USE_H_INCLUDED
namespace beast {
namespace sqdb {
inline detail::use_type_ptr use_null()
{
return detail::do_use_null();
}
template <typename T>
detail::use_type_ptr use(T& t)
{
return detail::do_use(t,
typename detail::exchange_traits<T>::type_family());
}
template <typename T>
detail::use_type_ptr use(T const& t)
{
return detail::do_use(t,
typename detail::exchange_traits<T>::type_family());
}
template <typename T>
detail::use_type_ptr use(T& t, indicator& ind)
{
return detail::do_use(t, ind,
typename detail::exchange_traits<T>::type_family());
}
} // sqdb
} // beast
#endif

View File

@@ -1,75 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_ERROR_CODES_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_ERROR_CODES_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
// Converts SQLITE error codes into an Error object
extern const Error sqliteError(const char* sourceFileName,
int lineNumber,
int sqliteErrorCode);
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,247 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_EXCHANGE_TRAITS_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_EXCHANGE_TRAITS_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
struct basic_type_tag {};
struct user_type_tag {};
// converts a type to exchange_type
template<typename T>
struct exchange_traits
{
typedef user_type_tag type_family;
enum
{
x_type = exchange_traits<typename type_conversion<T>::base_type>::x_type
};
};
template <>
struct exchange_traits <bool>
{
typedef basic_type_tag type_family;
enum { x_type = x_bool };
};
template <>
struct exchange_traits <char>
{
typedef basic_type_tag type_family;
enum { x_type = x_char };
};
template <>
struct exchange_traits <unsigned char>
{
typedef basic_type_tag type_family;
enum { x_type = x_uchar };
};
template <>
struct exchange_traits <short>
{
typedef basic_type_tag type_family;
enum { x_type = x_short };
};
template <>
struct exchange_traits <unsigned short>
{
typedef basic_type_tag type_family;
enum { x_type = x_ushort };
};
template <>
struct exchange_traits <int>
{
typedef basic_type_tag type_family;
enum { x_type = x_int };
};
template <>
struct exchange_traits <unsigned int>
{
typedef basic_type_tag type_family;
enum { x_type = x_uint };
};
template <>
struct exchange_traits <long>
{
typedef basic_type_tag type_family;
enum { x_type = x_long };
};
template <>
struct exchange_traits <unsigned long>
{
typedef basic_type_tag type_family;
enum { x_type = x_ulong };
};
template <>
struct exchange_traits <long long>
{
typedef basic_type_tag type_family;
enum { x_type = x_longlong };
};
template <>
struct exchange_traits <unsigned long long>
{
typedef basic_type_tag type_family;
enum { x_type = x_ulonglong };
};
template <>
struct exchange_traits <float>
{
typedef basic_type_tag type_family;
enum { x_type = x_float};
};
template <>
struct exchange_traits <double>
{
typedef basic_type_tag type_family;
enum { x_type = x_double };
};
template <>
struct exchange_traits <long double>
{
typedef basic_type_tag type_family;
enum { x_type = x_longdouble };
};
template<>
struct exchange_traits<char*>
{
typedef basic_type_tag type_family;
enum { x_type = x_cstring };
};
template<>
struct exchange_traits<char const*>
{
typedef basic_type_tag type_family;
enum { x_type = x_cstring };
};
template<>
struct exchange_traits<wchar_t*>
{
typedef basic_type_tag type_family;
enum { x_type = x_cwstring };
};
template<>
struct exchange_traits<wchar_t const*>
{
typedef basic_type_tag type_family;
enum { x_type = x_cwstring };
};
template<>
struct exchange_traits<std::string>
{
typedef basic_type_tag type_family;
enum { x_type = x_stdstring };
};
template<>
struct exchange_traits<std::wstring>
{
typedef basic_type_tag type_family;
enum { x_type = x_stdwstring };
};
template<>
struct exchange_traits<String>
{
typedef basic_type_tag type_family;
enum { x_type = x_beastString };
};
template<>
struct exchange_traits<std::tm>
{
typedef basic_type_tag type_family;
enum { x_type = x_stdtm };
};
template<>
struct exchange_traits<blob>
{
typedef basic_type_tag type_family;
enum { x_type = x_blob };
};
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,129 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_INTO_TYPE_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_INTO_TYPE_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
// base class for defining output data
class into_type_base
{
public:
virtual ~into_type_base() {}
virtual void bind(statement_imp& st, int& iCol) = 0;
virtual void do_into() = 0;
};
typedef type_ptr<into_type_base> into_type_ptr;
// standard output types
class standard_into_type : public into_type_base
{
public:
standard_into_type(void* data, exchange_type type)
: m_data(data), m_type(type), m_ind(0) {}
standard_into_type(void* data, exchange_type type, indicator& ind)
: m_data(data), m_type(type), m_ind(&ind) {}
virtual ~standard_into_type();
virtual void bind(statement_imp& st, int& iCol);
virtual void do_into();
private:
virtual void convert_from_base() {}
private:
void* m_data;
exchange_type m_type;
indicator* m_ind;
statement_imp* m_st;
int m_iCol;
};
// implementation for built-in types without conversions
template<typename T>
class into_type : public standard_into_type
{
public:
into_type(T& t) : standard_into_type(&t,
static_cast <exchange_type>(exchange_traits<T>::x_type)) {}
into_type(T& t, indicator& ind) : standard_into_type(&t,
static_cast<exchange_type>(exchange_traits<T>::x_type), ind) {}
};
template<typename T>
into_type_ptr do_into(T& t, basic_type_tag)
{
return into_type_ptr(new into_type<T>(t));
}
template<typename T>
into_type_ptr do_into(T& t, indicator& ind, basic_type_tag)
{
return into_type_ptr(new into_type<T>(t, ind));
}
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,114 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_ONCE_TEMP_TYPE_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_ONCE_TEMP_TYPE_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
class once_temp_type
{
public:
once_temp_type(session& s, Error& error);
once_temp_type(once_temp_type const& o);
once_temp_type& operator=(once_temp_type const& o);
~once_temp_type();
once_temp_type& operator, (into_type_ptr const& i);
once_temp_type& operator, (use_type_ptr const& u);
template<typename T>
once_temp_type& operator<<(T const& t)
{
m_rcst->accumulate(t);
return *this;
}
private:
ref_counted_statement* m_rcst;
};
class once_type
{
public:
once_type(const once_type& other);
once_type(session* s, Error& error);
template<typename T>
once_temp_type operator<<(T const& t)
{
once_temp_type o(m_session, m_error);
o << t;
return o;
}
private:
once_type& operator= (const once_type&);
session& m_session;
Error& m_error;
};
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,117 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_PREPARE_TEMP_TYPE_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_PREPARE_TEMP_TYPE_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
// lightweight copyable wrapper around the prepare info
class prepare_temp_type
{
public:
prepare_temp_type(session& s);
prepare_temp_type(prepare_temp_type const& o);
prepare_temp_type& operator=(prepare_temp_type const& o);
~prepare_temp_type();
template<typename T>
prepare_temp_type& operator<<(T const& t)
{
m_rcpi->accumulate(t);
return *this;
}
prepare_temp_type& operator, (into_type_ptr const& i);
prepare_temp_type& operator, (use_type_ptr const& u);
ref_counted_prepare_info& get_prepare_info() const
{
return *m_rcpi;
}
private:
ref_counted_prepare_info* m_rcpi;
};
class prepare_type
{
public:
prepare_type() : m_session(NULL) {}
prepare_type(session* s) : m_session(s) {}
template<typename T> prepare_temp_type operator<<(T const& t)
{
prepare_temp_type p(*m_session);
p << t;
return p;
}
private:
session* m_session;
};
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,89 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_REF_COUNTED_PREPARE_INFO_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_REF_COUNTED_PREPARE_INFO_H_INCLUDED
#include <vector>
namespace beast {
namespace sqdb {
namespace detail {
// helper that collects statement text and bindings to create the statement
class ref_counted_prepare_info : public ref_counted_statement_base
{
public:
ref_counted_prepare_info(session& s);
void exchange(into_type_ptr const& i);
void exchange(use_type_ptr const& u);
virtual void final_action();
public:
std::string get_query() const;
std::vector <into_type_base*> m_intos;
std::vector <use_type_base*> m_uses;
};
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,117 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_REF_COUNTED_STATEMENT_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_REF_COUNTED_STATEMENT_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
// used for "once" and "prepare"
class ref_counted_statement_base
{
public:
ref_counted_statement_base(session& s);
virtual ~ref_counted_statement_base();
virtual void final_action() = 0;
void addref();
void release();
template<typename T> void accumulate(T const& t)
{
get_query_stream() << t;
}
public:
ref_counted_statement_base (
ref_counted_statement_base const&) = delete;
ref_counted_statement_base& operator= (
ref_counted_statement_base const&) = delete;
// break circular header dependency
std::ostringstream& get_query_stream();
Error* m_perror;
int m_refs;
session& m_session;
};
// used for "once"
class ref_counted_statement : public ref_counted_statement_base
{
public:
ref_counted_statement(session& s, Error& error);
void exchange(into_type_ptr const& i);
void exchange(use_type_ptr const& u);
void final_action();
private:
Error& m_error;
statement m_st;
};
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,113 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_STATEMENT_IMP_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_STATEMENT_IMP_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
// statement implementation
class statement_imp : public SharedObject
{
public:
explicit statement_imp(session& s);
explicit statement_imp(prepare_temp_type const& prep);
~statement_imp();
void erase_bindings();
void exchange(detail::into_type_ptr const& i);
void exchange(detail::use_type_ptr const& u);
void clean_up();
void prepare(std::string const& query, bool bRepeatable = true);
Error execute();
bool fetch(Error& error);
bool got_data() const;
public:
void do_intos();
void pre_use();
void do_uses();
void post_use();
void release_resources();
rowid last_insert_rowid();
public:
session& m_session;
sqlite3_stmt* m_stmt;
std::string m_query;
bool m_bReady;
bool m_bGotData;
bool m_bFirstTime;
rowid m_last_insert_rowid;
typedef std::vector <detail::into_type_base*> intos_t;
typedef std::vector <detail::use_type_base*> uses_t;
intos_t m_intos;
uses_t m_uses;
};
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,197 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_TYPE_CONVERSION_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_TYPE_CONVERSION_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
// used to order into and uses that need conversions
template<typename T>
struct base_value_holder
{
typename type_conversion<T>::base_type m_value;
};
// create into_type from type_conversion
template <typename T>
class conversion_into_type
: private base_value_holder<T>
, public into_type <typename type_conversion<T>::base_type>
{
public:
typedef typename type_conversion<T>::base_type BASE_TYPE;
conversion_into_type(T& value)
: into_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, m_own_ind)
, m_value(value), m_ind(m_own_ind) {}
conversion_into_type(T& value, indicator& ind)
: into_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, ind)
, m_value(value), m_ind(ind) {}
conversion_into_type (conversion_into_type const&) = delete;
conversion_into_type& operator= (conversion_into_type const&) = delete;
private:
void convert_from_base()
{
type_conversion<T>::from_base(
detail::base_value_holder<T>::m_value, m_ind, m_value);
}
T& m_value;
indicator m_own_ind;
indicator& m_ind;
};
// used to create a use_type from a type_conversion
template<typename T>
class conversion_use_type
: private base_value_holder<T>
, public use_type<typename type_conversion<T>::base_type>
{
public:
typedef typename type_conversion<T>::base_type BASE_TYPE;
conversion_use_type(T& value)
: use_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, m_own_ind)
, m_value(value), m_ind(m_own_ind), m_bReadOnly(false) {}
conversion_use_type(T const& value)
: use_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, m_own_ind)
, m_value(const_cast<T&>(value)), m_ind(m_own_ind), m_bReadOnly(true) {}
conversion_use_type(T& value, indicator& ind)
: use_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, ind)
, m_value(value), m_ind(ind), m_bReadOnly(false) {}
conversion_use_type(T const& value, indicator& ind)
: use_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, ind)
, m_value(const_cast<T&>(value)), m_ind(ind), m_bReadOnly(true) {}
conversion_use_type (conversion_use_type const&) = delete;
conversion_use_type& operator= (conversion_use_type const&) = delete;
void convert_from_base()
{
if (!m_bReadOnly)
{
type_conversion<T>::from_base(
detail::base_value_holder<T>::m_value, m_ind, m_value);
}
}
void convert_to_base()
{
type_conversion<T>::to_base(m_value,
detail::base_value_holder<T>::m_value, m_ind);
}
private:
T& m_value;
indicator m_own_ind;
indicator& m_ind;
bool m_bReadOnly;
};
template <typename T>
into_type_ptr do_into(T& t, user_type_tag)
{
return into_type_ptr(new conversion_into_type<T>(t));
}
template <typename T>
into_type_ptr do_into(T& t, indicator& ind, user_type_tag)
{
return into_type_ptr(new conversion_into_type<T>(t, ind));
}
template <typename T>
use_type_ptr do_use(T& t, user_type_tag)
{
return use_type_ptr(new conversion_use_type<T>(t));
}
template <typename T>
use_type_ptr do_use(T const& t, user_type_tag)
{
return use_type_ptr(new conversion_use_type<T>(t));
}
template <typename T>
use_type_ptr do_use(T& t, indicator& ind, user_type_tag)
{
return use_type_ptr(new conversion_use_type<T>(t, ind));
}
template <typename T>
use_type_ptr do_use(T const& t, indicator& ind, user_type_tag)
{
return use_type_ptr(new conversion_use_type<T>(t, ind));
}
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,95 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_TYPE_PTR_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_TYPE_PTR_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
// helper for managing the lifetime of into and use objects
template <typename T>
class type_ptr
{
public:
type_ptr(T* p) : m_p(p) { }
~type_ptr()
{
delete m_p;
}
T* get() const
{
return m_p;
}
void release() const
{
m_p = 0;
}
private:
mutable T* m_p;
};
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,167 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_DETAIL_USE_TYPE_H_INCLUDED
#define BEAST_MODULE_SQDB_DETAIL_USE_TYPE_H_INCLUDED
namespace beast {
namespace sqdb {
namespace detail {
// base class for defining input data
class use_type_base
{
public:
virtual ~use_type_base() {}
virtual void bind(statement_imp& st, int& iParam) = 0;
virtual void do_use() = 0;
virtual void post_use() = 0;
virtual void clean_up() = 0;
};
typedef type_ptr<use_type_base> use_type_ptr;
// handles builtin types
class standard_use_type : public use_type_base
{
public:
standard_use_type(void* data, exchange_type type, bool bReadOnly)
: m_data(data), m_type(type), m_ind(0), m_bReadOnly(bReadOnly) {}
standard_use_type(void* data, exchange_type type, indicator& ind, bool bReadOnly)
: m_data(data), m_type(type), m_ind(&ind), m_bReadOnly(bReadOnly) {}
virtual ~standard_use_type();
virtual void bind(statement_imp& st, int& iParam);
virtual void do_use();
virtual void post_use();
virtual void clean_up();
virtual void convert_to_base() {}
virtual void convert_from_base() {}
private:
void clean_up_backend();
private:
void* m_data;
exchange_type m_type;
indicator* m_ind;
bool m_bReadOnly;
statement_imp* m_st;
int m_iParam;
};
// worker for use
template<typename T>
class use_type : public standard_use_type
{
public:
use_type(T& t)
: standard_use_type(&t, static_cast<exchange_type>
(exchange_traits<T>::x_type), false) {}
use_type(T const& t)
: standard_use_type(const_cast<T*>(&t), static_cast<exchange_type>
(exchange_traits<T>::x_type), true) {}
use_type(T& t, indicator& ind)
: standard_use_type(&t, static_cast<exchange_type>
(exchange_traits<T>::x_type), ind, false) {}
use_type(T const& t, indicator& ind)
: standard_use_type(const_cast<T*>(&t), static_cast<exchange_type>
(exchange_traits<T>::x_type), ind, true) {}
};
// helpers for builtins
inline use_type_ptr do_use_null()
{
return use_type_ptr(new standard_use_type(0, x_null, true));
}
template<typename T>
use_type_ptr do_use(T& t, basic_type_tag)
{
return use_type_ptr(new use_type<T>(t));
}
template<typename T>
use_type_ptr do_use(T const& t, basic_type_tag)
{
return use_type_ptr(new use_type<T>(t));
}
template<typename T>
use_type_ptr do_use(T& t, indicator& ind, basic_type_tag)
{
return use_type_ptr(new use_type<T>(t, ind));
}
template<typename T>
use_type_ptr do_use(T const& t, indicator& ind, basic_type_tag)
{
return use_type_ptr(new use_type<T>(t, ind));
}
} // detail
} // sqdb
} // beast
#endif

View File

@@ -1,122 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
namespace beast {
namespace sqdb {
blob::blob()
: m_blob(0)
{
}
blob::~blob()
{
close();
}
Error blob::select(session& s,
char const* zTable,
char const* zColumn,
rowid id,
bool readAndWrite) noexcept
{
close();
m_session = &s;
int result = sqlite3_blob_open(s.get_connection(),
"main",
zTable,
zColumn,
id,
readAndWrite ? 1 : 0,
&m_blob);
return detail::sqliteError(__FILE__, __LINE__, result);
}
int blob::get_len()
{
return sqlite3_blob_bytes(m_blob);
}
Error blob::read(int offset, void* buf, int toRead)
{
return detail::sqliteError(__FILE__, __LINE__,
sqlite3_blob_read(m_blob, static_cast<char*>(buf), toRead, offset));
}
Error blob::write(int offset, void const* buf, int toWrite)
{
return detail::sqliteError(__FILE__, __LINE__,
sqlite3_blob_write(m_blob, buf, toWrite, offset));
}
void blob::close()
{
if (m_blob)
{
sqlite3_blob_close(m_blob);
m_blob = 0;
}
}
} // sqdb
} // beast

View File

@@ -1,235 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
namespace beast {
namespace sqdb {
namespace detail {
// VFALCO What the heck is this?!
#ifdef c
#undef c
#endif
const Error sqliteError(const char* sourceFileName,
int lineNumber,
int sqliteErrorCode)
{
/*
bassert (sqliteErrorCode != SQLITE_ROW &&
sqliteErrorCode != SQLITE_DONE);
*/
Error e;
String s;
Error::Code c;
switch (sqliteErrorCode)
{
// should never get these two here but include them just in case
case SQLITE_ROW:
case SQLITE_DONE:
case SQLITE_OK:
// this is fine, and lets us avoid having to explicitly
// check for SQLITE_OK and just deal in terms of the Error object.
c = Error::success;
break;
case SQLITE_ERROR:
s = "an sqlite error or missing database was encountered";
c = Error::general;
break;
case SQLITE_INTERNAL:
s = "sqlite encountered an internal logic error";
c = Error::unexpected;
break;
case SQLITE_PERM:
s = "sqlite was denied file access permission";
c = Error::fileNoPerm;
break;
case SQLITE_ABORT:
s = "the sqlite operation was canceled due to a callback";
c = Error::canceled;
break;
case SQLITE_BUSY:
s = "the sqlite database file is locked";
c = Error::fileInUse;
break;
case SQLITE_LOCKED:
s = "the sqlite database table was locked";
c = Error::fileInUse;
break;
case SQLITE_NOMEM:
s = "sqlite ran out of memory";
c = Error::noMemory;
break;
case SQLITE_READONLY:
s = "sqlite tried to write to a read-only database";
c = Error::fileNoPerm;
break;
case SQLITE_INTERRUPT:
s = "the sqlite operation was interrupted";
c = Error::canceled;
break;
case SQLITE_IOERR:
s = "sqlite encountered a device I/O error";
c = Error::fileIOError;
break;
case SQLITE_CORRUPT:
s = "the sqlite database is corrupt";
c = Error::invalidData;
break;
case SQLITE_FULL:
s = "the sqlite database is full";
c = Error::fileNoSpace;
break;
case SQLITE_CANTOPEN:
s = "the sqlite database could not be opened";
c = Error::fileNotFound;
break;
case SQLITE_PROTOCOL:
s = "sqlite encountered a lock protocol error";
c = Error::badParameter;
break;
case SQLITE_EMPTY:
s = "the sqlite database is empty";
c = Error::noMoreData;
break;
case SQLITE_SCHEMA:
s = "the sqlite database scheme was changed";
c = Error::invalidData;
break;
case SQLITE_TOOBIG:
s = "the sqlite string or blob was too large";
c = Error::fileNoSpace;
break;
case SQLITE_CONSTRAINT:
s = "the sqlite operation was aborted due to a constraint violation";
c = Error::badParameter;
break;
case SQLITE_MISMATCH:
s = "the sqlite data was mismatched";
c = Error::badParameter;
break;
case SQLITE_MISUSE:
s = "the sqlite library parameter was invalid";
c = Error::badParameter;
break;
case SQLITE_NOLFS:
s = "the sqlite platform feature is unavailable";
c = Error::badParameter;
break;
case SQLITE_AUTH:
s = "sqlite authorization was denied";
c = Error::fileNoPerm;
break;
case SQLITE_FORMAT:
s = "the auxiliary sqlite database has an invalid format";
c = Error::invalidData;
break;
case SQLITE_RANGE:
s = "the sqlite parameter was invalid";
c = Error::badParameter;
break;
case SQLITE_NOTADB:
s = "the file is not a sqlite database";
c = Error::invalidData;
break;
default:
s << "an unknown sqlite3 error code #"
<< String(sqliteErrorCode)
<< "was returned";
c = Error::general;
break;
}
if (c != Error::success)
e.fail(sourceFileName, lineNumber, s, c);
return e;
}
} // detail
} // sqdb
} // beast

View File

@@ -1,234 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#include <cassert>
namespace beast {
namespace sqdb {
namespace detail {
namespace
{
template <typename T>
inline T& as(void* data)
{
return *static_cast<T*>(data);
}
template <typename T>
static void integer_into(void* data, sqlite3_int64 v)
{
*(static_cast<T*>(data)) = T(v);
}
}
standard_into_type::~standard_into_type()
{
}
void standard_into_type::bind(statement_imp& st, int& iCol)
{
m_st = &st;
m_iCol = iCol++;
}
void standard_into_type::do_into()
{
int colType = sqlite3_column_type(m_st->m_stmt, m_iCol);
if (colType == SQLITE_NULL)
{
// null encountered with no indicator
assert (m_ind != nullptr);
*m_ind = i_null;
}
else
{
if (m_ind)
*m_ind = i_ok;
switch (colType)
{
case SQLITE_INTEGER:
{
sqlite3_int64 v = sqlite3_column_int64(m_st->m_stmt, m_iCol);
switch (m_type)
{
case x_bool: as <bool> (m_data) = v != 0; break;
case x_char: integer_into <char> (m_data, v); break;
case x_uchar: integer_into <unsigned char> (m_data, v); break;
case x_short: integer_into <short> (m_data, v); break;
case x_ushort: integer_into <unsigned short> (m_data, v); break;
case x_int: integer_into <int> (m_data, v); break;
case x_uint: integer_into <unsigned int> (m_data, v); break;
case x_long: integer_into <long> (m_data, v); break;
case x_ulong: integer_into <unsigned long> (m_data, v); break;
case x_longlong: integer_into <long long> (m_data, v); break;
case x_ulonglong: integer_into <unsigned long long> (m_data, v); break;
case x_beastString:
as <String> (m_data) = String(v);
break;
default:
throw std::invalid_argument ("unknown case");
}
}
break;
case SQLITE_FLOAT:
{
double const v (sqlite3_column_double (
m_st->m_stmt, m_iCol));
switch (m_type)
{
case x_float: as <float> (m_data) = static_cast <float> (v); break;
case x_double: as <double> (m_data) = v; break;
case x_longdouble: as <long double> (m_data) = v; break;
break;
case x_beastString:
as <String> (m_data) = String(v);
break;
default:
throw std::invalid_argument ("unknown case");
};
}
break;
case SQLITE_TEXT:
{
switch (m_type)
{
case x_stdstring:
{
// excludes terminator
int bytes = sqlite3_column_bytes(m_st->m_stmt, m_iCol);
unsigned char const* v = sqlite3_column_text(m_st->m_stmt, m_iCol);
std::string& result = as<std::string>(m_data);
result.assign(reinterpret_cast<char const*>(v), bytes);
}
break;
case x_stdwstring:
throw std::invalid_argument ("invalid case");
break;
case x_beastString:
{
// excludes terminator
int bytes = sqlite3_column_bytes(m_st->m_stmt, m_iCol);
const CharPointer_UTF8::CharType* c = reinterpret_cast
<const CharPointer_UTF8::CharType*>
(sqlite3_column_text(m_st->m_stmt, m_iCol));
String& s = as <String> (m_data);
s = String(CharPointer_UTF8(c), CharPointer_UTF8(c + bytes));
}
break;
default:
{
sqlite3_int64 v = sqlite3_column_int64(m_st->m_stmt, m_iCol);
switch (m_type)
{
case x_bool: as <bool> (m_data) = v != 0; break;
case x_char: integer_into <char> (m_data, v); break;
case x_uchar: integer_into <unsigned char> (m_data, v); break;
case x_short: integer_into <short> (m_data, v); break;
case x_ushort: integer_into <unsigned short> (m_data, v); break;
case x_int: integer_into <int> (m_data, v); break;
case x_uint: integer_into <unsigned int> (m_data, v); break;
case x_long: integer_into <long> (m_data, v); break;
case x_ulong: integer_into <unsigned long> (m_data, v); break;
case x_longlong: integer_into <long long> (m_data, v); break;
case x_ulonglong: integer_into <unsigned long long> (m_data, v); break;
default:
throw std::invalid_argument ("unknown case");
}
}
break;
};
}
break;
case SQLITE_BLOB:
throw std::invalid_argument ("invalid case");
default:
throw std::invalid_argument ("unknown case");
};
}
convert_from_base();
}
} // detail
} // sqdb
} // beast

View File

@@ -1,118 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
namespace beast {
namespace sqdb {
namespace detail {
once_type::once_type(const once_type& other)
: m_session(other.m_session)
, m_error(other.m_error)
{
}
once_temp_type::once_temp_type(session& s, Error& error)
: m_rcst(new ref_counted_statement(s, error))
{
// new query
s.get_query_stream().str("");
}
once_temp_type::once_temp_type(once_temp_type const& o)
: m_rcst(o.m_rcst)
{
m_rcst->addref();
}
once_temp_type& once_temp_type::operator= (once_temp_type const& o)
{
o.m_rcst->addref();
m_rcst->release();
m_rcst = o.m_rcst;
return *this;
}
once_temp_type::~once_temp_type()
{
m_rcst->release();
}
once_temp_type& once_temp_type::operator, (into_type_ptr const& i)
{
m_rcst->exchange(i);
return *this;
}
once_temp_type& once_temp_type::operator, (use_type_ptr const& u)
{
m_rcst->exchange(u);
return *this;
}
//------------------------------------------------------------------------------
once_type::once_type(session* s, Error& error)
: m_session(*s)
, m_error(error)
{
}
} // detail
} // sqdb
} // beast

View File

@@ -1,104 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
namespace beast {
namespace sqdb {
namespace detail {
prepare_temp_type::prepare_temp_type(session& s)
: m_rcpi(new ref_counted_prepare_info(s))
{
// new query
s.get_query_stream().str("");
}
prepare_temp_type::prepare_temp_type(prepare_temp_type const& o)
: m_rcpi(o.m_rcpi)
{
m_rcpi->addref();
}
prepare_temp_type& prepare_temp_type::operator=(prepare_temp_type const& o)
{
o.m_rcpi->addref();
m_rcpi->release();
m_rcpi = o.m_rcpi;
return *this;
}
prepare_temp_type::~prepare_temp_type()
{
m_rcpi->release();
}
prepare_temp_type& prepare_temp_type::operator, (into_type_ptr const& i)
{
m_rcpi->exchange(i);
return *this;
}
prepare_temp_type& prepare_temp_type::operator, (use_type_ptr const& u)
{
m_rcpi->exchange(u);
return *this;
}
} // detail
} // sqdb
} // beast

View File

@@ -1,103 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
namespace beast {
namespace sqdb {
namespace detail {
ref_counted_prepare_info::ref_counted_prepare_info(session& s)
: ref_counted_statement_base(s)
{
}
void ref_counted_prepare_info::exchange(into_type_ptr const& i)
{
m_intos.push_back(i.get());
i.release();
}
void ref_counted_prepare_info::exchange(use_type_ptr const& u)
{
m_uses.push_back(u.get());
u.release();
}
void ref_counted_prepare_info::final_action()
{
for (std::size_t i = m_intos.size(); i > 0; --i)
{
delete m_intos[i - 1];
m_intos.resize(i - 1);
}
for (std::size_t i = m_uses.size(); i > 0; --i)
{
delete m_uses[i - 1];
m_uses.resize(i - 1);
}
}
std::string ref_counted_prepare_info::get_query() const
{
return m_session.get_query_stream().str();
}
} // detail
} // sqdb
} // beast

View File

@@ -1,125 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
namespace beast {
namespace sqdb {
namespace detail {
ref_counted_statement_base::ref_counted_statement_base(session& s)
: m_refs(1)
, m_session(s)
{
}
ref_counted_statement_base ::~ref_counted_statement_base()
{
}
void ref_counted_statement_base::addref()
{
++m_refs;
}
void ref_counted_statement_base::release()
{
if (--m_refs == 0)
{
final_action();
delete this;
}
}
std::ostringstream& ref_counted_statement_base::get_query_stream()
{
return m_session.get_query_stream();
}
//------------------------------------------------------------------------------
ref_counted_statement::ref_counted_statement(session& s, Error& error)
: ref_counted_statement_base(s)
, m_error(error)
, m_st(s)
{
}
void ref_counted_statement::exchange(into_type_ptr const& i)
{
m_st.exchange(i);
}
void ref_counted_statement::exchange(use_type_ptr const& u)
{
m_st.exchange(u);
}
void ref_counted_statement::final_action()
{
m_st.prepare(m_session.get_query_stream().str(), false);
Error error;
m_st.execute_and_fetch(error);
m_error = error;
m_st.clean_up();
}
} // detail
} // sqdb
} // beast

View File

@@ -1,371 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#include <cassert>
namespace beast {
namespace sqdb {
class Sqlite3Instance
{
public:
Sqlite3Instance()
{
assert (sqlite3_threadsafe() != 0);
sqlite3_initialize();
}
~Sqlite3Instance()
{
sqlite3_shutdown();
}
};
Sqlite3Instance sqlite3_instance;
//------------------------------------------------------------------------------
session::session()
: prepare (this)
, m_bInTransaction (false)
, m_connection (nullptr)
{
}
session::session(const session& deferredClone)
: prepare (this)
, m_bInTransaction (false)
, m_connection (nullptr)
, m_fileName (deferredClone.m_fileName)
, m_connectString (deferredClone.m_connectString)
{
// shouldn't be needed since deferredClone did it
//Sqlite::initialize();
}
session::~session()
{
close();
}
Error session::clone()
{
assert (! m_connection);
return open(m_fileName, m_connectString);
}
Error session::open(String fileName, std::string options)
{
Error err;
// can't open twice
assert (! m_connection);
int mode = 0;
int flags = 0;
int timeout = 0;
std::stringstream ssconn(options);
while (!err && !ssconn.eof() &&
ssconn.str().find('=') != std::string::npos)
{
std::string key, val;
std::getline(ssconn, key, '=');
std::getline(ssconn, val, '|');
if ("timeout" == key)
{
if ("infinite" == val)
{
//timeout = -1;
timeout = 0x7fffffff;
}
else
{
std::istringstream converter(val);
converter >> timeout;
if (timeout < 1)
timeout = 1;
}
}
else if ("mode" == key)
{
if (!(mode & (SQLITE_OPEN_READONLY | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)))
{
if ("read" == val)
{
mode = SQLITE_OPEN_READONLY;
}
else if ("write" == val)
{
mode = SQLITE_OPEN_READWRITE;
}
else if ("create" == val)
{
mode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
}
else
{
throw std::invalid_argument ("bad parameter");
}
}
else
{
throw std::invalid_argument ("duplicate parameter");
}
}
/* Most native SQLite libraries don't have these experimental features.
*/
#if ! VF_USE_NATIVE_SQLITE
else if ("cache" == key)
{
if (!(flags & (SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_PRIVATECACHE)))
{
if ("shared" == val)
{
flags |= SQLITE_OPEN_SHAREDCACHE;
}
else if ("private" == val)
{
flags |= SQLITE_OPEN_PRIVATECACHE;
}
else
{
throw std::invalid_argument ("bad parameter");
}
}
else
{
throw std::invalid_argument ("duplicate parameter");
}
}
#endif
else if ("threads" == key)
{
if (!(flags & (SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_FULLMUTEX)))
{
if ("single" == val)
{
flags |= SQLITE_OPEN_FULLMUTEX;
}
else if ("multi" == val)
{
flags |= SQLITE_OPEN_NOMUTEX;
}
else
{
throw std::invalid_argument ("bad parameter");
}
}
else
{
throw std::invalid_argument ("duplicate parameter");
}
}
else
{
throw std::invalid_argument ("unknown parameter");
}
}
if (!err)
{
if (! mode)
mode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
flags |= mode;
err = detail::sqliteError(__FILE__, __LINE__,
sqlite3_open_v2(fileName.toUTF8(), &m_connection, flags, 0));
if (!err)
{
if (timeout > 0)
{
err = detail::sqliteError(__FILE__, __LINE__,
sqlite3_busy_timeout(m_connection, timeout));
}
/*
else
{
err = detail::sqliteError (__FILE__, __LINE__,
sqlite3_busy_handler(m_connection, infiniteBusyHandler, 0));
}
*/
}
if (!err)
{
m_fileName = fileName;
m_connectString = options;
}
if (err)
{
close();
}
}
return err;
}
void session::close()
{
if (m_connection)
{
sqlite3_close(m_connection);
m_connection = 0;
m_fileName = String::empty;
m_connectString = "";
}
}
void session::begin()
{
bassert(!m_bInTransaction);
m_bInTransaction = true;
//Error error = hard_exec("BEGIN EXCLUSIVE");
Error error = hard_exec("BEGIN");
if (error)
throw error;
}
Error session::commit()
{
bassert(m_bInTransaction);
m_bInTransaction = false;
return hard_exec("COMMIT");
}
void session::rollback()
{
bassert(m_bInTransaction);
m_bInTransaction = false;
Error error = hard_exec("ROLLBACK");
if (error)
throw error;
}
detail::once_type session::once(Error& error)
{
return detail::once_type(this, error);
}
rowid session::last_insert_rowid()
{
return sqlite3_last_insert_rowid(m_connection);
}
std::ostringstream& session::get_query_stream()
{
return m_query_stream;
}
void session::log_query(std::string const& query)
{
// TODO
}
void session::set_got_data(bool bGotData)
{
m_bGotData = bGotData;
}
bool session::got_data() const
{
return m_bGotData;
}
Error session::hard_exec(std::string const& query)
{
Error error;
sqlite3_stmt* stmt;
char const* tail = 0;
int result = sqlite3_prepare_v2(
m_connection,
query.c_str(),
static_cast<int>(query.size()),
&stmt,
&tail);
if (result == SQLITE_OK)
{
result = sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
if (result != SQLITE_DONE)
error = detail::sqliteError(__FILE__, __LINE__, result);
return error;
}
} // sqdb
} // beast

View File

@@ -1,140 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
namespace beast {
namespace sqdb {
statement::statement(session& s)
: m_imp(new detail::statement_imp(s))
{
}
statement::statement(detail::prepare_temp_type const& prep)
: m_imp(new detail::statement_imp(prep))
{
}
statement::~statement()
{
}
statement::statement(statement const& o)
: m_imp(o.m_imp)
{
}
void statement::operator= (statement const& o)
{
m_imp = o.m_imp;
}
void statement::exchange(detail::into_type_ptr const& i)
{
m_imp->exchange(i);
}
void statement::exchange(detail::use_type_ptr const& u)
{
m_imp->exchange(u);
}
void statement::prepare(std::string const& query, bool bRepeatable)
{
m_imp->prepare(query, bRepeatable);
}
Error statement::execute()
{
return m_imp->execute();
}
bool statement::execute_and_fetch(Error& error)
{
bool gotData = false;
error = m_imp->execute();
if (!error)
gotData = fetch(error);
return gotData;
}
bool statement::fetch(Error& error)
{
return m_imp->fetch(error);
}
bool statement::got_data() const
{
return m_imp->got_data();
}
rowid statement::last_insert_rowid()
{
return m_imp->last_insert_rowid();
}
void statement::clean_up()
{
m_imp->clean_up();
}
} // sqdb
} // beast

View File

@@ -1,308 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
namespace beast {
namespace sqdb {
namespace detail {
/*
Running a new prepared statement:
sqlite3_prepare() // create prepared statement
sqlite3_bind() // define input variables
sqlite3_step() // retrieve next row
sqlite3_column() // extract output value
sqlite3_finalize() // destroy prepared statement
Re-using an existing prepared statement
sqlite3_reset() // reset the statement (input bindings are not cleared)
sqlite3_clear_bindings() // set all input variables to NULL
AND/OR
sqlite3_bind() // define input variables
sqlite3_step() // retrieve next row
sqlite3_column() // extract output value
*/
statement_imp::statement_imp(session& s)
: m_session(s)
, m_stmt(0)
, m_bReady(false)
, m_bGotData(false)
, m_last_insert_rowid(0)
{
}
statement_imp::statement_imp(prepare_temp_type const& prep)
: m_session(prep.get_prepare_info().m_session)
, m_stmt(0)
, m_bReady(false)
, m_bGotData(false)
{
ref_counted_prepare_info& rcpi = prep.get_prepare_info();
m_intos.swap(rcpi.m_intos);
m_uses.swap(rcpi.m_uses);
prepare(rcpi.get_query());
}
statement_imp::~statement_imp()
{
clean_up();
}
void statement_imp::erase_bindings()
{
// delete intos
for (std::size_t i = m_intos.size(); i != 0; --i)
{
into_type_base* p = m_intos[i - 1];
delete p;
m_intos.resize(i - 1);
}
// delete uses
for (std::size_t i = m_uses.size(); i != 0; --i)
{
use_type_base* p = m_uses[i - 1];
p->clean_up();
delete p;
m_uses.resize(i - 1);
}
}
void statement_imp::exchange(detail::into_type_ptr const& i)
{
m_intos.push_back(i.get());
i.release();
}
void statement_imp::exchange(detail::use_type_ptr const& u)
{
m_uses.push_back(u.get());
u.release();
}
void statement_imp::clean_up()
{
erase_bindings();
release_resources();
}
void statement_imp::prepare(std::string const& query, bool bRepeatable)
{
m_query = query;
m_session.log_query(query);
m_last_insert_rowid = 0;
release_resources();
char const* tail = 0;
int result = sqlite3_prepare_v2(
m_session.get_connection(),
query.c_str(),
static_cast<int>(query.size()),
&m_stmt,
&tail);
if (result == SQLITE_OK)
{
m_bReady = true;
}
else
{
throw detail::sqliteError(__FILE__, __LINE__, result);
}
}
Error statement_imp::execute()
{
Error error;
assert (m_stmt != nullptr);
// ???
m_bGotData = false;
m_session.set_got_data(m_bGotData);
// binds
int iCol = 0;
for (intos_t::iterator iter = m_intos.begin(); iter != m_intos.end(); ++iter)
(*iter)->bind(*this, iCol);
int iParam = 1;
for (uses_t::iterator iter = m_uses.begin(); iter != m_uses.end(); ++iter)
(*iter)->bind(*this, iParam);
// reset
error = detail::sqliteError(__FILE__, __LINE__, sqlite3_reset(m_stmt));
if (!error)
{
// set input variables
do_uses();
m_bReady = true;
m_bFirstTime = true;
}
return error;
}
bool statement_imp::fetch(Error& error)
{
int result = sqlite3_step(m_stmt);
if (result == SQLITE_ROW ||
result == SQLITE_DONE)
{
if (m_bFirstTime)
{
m_last_insert_rowid = m_session.last_insert_rowid();
m_bFirstTime = false;
}
if (result == SQLITE_ROW)
{
m_bGotData = true;
m_session.set_got_data(m_bGotData);
do_intos();
}
else
{
m_bGotData = false;
m_session.set_got_data(m_bGotData);
if (result == SQLITE_DONE)
{
m_bReady = false;
}
}
}
else if (result != SQLITE_OK)
{
m_bGotData = false;
error = detail::sqliteError(__FILE__, __LINE__, result);
}
else
{
// should never get SQLITE_OK here
throw std::invalid_argument ("invalid result");
}
return m_bGotData;
}
bool statement_imp::got_data() const
{
return m_bGotData;
}
void statement_imp::do_intos()
{
for (intos_t::iterator iter = m_intos.begin(); iter != m_intos.end(); ++iter)
(*iter)->do_into();
}
void statement_imp::do_uses()
{
Error error = detail::sqliteError(__FILE__, __LINE__,
sqlite3_clear_bindings(m_stmt));
if (error)
throw error;
for (uses_t::iterator iter = m_uses.begin(); iter != m_uses.end(); ++iter)
(*iter)->do_use();
}
void statement_imp::post_use()
{
// reverse order
for (uses_t::reverse_iterator iter = m_uses.rbegin(); iter != m_uses.rend(); ++iter)
(*iter)->post_use();
}
void statement_imp::release_resources()
{
if (m_stmt)
{
sqlite3_finalize(m_stmt);
m_stmt = 0;
}
m_bReady = false;
m_bGotData = false;
}
rowid statement_imp::last_insert_rowid()
{
return m_last_insert_rowid;
}
} // detail
} // sqdb
} // beast

View File

@@ -1,104 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#include <cassert>
namespace beast {
namespace sqdb {
transaction::transaction(session& s)
: m_session(s), m_bHandled(false)
{
m_session.begin();
}
transaction::~transaction()
{
if (!m_bHandled)
rollback();
}
Error transaction::commit()
{
Error error;
// already handled
assert (!m_bHandled);
// if commit() throws, m_bHandled will remain false
// and the destructor will attempt a rollback.
m_bHandled = true;
error = m_session.commit();
return error;
}
void transaction::rollback()
{
// already handled
assert (!m_bHandled);
m_session.rollback();
m_bHandled = true;
}
} // sqdb
} // beast

View File

@@ -1,228 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#include <cassert>
namespace beast {
namespace sqdb {
namespace detail {
standard_use_type::~standard_use_type()
{
}
void standard_use_type::bind(statement_imp& st, int& iParam)
{
m_st = &st;
m_iParam = iParam++;
}
namespace {
template<typename T>
inline T const& as(void const* v)
{
return *static_cast <T const*>(v);
}
template<typename T, typename L>
inline T const& as(void const* v)
{
T const& val = *static_cast <T const*>(v);
assert (val <= T(std::numeric_limits<L>::max()));
return val;
}
}
void standard_use_type::do_use()
{
int result = SQLITE_OK;
convert_to_base();
switch (m_type)
{
case x_null:
result = sqlite3_bind_null(m_st->m_stmt, m_iParam);
break;
case x_bool:
result = sqlite3_bind_int(m_st->m_stmt, m_iParam, as <bool> (m_data) ? 1 : 0);
break;
case x_char:
result = sqlite3_bind_int(m_st->m_stmt, m_iParam, as <char> (m_data));
break;
case x_uchar:
result = sqlite3_bind_int(m_st->m_stmt, m_iParam, as <unsigned char> (m_data));
break;
case x_short:
result = sqlite3_bind_int(m_st->m_stmt, m_iParam, as <short> (m_data));
break;
case x_ushort:
result = sqlite3_bind_int(m_st->m_stmt, m_iParam, as <unsigned short> (m_data));
break;
case x_int:
result = sqlite3_bind_int(m_st->m_stmt, m_iParam, as <int> (m_data));
break;
case x_uint:
result = sqlite3_bind_int64(m_st->m_stmt, m_iParam, as <unsigned int> (m_data));
break;
case x_long:
result = sqlite3_bind_int(m_st->m_stmt, m_iParam, as <long> (m_data));
break;
case x_ulong:
result = sqlite3_bind_int64(m_st->m_stmt, m_iParam, as <unsigned long> (m_data));
break;
case x_longlong:
result = sqlite3_bind_int64(m_st->m_stmt, m_iParam, as <long long> (m_data));
break;
case x_ulonglong:
result = sqlite3_bind_int64(m_st->m_stmt, m_iParam, as <unsigned long long> (m_data));
break;
case x_float:
result = sqlite3_bind_double(m_st->m_stmt, m_iParam, as <float> (m_data));
break;
case x_double:
result = sqlite3_bind_double(m_st->m_stmt, m_iParam, as <double> (m_data));
break;
#if 0
case x_longdouble:
result = sqlite3_bind_double(m_st->m_stmt, m_iParam, as <long double> (m_data));
break;
#endif
case x_cstring:
result = sqlite3_bind_text(m_st->m_stmt, m_iParam, as <char*> (m_data), -1, SQLITE_STATIC);
break;
case x_cwstring:
result = sqlite3_bind_text16(m_st->m_stmt, m_iParam, as <wchar_t*> (m_data), -1, SQLITE_STATIC);
break;
case x_stdstring:
{
std::string const& s = as <std::string> (m_data);
result = sqlite3_bind_text(m_st->m_stmt,
m_iParam,
s.c_str(),
int(s.size() * sizeof(s[0])),
SQLITE_STATIC);
}
break;
case x_stdwstring:
{
std::wstring const& s = as <std::wstring> (m_data);
result = sqlite3_bind_text16(m_st->m_stmt,
m_iParam,
s.c_str(),
int(s.size() * sizeof(s[0])),
SQLITE_STATIC);
}
break;
case x_beastString:
{
String const& s = as <String> (m_data);
result = sqlite3_bind_text(m_st->m_stmt,
m_iParam,
s.toUTF8(),
-1,
SQLITE_STATIC);
}
break;
case x_stdtm:
case x_blob:
default:
throw std::invalid_argument ("bad parameter");
}
if (result != SQLITE_OK)
throw detail::sqliteError(__FILE__, __LINE__, result);
}
void standard_use_type::post_use()
{
convert_from_base();
}
void standard_use_type::clean_up()
{
}
} // detail
} // sqdb
} // beast

View File

@@ -1,125 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions based on SOCI - The C++ Database Access Library:
SOCI: http://soci.sourceforge.net/
This file incorporates work covered by the following copyright
and permission notice:
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
Boost Software License - Version 1.0, August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQDB_SQDB_H_INCLUDED
#define BEAST_MODULE_SQDB_SQDB_H_INCLUDED
/** An embedded database wrapper with an intuitive, type-safe interface.
This collection of classes let's you access embedded SQLite databases
using C++ syntax that is very similar to regular SQL.
This module requires the @ref beast_sqlite external module.
*/
#include <ctime>
// forward declares
struct sqlite3;
struct sqlite3_blob;
struct sqlite3_stmt;
namespace beast {
namespace sqdb {
namespace detail {
class prepare_temp_type;
class ref_counted_statement; // statement.h
class statement_imp; // into_type.h, use_type.h
}
class blob; // exchange_traits.h
class session; // statement.h
}
}
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable: 4355) // 'this' : used in base member initializer list
#endif
#include <beast/module/sqdb/api/backend.h>
#include <beast/module/sqdb/api/transaction.h>
#include <beast/module/sqdb/detail/type_ptr.h>
#include <beast/module/sqdb/api/blob.h>
#include <beast/module/sqdb/api/type_conversion_traits.h>
#include <beast/module/sqdb/detail/exchange_traits.h>
#include <beast/module/sqdb/detail/into_type.h>
#include <beast/module/sqdb/detail/use_type.h>
#include <beast/module/sqdb/api/statement.h>
#include <beast/module/sqdb/detail/type_conversion.h>
#include <beast/module/sqdb/detail/ref_counted_statement.h>
#include <beast/module/sqdb/api/into.h>
#include <beast/module/sqdb/api/use.h>
#include <beast/module/sqdb/detail/ref_counted_prepare_info.h>
#include <beast/module/sqdb/detail/prepare_temp_type.h>
#include <beast/module/sqdb/detail/once_temp_type.h>
#include <beast/module/sqdb/api/session.h>
#if _MSC_VER
#pragma warning (pop)
#endif
#endif

View File

@@ -1,53 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include <BeastConfig.h>
#endif
#include <beast/module/sqdb/sqdb.h>
#include <beast/module/sqlite/sqlite.h>
#if BEAST_MSVC
#pragma warning (push)
#pragma warning (disable: 4100) // unreferenced formal parmaeter
#pragma warning (disable: 4355) // 'this' used in base member
#endif
// implementation headers
#include <beast/module/sqdb/detail/error_codes.h>
#include <beast/module/sqdb/detail/statement_imp.h>
#include <beast/module/sqdb/source/blob.cpp>
#include <beast/module/sqdb/source/error_codes.cpp>
#include <beast/module/sqdb/source/into_type.cpp>
#include <beast/module/sqdb/source/once_temp_type.cpp>
#include <beast/module/sqdb/source/prepare_temp_type.cpp>
#include <beast/module/sqdb/source/ref_counted_prepare_info.cpp>
#include <beast/module/sqdb/source/ref_counted_statement.cpp>
#include <beast/module/sqdb/source/session.cpp>
#include <beast/module/sqdb/source/statement.cpp>
#include <beast/module/sqdb/source/statement_imp.cpp>
#include <beast/module/sqdb/source/transaction.cpp>
#include <beast/module/sqdb/source/use_type.cpp>
#if BEAST_MSVC
#pragma warning (pop)
#endif

View File

@@ -1,46 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_MODULE_SQLITE_SQLITE_H_INCLUDED
#define BEAST_MODULE_SQLITE_SQLITE_H_INCLUDED
/** A self-contained, serverless, zero configuration, transactional SQL engine.
This external module provides the SQLite embedded database library.
SQLite is public domain software, visit http://sqlite.org
*/
#include <beast/config/PlatformConfig.h>
#if BEAST_IOS || BEAST_MAC
# define BEAST_HAVE_NATIVE_SQLITE 1
#else
# define BEAST_HAVE_NATIVE_SQLITE 0
#endif
#ifndef BEAST_SQLITE_CPP_INCLUDED
# if BEAST_USE_NATIVE_SQLITE && BEAST_HAVE_NATIVE_SQLITE
#include <sqlite3.h>
# else
#include <beast/module/sqlite/sqlite/sqlite3.h> // Amalgamated
# endif
#endif
#endif

View File

@@ -1,73 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
/** Add this to get the @ref vf_sqlite external module.
@file beast_sqlite.c
@ingroup beast_sqlite
*/
#if BEAST_INCLUDE_BEASTCONFIG
#include <BeastConfig.h>
#endif
// Prevents sqlite.h from being included, since it screws up the .c
#define BEAST_SQLITE_CPP_INCLUDED
#include <beast/module/sqlite/sqlite.h>
#if ! (BEAST_USE_NATIVE_SQLITE && BEAST_HAVE_NATIVE_SQLITE)
#if BEAST_MSVC
#pragma warning (push)
#pragma warning (disable: 4100) /* unreferenced formal parameter */
#pragma warning (disable: 4127) /* conditional expression is constant */
#pragma warning (disable: 4232) /* nonstandard extension used: dllimport address */
#pragma warning (disable: 4244) /* conversion from 'int': possible loss of data */
#pragma warning (disable: 4701) /* potentially uninitialized variable */
#pragma warning (disable: 4706) /* assignment within conditional expression */
#pragma warning (disable: 4996) /* 'GetVersionExA' was declared deprecated */
#endif
/* When compiled with SQLITE_THREADSAFE=1, SQLite operates in serialized mode.
In this mode, SQLite can be safely used by multiple threads with no restriction.
VFALCO NOTE This implies a global mutex!
*/
#define SQLITE_THREADSAFE 1
/* When compiled with SQLITE_THREADSAFE=2, SQLite can be used in a
multithreaded program so long as no two threads attempt to use the
same database connection at the same time.
VFALCO NOTE This is the preferred threading model.
*/
//#define SQLITE_THREADSAFE 2
#if defined (BEAST_SQLITE_USE_NDEBUG) && BEAST_SQLITE_USE_NDEBUG && !defined (NDEBUG)
#define NDEBUG
#endif
#include <beast/module/sqlite/sqlite/sqlite3.c>
#if BEAST_MSVC
#pragma warning (pop)
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,517 +0,0 @@
/*
** 2006 June 7
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the SQLite interface for use by
** shared libraries that want to be imported as extensions into
** an SQLite instance. Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of
** sqlite3.h.
*/
#ifndef _SQLITE3EXT_H_
#define _SQLITE3EXT_H_
#include "sqlite3.h"
typedef struct sqlite3_api_routines sqlite3_api_routines;
/*
** The following structure holds pointers to all of the SQLite API
** routines.
**
** WARNING: In order to maintain backwards compatibility, add new
** interfaces to the end of this structure only. If you insert new
** interfaces in the middle of this structure, then older different
** versions of SQLite will not be able to load each other's shared
** libraries!
*/
struct sqlite3_api_routines {
void * (*aggregate_context)(sqlite3_context*,int nBytes);
int (*aggregate_count)(sqlite3_context*);
int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
int (*bind_double)(sqlite3_stmt*,int,double);
int (*bind_int)(sqlite3_stmt*,int,int);
int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
int (*bind_null)(sqlite3_stmt*,int);
int (*bind_parameter_count)(sqlite3_stmt*);
int (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
const char * (*bind_parameter_name)(sqlite3_stmt*,int);
int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
int (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
int (*busy_timeout)(sqlite3*,int ms);
int (*changes)(sqlite3*);
int (*close)(sqlite3*);
int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
int eTextRep,const char*));
int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
int eTextRep,const void*));
const void * (*column_blob)(sqlite3_stmt*,int iCol);
int (*column_bytes)(sqlite3_stmt*,int iCol);
int (*column_bytes16)(sqlite3_stmt*,int iCol);
int (*column_count)(sqlite3_stmt*pStmt);
const char * (*column_database_name)(sqlite3_stmt*,int);
const void * (*column_database_name16)(sqlite3_stmt*,int);
const char * (*column_decltype)(sqlite3_stmt*,int i);
const void * (*column_decltype16)(sqlite3_stmt*,int);
double (*column_double)(sqlite3_stmt*,int iCol);
int (*column_int)(sqlite3_stmt*,int iCol);
sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol);
const char * (*column_name)(sqlite3_stmt*,int);
const void * (*column_name16)(sqlite3_stmt*,int);
const char * (*column_origin_name)(sqlite3_stmt*,int);
const void * (*column_origin_name16)(sqlite3_stmt*,int);
const char * (*column_table_name)(sqlite3_stmt*,int);
const void * (*column_table_name16)(sqlite3_stmt*,int);
const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
const void * (*column_text16)(sqlite3_stmt*,int iCol);
int (*column_type)(sqlite3_stmt*,int iCol);
sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
int (*complete)(const char*sql);
int (*complete16)(const void*sql);
int (*create_collation)(sqlite3*,const char*,int,void*,
int(*)(void*,int,const void*,int,const void*));
int (*create_collation16)(sqlite3*,const void*,int,void*,
int(*)(void*,int,const void*,int,const void*));
int (*create_function)(sqlite3*,const char*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*));
int (*create_function16)(sqlite3*,const void*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*));
int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
int (*data_count)(sqlite3_stmt*pStmt);
sqlite3 * (*db_handle)(sqlite3_stmt*);
int (*declare_vtab)(sqlite3*,const char*);
int (*enable_shared_cache)(int);
int (*errcode)(sqlite3*db);
const char * (*errmsg)(sqlite3*);
const void * (*errmsg16)(sqlite3*);
int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
int (*expired)(sqlite3_stmt*);
int (*finalize)(sqlite3_stmt*pStmt);
void (*free)(void*);
void (*free_table)(char**result);
int (*get_autocommit)(sqlite3*);
void * (*get_auxdata)(sqlite3_context*,int);
int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
int (*global_recover)(void);
void (*interruptx)(sqlite3*);
sqlite_int64 (*last_insert_rowid)(sqlite3*);
const char * (*libversion)(void);
int (*libversion_number)(void);
void *(*malloc)(int);
char * (*mprintf)(const char*,...);
int (*open)(const char*,sqlite3**);
int (*open16)(const void*,sqlite3**);
int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
void (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
void *(*realloc)(void*,int);
int (*reset)(sqlite3_stmt*pStmt);
void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_double)(sqlite3_context*,double);
void (*result_error)(sqlite3_context*,const char*,int);
void (*result_error16)(sqlite3_context*,const void*,int);
void (*result_int)(sqlite3_context*,int);
void (*result_int64)(sqlite3_context*,sqlite_int64);
void (*result_null)(sqlite3_context*);
void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_value)(sqlite3_context*,sqlite3_value*);
void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
const char*,const char*),void*);
void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
char * (*snprintf)(int,char*,const char*,...);
int (*step)(sqlite3_stmt*);
int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
char const**,char const**,int*,int*,int*);
void (*thread_cleanup)(void);
int (*total_changes)(sqlite3*);
void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
sqlite_int64),void*);
void * (*user_data)(sqlite3_context*);
const void * (*value_blob)(sqlite3_value*);
int (*value_bytes)(sqlite3_value*);
int (*value_bytes16)(sqlite3_value*);
double (*value_double)(sqlite3_value*);
int (*value_int)(sqlite3_value*);
sqlite_int64 (*value_int64)(sqlite3_value*);
int (*value_numeric_type)(sqlite3_value*);
const unsigned char * (*value_text)(sqlite3_value*);
const void * (*value_text16)(sqlite3_value*);
const void * (*value_text16be)(sqlite3_value*);
const void * (*value_text16le)(sqlite3_value*);
int (*value_type)(sqlite3_value*);
char *(*vmprintf)(const char*,va_list);
/* Added ??? */
int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
/* Added by 3.3.13 */
int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
int (*clear_bindings)(sqlite3_stmt*);
/* Added by 3.4.1 */
int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
void (*xDestroy)(void *));
/* Added by 3.5.0 */
int (*bind_zeroblob)(sqlite3_stmt*,int,int);
int (*blob_bytes)(sqlite3_blob*);
int (*blob_close)(sqlite3_blob*);
int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
int,sqlite3_blob**);
int (*blob_read)(sqlite3_blob*,void*,int,int);
int (*blob_write)(sqlite3_blob*,const void*,int,int);
int (*create_collation_v2)(sqlite3*,const char*,int,void*,
int(*)(void*,int,const void*,int,const void*),
void(*)(void*));
int (*file_control)(sqlite3*,const char*,int,void*);
sqlite3_int64 (*memory_highwater)(int);
sqlite3_int64 (*memory_used)(void);
sqlite3_mutex *(*mutex_alloc)(int);
void (*mutex_enter)(sqlite3_mutex*);
void (*mutex_free)(sqlite3_mutex*);
void (*mutex_leave)(sqlite3_mutex*);
int (*mutex_try)(sqlite3_mutex*);
int (*open_v2)(const char*,sqlite3**,int,const char*);
int (*release_memory)(int);
void (*result_error_nomem)(sqlite3_context*);
void (*result_error_toobig)(sqlite3_context*);
int (*sleep)(int);
void (*soft_heap_limit)(int);
sqlite3_vfs *(*vfs_find)(const char*);
int (*vfs_register)(sqlite3_vfs*,int);
int (*vfs_unregister)(sqlite3_vfs*);
int (*xthreadsafe)(void);
void (*result_zeroblob)(sqlite3_context*,int);
void (*result_error_code)(sqlite3_context*,int);
int (*test_control)(int, ...);
void (*randomness)(int,void*);
sqlite3 *(*context_db_handle)(sqlite3_context*);
int (*extended_result_codes)(sqlite3*,int);
int (*limit)(sqlite3*,int,int);
sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
const char *(*sql)(sqlite3_stmt*);
int (*status)(int,int*,int*,int);
int (*backup_finish)(sqlite3_backup*);
sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
int (*backup_pagecount)(sqlite3_backup*);
int (*backup_remaining)(sqlite3_backup*);
int (*backup_step)(sqlite3_backup*,int);
const char *(*compileoption_get)(int);
int (*compileoption_used)(const char*);
int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*),
void(*xDestroy)(void*));
int (*db_config)(sqlite3*,int,...);
sqlite3_mutex *(*db_mutex)(sqlite3*);
int (*db_status)(sqlite3*,int,int*,int*,int);
int (*extended_errcode)(sqlite3*);
void (*log)(int,const char*,...);
sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
const char *(*sourceid)(void);
int (*stmt_status)(sqlite3_stmt*,int,int);
int (*strnicmp)(const char*,const char*,int);
int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
int (*wal_autocheckpoint)(sqlite3*,int);
int (*wal_checkpoint)(sqlite3*,const char*);
void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
int (*vtab_config)(sqlite3*,int op,...);
int (*vtab_on_conflict)(sqlite3*);
/* Version 3.7.16 and later */
int (*close_v2)(sqlite3*);
const char *(*db_filename)(sqlite3*,const char*);
int (*db_readonly)(sqlite3*,const char*);
int (*db_release_memory)(sqlite3*);
const char *(*errstr)(int);
int (*stmt_busy)(sqlite3_stmt*);
int (*stmt_readonly)(sqlite3_stmt*);
int (*stricmp)(const char*,const char*);
int (*uri_boolean)(const char*,const char*,int);
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
const char *(*uri_parameter)(const char*,const char*);
char *(*vsnprintf)(int,char*,const char*,va_list);
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
/* Version 3.8.7 and later */
int (*auto_extension)(void(*)(void));
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
void(*)(void*));
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
void(*)(void*),unsigned char);
int (*cancel_auto_extension)(void(*)(void));
int (*load_extension)(sqlite3*,const char*,const char*,char**);
void *(*malloc64)(sqlite3_uint64);
sqlite3_uint64 (*msize)(void*);
void *(*realloc64)(void*,sqlite3_uint64);
void (*reset_auto_extension)(void);
void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
void(*)(void*));
void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
void(*)(void*), unsigned char);
int (*strglob)(const char*,const char*);
};
/*
** The following macros redefine the API routines so that they are
** redirected through the global sqlite3_api structure.
**
** This header file is also used by the loadext.c source file
** (part of the main SQLite library - not an extension) so that
** it can get access to the sqlite3_api_routines structure
** definition. But the main library does not want to redefine
** the API. So the redefinition macros are only valid if the
** SQLITE_CORE macros is undefined.
*/
#ifndef SQLITE_CORE
#define sqlite3_aggregate_context sqlite3_api->aggregate_context
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_aggregate_count sqlite3_api->aggregate_count
#endif
#define sqlite3_bind_blob sqlite3_api->bind_blob
#define sqlite3_bind_double sqlite3_api->bind_double
#define sqlite3_bind_int sqlite3_api->bind_int
#define sqlite3_bind_int64 sqlite3_api->bind_int64
#define sqlite3_bind_null sqlite3_api->bind_null
#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count
#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index
#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name
#define sqlite3_bind_text sqlite3_api->bind_text
#define sqlite3_bind_text16 sqlite3_api->bind_text16
#define sqlite3_bind_value sqlite3_api->bind_value
#define sqlite3_busy_handler sqlite3_api->busy_handler
#define sqlite3_busy_timeout sqlite3_api->busy_timeout
#define sqlite3_changes sqlite3_api->changes
#define sqlite3_close sqlite3_api->close
#define sqlite3_collation_needed sqlite3_api->collation_needed
#define sqlite3_collation_needed16 sqlite3_api->collation_needed16
#define sqlite3_column_blob sqlite3_api->column_blob
#define sqlite3_column_bytes sqlite3_api->column_bytes
#define sqlite3_column_bytes16 sqlite3_api->column_bytes16
#define sqlite3_column_count sqlite3_api->column_count
#define sqlite3_column_database_name sqlite3_api->column_database_name
#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
#define sqlite3_column_decltype sqlite3_api->column_decltype
#define sqlite3_column_decltype16 sqlite3_api->column_decltype16
#define sqlite3_column_double sqlite3_api->column_double
#define sqlite3_column_int sqlite3_api->column_int
#define sqlite3_column_int64 sqlite3_api->column_int64
#define sqlite3_column_name sqlite3_api->column_name
#define sqlite3_column_name16 sqlite3_api->column_name16
#define sqlite3_column_origin_name sqlite3_api->column_origin_name
#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16
#define sqlite3_column_table_name sqlite3_api->column_table_name
#define sqlite3_column_table_name16 sqlite3_api->column_table_name16
#define sqlite3_column_text sqlite3_api->column_text
#define sqlite3_column_text16 sqlite3_api->column_text16
#define sqlite3_column_type sqlite3_api->column_type
#define sqlite3_column_value sqlite3_api->column_value
#define sqlite3_commit_hook sqlite3_api->commit_hook
#define sqlite3_complete sqlite3_api->complete
#define sqlite3_complete16 sqlite3_api->complete16
#define sqlite3_create_collation sqlite3_api->create_collation
#define sqlite3_create_collation16 sqlite3_api->create_collation16
#define sqlite3_create_function sqlite3_api->create_function
#define sqlite3_create_function16 sqlite3_api->create_function16
#define sqlite3_create_module sqlite3_api->create_module
#define sqlite3_create_module_v2 sqlite3_api->create_module_v2
#define sqlite3_data_count sqlite3_api->data_count
#define sqlite3_db_handle sqlite3_api->db_handle
#define sqlite3_declare_vtab sqlite3_api->declare_vtab
#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache
#define sqlite3_errcode sqlite3_api->errcode
#define sqlite3_errmsg sqlite3_api->errmsg
#define sqlite3_errmsg16 sqlite3_api->errmsg16
#define sqlite3_exec sqlite3_api->exec
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_expired sqlite3_api->expired
#endif
#define sqlite3_finalize sqlite3_api->finalize
#define sqlite3_free sqlite3_api->free
#define sqlite3_free_table sqlite3_api->free_table
#define sqlite3_get_autocommit sqlite3_api->get_autocommit
#define sqlite3_get_auxdata sqlite3_api->get_auxdata
#define sqlite3_get_table sqlite3_api->get_table
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_global_recover sqlite3_api->global_recover
#endif
#define sqlite3_interrupt sqlite3_api->interruptx
#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid
#define sqlite3_libversion sqlite3_api->libversion
#define sqlite3_libversion_number sqlite3_api->libversion_number
#define sqlite3_malloc sqlite3_api->malloc
#define sqlite3_mprintf sqlite3_api->mprintf
#define sqlite3_open sqlite3_api->open
#define sqlite3_open16 sqlite3_api->open16
#define sqlite3_prepare sqlite3_api->prepare
#define sqlite3_prepare16 sqlite3_api->prepare16
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#define sqlite3_profile sqlite3_api->profile
#define sqlite3_progress_handler sqlite3_api->progress_handler
#define sqlite3_realloc sqlite3_api->realloc
#define sqlite3_reset sqlite3_api->reset
#define sqlite3_result_blob sqlite3_api->result_blob
#define sqlite3_result_double sqlite3_api->result_double
#define sqlite3_result_error sqlite3_api->result_error
#define sqlite3_result_error16 sqlite3_api->result_error16
#define sqlite3_result_int sqlite3_api->result_int
#define sqlite3_result_int64 sqlite3_api->result_int64
#define sqlite3_result_null sqlite3_api->result_null
#define sqlite3_result_text sqlite3_api->result_text
#define sqlite3_result_text16 sqlite3_api->result_text16
#define sqlite3_result_text16be sqlite3_api->result_text16be
#define sqlite3_result_text16le sqlite3_api->result_text16le
#define sqlite3_result_value sqlite3_api->result_value
#define sqlite3_rollback_hook sqlite3_api->rollback_hook
#define sqlite3_set_authorizer sqlite3_api->set_authorizer
#define sqlite3_set_auxdata sqlite3_api->set_auxdata
#define sqlite3_snprintf sqlite3_api->snprintf
#define sqlite3_step sqlite3_api->step
#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
#define sqlite3_total_changes sqlite3_api->total_changes
#define sqlite3_trace sqlite3_api->trace
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings
#endif
#define sqlite3_update_hook sqlite3_api->update_hook
#define sqlite3_user_data sqlite3_api->user_data
#define sqlite3_value_blob sqlite3_api->value_blob
#define sqlite3_value_bytes sqlite3_api->value_bytes
#define sqlite3_value_bytes16 sqlite3_api->value_bytes16
#define sqlite3_value_double sqlite3_api->value_double
#define sqlite3_value_int sqlite3_api->value_int
#define sqlite3_value_int64 sqlite3_api->value_int64
#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type
#define sqlite3_value_text sqlite3_api->value_text
#define sqlite3_value_text16 sqlite3_api->value_text16
#define sqlite3_value_text16be sqlite3_api->value_text16be
#define sqlite3_value_text16le sqlite3_api->value_text16le
#define sqlite3_value_type sqlite3_api->value_type
#define sqlite3_vmprintf sqlite3_api->vmprintf
#define sqlite3_overload_function sqlite3_api->overload_function
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#define sqlite3_clear_bindings sqlite3_api->clear_bindings
#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob
#define sqlite3_blob_bytes sqlite3_api->blob_bytes
#define sqlite3_blob_close sqlite3_api->blob_close
#define sqlite3_blob_open sqlite3_api->blob_open
#define sqlite3_blob_read sqlite3_api->blob_read
#define sqlite3_blob_write sqlite3_api->blob_write
#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2
#define sqlite3_file_control sqlite3_api->file_control
#define sqlite3_memory_highwater sqlite3_api->memory_highwater
#define sqlite3_memory_used sqlite3_api->memory_used
#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc
#define sqlite3_mutex_enter sqlite3_api->mutex_enter
#define sqlite3_mutex_free sqlite3_api->mutex_free
#define sqlite3_mutex_leave sqlite3_api->mutex_leave
#define sqlite3_mutex_try sqlite3_api->mutex_try
#define sqlite3_open_v2 sqlite3_api->open_v2
#define sqlite3_release_memory sqlite3_api->release_memory
#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem
#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig
#define sqlite3_sleep sqlite3_api->sleep
#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit
#define sqlite3_vfs_find sqlite3_api->vfs_find
#define sqlite3_vfs_register sqlite3_api->vfs_register
#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
#define sqlite3_threadsafe sqlite3_api->xthreadsafe
#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob
#define sqlite3_result_error_code sqlite3_api->result_error_code
#define sqlite3_test_control sqlite3_api->test_control
#define sqlite3_randomness sqlite3_api->randomness
#define sqlite3_context_db_handle sqlite3_api->context_db_handle
#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes
#define sqlite3_limit sqlite3_api->limit
#define sqlite3_next_stmt sqlite3_api->next_stmt
#define sqlite3_sql sqlite3_api->sql
#define sqlite3_status sqlite3_api->status
#define sqlite3_backup_finish sqlite3_api->backup_finish
#define sqlite3_backup_init sqlite3_api->backup_init
#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount
#define sqlite3_backup_remaining sqlite3_api->backup_remaining
#define sqlite3_backup_step sqlite3_api->backup_step
#define sqlite3_compileoption_get sqlite3_api->compileoption_get
#define sqlite3_compileoption_used sqlite3_api->compileoption_used
#define sqlite3_create_function_v2 sqlite3_api->create_function_v2
#define sqlite3_db_config sqlite3_api->db_config
#define sqlite3_db_mutex sqlite3_api->db_mutex
#define sqlite3_db_status sqlite3_api->db_status
#define sqlite3_extended_errcode sqlite3_api->extended_errcode
#define sqlite3_log sqlite3_api->log
#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64
#define sqlite3_sourceid sqlite3_api->sourceid
#define sqlite3_stmt_status sqlite3_api->stmt_status
#define sqlite3_strnicmp sqlite3_api->strnicmp
#define sqlite3_unlock_notify sqlite3_api->unlock_notify
#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint
#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint
#define sqlite3_wal_hook sqlite3_api->wal_hook
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
#define sqlite3_vtab_config sqlite3_api->vtab_config
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
/* Version 3.7.16 and later */
#define sqlite3_close_v2 sqlite3_api->close_v2
#define sqlite3_db_filename sqlite3_api->db_filename
#define sqlite3_db_readonly sqlite3_api->db_readonly
#define sqlite3_db_release_memory sqlite3_api->db_release_memory
#define sqlite3_errstr sqlite3_api->errstr
#define sqlite3_stmt_busy sqlite3_api->stmt_busy
#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly
#define sqlite3_stricmp sqlite3_api->stricmp
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
#define sqlite3_uri_int64 sqlite3_api->uri_int64
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
/* Version 3.8.7 and later */
#define sqlite3_auto_extension sqlite3_api->auto_extension
#define sqlite3_bind_blob64 sqlite3_api->bind_blob64
#define sqlite3_bind_text64 sqlite3_api->bind_text64
#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
#define sqlite3_load_extension sqlite3_api->load_extension
#define sqlite3_malloc64 sqlite3_api->malloc64
#define sqlite3_msize sqlite3_api->msize
#define sqlite3_realloc64 sqlite3_api->realloc64
#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
#define sqlite3_result_blob64 sqlite3_api->result_blob64
#define sqlite3_result_text64 sqlite3_api->result_text64
#define sqlite3_strglob sqlite3_api->strglob
#endif /* SQLITE_CORE */
#ifndef SQLITE_CORE
/* This case when the file really is being compiled as a loadable
** extension */
# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v;
# define SQLITE_EXTENSION_INIT3 \
extern const sqlite3_api_routines *sqlite3_api;
#else
/* This case when the file is being statically linked into the
** application */
# define SQLITE_EXTENSION_INIT1 /*no-op*/
# define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */
# define SQLITE_EXTENSION_INIT3 /*no-op*/
#endif
#endif /* _SQLITE3EXT_H_ */