Permalink
Browse files

Build Firebird backend using patch from Sergei Nikulov

  • Loading branch information...
vnaydionov committed Feb 10, 2013
1 parent c18cf35 commit 60c947340f58f556f93743558c8afdb9f48a31c6
@@ -0,0 +1,9 @@
soci_backend(Firebird
DEPENDS Firebird
HEADERS soci-firebird.h common.h
DESCRIPTION "SOCI backend for Firebird database engine"
AUTHORS "TBD"
MAINTAINERS "TBD")
add_subdirectory(test)
@@ -0,0 +1,5 @@
soci_backend_test(
BACKEND Firebird
SOURCE test-firebird.cpp
CONNSTR "dummy")
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
#include <ctime>
#include <cstring>
using namespace soci;
@@ -86,6 +87,7 @@ void test2()
sql << "delete from test2";
}
#if 0
{
char msg[] = "Hello, Firebird!";
char buf1[100], buf2[100], buf3[100];
@@ -96,18 +98,7 @@ void test2()
sql << "insert into test2(p1, p2) values (?,?)", use(b1, 100), use(b1, 100);
sql << "select p1, p2 from test2", into(b2, 100), into(b3, 100);
assert(
buf2[0] == 'H' && buf3[0] == 'H' &&
buf2[1] == 'e' && buf3[1] == 'e' &&
buf2[2] == 'l' && buf3[2] == 'l' &&
buf2[3] == 'l' && buf3[3] == 'l' &&
buf2[4] == 'o' && buf3[4] == 'o' &&
buf2[5] == ',' && buf3[5] == ',' &&
buf2[6] == ' ' && buf3[6] == ' ' &&
buf2[7] == 'F' && buf3[7] == 'F' &&
buf2[8] == 'i' && buf3[8] == 'i' &&
buf2[9] == 'r' && buf3[9] == 'r' &&
buf2[10] == '\0' && buf3[10] == '\0');
assert(!std::strcmp(buf2, buf3) && !std::strcmp(buf2, "Hello, Fir"));
sql << "delete from test2";
}
@@ -121,18 +112,19 @@ void test2()
use(buf1), use(buf1);
sql << "select p1, p2 from test2", into(buf2), into(buf3);
assert(
buf2[0] == 'H' && buf3[0] == 'H' &&
buf2[1] == 'e' && buf3[1] == 'e' &&
buf2[2] == 'l' && buf3[2] == 'l' &&
buf2[3] == 'l' && buf3[3] == 'l' &&
buf2[4] == 'o' && buf3[4] == 'o' &&
buf2[5] == ',' && buf3[5] == ',' &&
buf2[6] == ' ' && buf3[6] == ' ' &&
buf2[7] == 'F' && buf3[7] == 'F' &&
buf2[8] == 'i' && buf3[8] == 'i' &&
buf2[9] == 'r' && buf3[9] == 'r' &&
buf2[10] == '\0' && buf3[10] == '\0');
assert(!std::strcmp(buf2, buf3) && !std::strcmp(buf2, "Hello, Fir"));
sql << "delete from test2";
}
#endif
{
std::string b1("Hello, Firebird!"), b2, b3;
sql << "insert into test2(p1, p2) values (?,?)", use(b1), use(b1);
sql << "select p1, p2 from test2", into(b2), into(b3);
assert(b2 == b3 && b2 == "Hello, Fir");
sql << "delete from test2";
}
@@ -144,7 +136,9 @@ void test2()
sql << "insert into test2(p1) values(\'" << msg << "\')";
char buf[20];
sql << "select p1 from test2", into(buf);
std::string buf_str;
sql << "select p1 from test2", into(buf_str);
std::strcpy(buf, buf_str.c_str());
assert(std::strncmp(buf, msg, 5) == 0);
assert(std::strncmp(buf+5, " ", 5) == 0);
@@ -322,7 +316,8 @@ void test5()
assert(ind == i_null);
char buf[4];
sql << "select \'Hello\' from rdb$database", into(buf, ind);
std::string buf_str;
sql << "select \'Hello\' from rdb$database", into(buf_str, ind);
assert(ind == i_truncated);
sql << "select 5 from rdb$database where 0 = 1", into(i, ind);
@@ -1069,9 +1064,9 @@ void test11()
// Support for soci Common Tests
//
struct table_creator_1 : public tests::table_creator_base
struct TableCreator1 : public tests::table_creator_base
{
table_creator_1(session & sql)
TableCreator1(session & sql)
: tests::table_creator_base(sql)
{
sql << "create table soci_test(id integer, val integer, c char, "
@@ -1082,9 +1077,9 @@ struct table_creator_1 : public tests::table_creator_base
}
};
struct table_creator_2 : public tests::table_creator_base
struct TableCreator2 : public tests::table_creator_base
{
table_creator_2(session & sql)
TableCreator2(session & sql)
: tests::table_creator_base(sql)
{
sql << "create table soci_test(\"num_float\" float, \"num_int\" integer, "
@@ -1094,9 +1089,9 @@ struct table_creator_2 : public tests::table_creator_base
}
};
struct table_creator_3 : public tests::table_creator_base
struct TableCreator3 : public tests::table_creator_base
{
table_creator_3(session & sql)
TableCreator3(session & sql)
: tests::table_creator_base(sql)
{
// CommonTest uses lower-case column names,
@@ -24,7 +24,8 @@ set(SOCI_BACKENDS_DB_DEPENDENCIES
ODBC
Oracle
PostgreSQL
SQLite3)
SQLite3
Firebird)
set(SOCI_BACKENDS_ALL_DEPENDENCIES
Boost
@@ -0,0 +1,6 @@
set(Firebird_FIND_QUIETLY TRUE)
find_package(Firebird)
boost_external_report(Firebird INCLUDE_DIR LIBRARIES VERSION)
@@ -0,0 +1,35 @@
##############################################################
# Copyright (c) 2008 Daniel Pfeifer #
# #
# Distributed under the Boost Software License, Version 1.0. #
##############################################################
# This module defines
# FIREBIRD_INCLUDE_DIR - where to find ibase.h
# FIREBIRD_LIBRARIES - the libraries to link against to use FIREBIRD
# FIREBIRD_FOUND - true if FIREBIRD was found
cmake_minimum_required(VERSION 2.6)
find_path(FIREBIRD_INCLUDE_DIR ibase.h
/usr/include
$ENV{ProgramFiles}/Firebird/*/include
)
find_library(FIREBIRD_LIBRARIES
NAMES
fbclient
fbclient_ms
PATHS
/usr/lib
$ENV{ProgramFiles}/Firebird/*/lib
)
# fbembed ?
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Firebird
DEFAULT_MSG FIREBIRD_LIBRARIES FIREBIRD_INCLUDE_DIR)
mark_as_advanced(FIREBIRD_INCLUDE_DIR FIREBIRD_LIBRARIES)

0 comments on commit 60c9473

Please sign in to comment.