libtabula

Check-in [5f36ef6682]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merged trunk changes
Timelines: family | ancestors | descendants | both | mysql-type-info
Files: files | file ages | folders
SHA1: 5f36ef6682c03d0baee1c554d7a03b2c2c680e51
User & Date: tangent 2015-08-14 05:40:12
Context
2015-08-14
05:52
Comment change check-in: 135cd93ba4 user: tangent tags: mysql-type-info
05:40
Merged trunk changes check-in: 5f36ef6682 user: tangent tags: mysql-type-info
05:39
Regenerated bmark.txt to remove CRs from cgi_jpeg output now that tests run to completion on OS X. (Earlier success report was on CentOS 5.) check-in: 3fa3f424bf user: tangent tags: trunk
03:55
Merged trunk changes in check-in: f2cdede2a0 user: tangent tags: mysql-type-info
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to CMakeLists.txt.

85
86
87
88
89
90
91




92
93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)

# Try to find some kind of "stdint" type header.
find_path(LIBTABULA_HAVE_CSTDINT cstdint)
if (LIBTABULA_HAVE_CSTDINT)
	message("found C++11's <cstdint> header")
else()




	find_path(LIBTABULA_HAVE_BOOST_CSTDINT boost/cstdint.hpp)
	if (LIBTABULA_HAVE_BOOST_CSTDINT)
		message("found <boost/cstdint.hpp>")
	else()
		find_path(LIBTABULA_HAVE_STDINT_H stdint.h)
		if (LIBTABULA_HAVE_STDINT_H)
			message("found C99's <stdint.h>; hope we can use it in C++")
		else()
			message(SEND_ERROR "WARNING: no 'stdint' type header found!")

		endif()
	endif()
endif()

set(MYSQL_FIND_REQUIRED 1)
find_package(MySQL)








>
>
>
>
|
|
|
|
|
|
|
|
|
>







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)

# Try to find some kind of "stdint" type header.
find_path(LIBTABULA_HAVE_CSTDINT cstdint)
if (LIBTABULA_HAVE_CSTDINT)
	message("found C++11's <cstdint> header")
else()
	find_path(LIBTABULA_HAVE_TR1_CSTDINT tr1/cstdint)
	if (LIBTABULA_HAVE_TR1_CSTDINT)
		message("found <tr1/cstdint>")
	else()
		find_path(LIBTABULA_HAVE_BOOST_CSTDINT boost/cstdint.hpp)
		if (LIBTABULA_HAVE_BOOST_CSTDINT)
			message("found <boost/cstdint.hpp>")
		else()
			find_path(LIBTABULA_HAVE_STDINT_H stdint.h)
			if (LIBTABULA_HAVE_STDINT_H)
				message("found C99's <stdint.h>; hope we can use it in C++")
			else()
				message(SEND_ERROR "WARNING: no 'stdint' type header found!")
			endif()
		endif()
	endif()
endif()

set(MYSQL_FIND_REQUIRED 1)
find_package(MySQL)

Changes to bmark.txt.

239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257

---------------- BEGIN load_jpeg OUTPUT ----------------
Inserted "NULL" into images table, 0 bytes, ID 1
================ END load_jpeg OUTPUT ================

---------------- BEGIN cgi_jpeg OUTPUT ----------------
Content-type: text/plain

No image content!
================ END cgi_jpeg OUTPUT ================

--- BEGIN ssqlsxlat -i common.ssqls -o ERROR OUTPUT ---
==== END ssqlsxlat -i common.ssqls -o ERROR OUTPUT ====
--- BEGIN ssqlsxlat -i stock.ssqls -o ERROR OUTPUT ---
==== END ssqlsxlat -i stock.ssqls -o ERROR OUTPUT ====
--- BEGIN ssqlsxlat -i test1.ssqls -o ERROR OUTPUT ---
==== END ssqlsxlat -i test1.ssqls -o ERROR OUTPUT ====
--- BEGIN ssqlsxlat -i test2.ssqls -o ERROR OUTPUT ---
==== END ssqlsxlat -i test2.ssqls -o ERROR OUTPUT ====







<











239
240
241
242
243
244
245

246
247
248
249
250
251
252
253
254
255
256

---------------- BEGIN load_jpeg OUTPUT ----------------
Inserted "NULL" into images table, 0 bytes, ID 1
================ END load_jpeg OUTPUT ================

---------------- BEGIN cgi_jpeg OUTPUT ----------------
Content-type: text/plain

No image content!
================ END cgi_jpeg OUTPUT ================

--- BEGIN ssqlsxlat -i common.ssqls -o ERROR OUTPUT ---
==== END ssqlsxlat -i common.ssqls -o ERROR OUTPUT ====
--- BEGIN ssqlsxlat -i stock.ssqls -o ERROR OUTPUT ---
==== END ssqlsxlat -i stock.ssqls -o ERROR OUTPUT ====
--- BEGIN ssqlsxlat -i test1.ssqls -o ERROR OUTPUT ---
==== END ssqlsxlat -i test1.ssqls -o ERROR OUTPUT ====
--- BEGIN ssqlsxlat -i test2.ssqls -o ERROR OUTPUT ---
==== END ssqlsxlat -i test2.ssqls -o ERROR OUTPUT ====

Changes to src/query.cpp.

1
2
3
4

5


6
7
8
9
10
11
12
..
25
26
27
28
29
30
31

32
33
34
35
36
37
38
...
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
...
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
...
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
/***********************************************************************
 query.cpp - Implements the Query class.

 Copyright © 1998 by Kevin Atkinson, © 1999-2001 by MySQL AB,

 and © 2004-2009, 2014 by Educational Technology Resources, Inc.


 Others may also hold copyrights on code in this file.  See the
 CREDITS.txt file in the top directory of the distribution for details.

 This file is part of libtabula.

 libtabula is free software; you can redistribute it and/or modify it
 under the terms of the GNU Lesser General Public License as published
................................................................................
***********************************************************************/

#include "query.h"

#include "autoflag.h"
#include "dbdriver.h"
#include "connection.h"


namespace libtabula {

// Force insertfrom() policy template instantiation.  Required to make 
// VC++ happy.
Query::RowCountInsertPolicy<Transaction> RowCountInsertPolicyI(0);
Query::SizeThresholdInsertPolicy<Transaction> SizeThresholdInsertPolicyI(0);
................................................................................
{
	if ((parse_elems_.size() == 2) && !template_defaults.processing_) {
		// We're a template query and this isn't a recursive call, so
		// take s to be a lone parameter for the query.  We will come
		// back in here with a completed query, but the processing_
		// flag will be set, allowing us to avoid an infinite loop.
		AutoFlag<> af(template_defaults.processing_);
		return execute(SQLQueryParms() << str << len );
	}
	if ((copacetic_ = conn_->driver()->execute(str, len)) == true) {
		if (parse_elems_.size() == 0) {
			// Not a template query, so auto-reset
			reset();
		}
		return SimpleResult(conn_, insert_id(), affected_rows());
................................................................................
{
	if ((parse_elems_.size() == 2) && !template_defaults.processing_) {
		// We're a template query and this isn't a recursive call, so
		// take s to be a lone parameter for the query.  We will come
		// back in here with a completed query, but the processing_
		// flag will be set, allowing us to avoid an infinite loop.
		AutoFlag<> af(template_defaults.processing_);
		return store(SQLQueryParms() << str << len );
	}

	DBDriver* dbd = conn_->driver();
	if ((copacetic_ = dbd->execute(str, len)) == true) {
		if (ResultBase::Impl* pres = dbd->store_result()) {
			if (parse_elems_.size() == 0) reset();	// not tquery
			return StoreQueryResult(pres, dbd->num_rows(*pres), dbd,
................................................................................
{
	if ((parse_elems_.size() == 2) && !template_defaults.processing_) {
		// We're a template query and this isn't a recursive call, so
		// take s to be a lone parameter for the query.  We will come
		// back in here with a completed query, but the processing_
		// flag will be set, allowing us to avoid an infinite loop.
		AutoFlag<> af(template_defaults.processing_);
		return use(SQLQueryParms() << str << len);
	}

	DBDriver* dbd = conn_->driver();
	if ((copacetic_ = dbd->execute(str, len)) == true) {
		if (ResultBase::Impl* pres = dbd->use_result()) {
			if (parse_elems_.size() == 0) reset();	// not tquery
			return UseQueryResult(pres, dbd, throw_exceptions());



|
>
|
>
>







 







>







 







|







 







|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
...
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
...
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
...
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
/***********************************************************************
 query.cpp - Implements the Query class.

 Copyright © 1998 by Kevin Atkinson,
 © 1999-2001 by MySQL AB,
 © 2004-2009, 2014 by Educational Technology Resources, Inc., and
 © 2015 by Warren Young.
 
 Others may also hold copyrights on code in this file.  See the
 CREDITS.txt file in the top directory of the distribution for details.

 This file is part of libtabula.

 libtabula is free software; you can redistribute it and/or modify it
 under the terms of the GNU Lesser General Public License as published
................................................................................
***********************************************************************/

#include "query.h"

#include "autoflag.h"
#include "dbdriver.h"
#include "connection.h"
#include "sql_types.h"

namespace libtabula {

// Force insertfrom() policy template instantiation.  Required to make 
// VC++ happy.
Query::RowCountInsertPolicy<Transaction> RowCountInsertPolicyI(0);
Query::SizeThresholdInsertPolicy<Transaction> SizeThresholdInsertPolicyI(0);
................................................................................
{
	if ((parse_elems_.size() == 2) && !template_defaults.processing_) {
		// We're a template query and this isn't a recursive call, so
		// take s to be a lone parameter for the query.  We will come
		// back in here with a completed query, but the processing_
		// flag will be set, allowing us to avoid an infinite loop.
		AutoFlag<> af(template_defaults.processing_);
		return execute(SQLQueryParms() << sql_text(str, len));
	}
	if ((copacetic_ = conn_->driver()->execute(str, len)) == true) {
		if (parse_elems_.size() == 0) {
			// Not a template query, so auto-reset
			reset();
		}
		return SimpleResult(conn_, insert_id(), affected_rows());
................................................................................
{
	if ((parse_elems_.size() == 2) && !template_defaults.processing_) {
		// We're a template query and this isn't a recursive call, so
		// take s to be a lone parameter for the query.  We will come
		// back in here with a completed query, but the processing_
		// flag will be set, allowing us to avoid an infinite loop.
		AutoFlag<> af(template_defaults.processing_);
		return store(SQLQueryParms() << sql_text(str, len));
	}

	DBDriver* dbd = conn_->driver();
	if ((copacetic_ = dbd->execute(str, len)) == true) {
		if (ResultBase::Impl* pres = dbd->store_result()) {
			if (parse_elems_.size() == 0) reset();	// not tquery
			return StoreQueryResult(pres, dbd->num_rows(*pres), dbd,
................................................................................
{
	if ((parse_elems_.size() == 2) && !template_defaults.processing_) {
		// We're a template query and this isn't a recursive call, so
		// take s to be a lone parameter for the query.  We will come
		// back in here with a completed query, but the processing_
		// flag will be set, allowing us to avoid an infinite loop.
		AutoFlag<> af(template_defaults.processing_);
		return use(SQLQueryParms() << sql_text(str, len));
	}

	DBDriver* dbd = conn_->driver();
	if ((copacetic_ = dbd->execute(str, len)) == true) {
		if (ResultBase::Impl* pres = dbd->use_result()) {
			if (parse_elems_.size() == 0) reset();	// not tquery
			return UseQueryResult(pres, dbd, throw_exceptions());

Changes to src/sql_types.h.

34
35
36
37
38
39
40


41
42
43
44
45
46
47
..
61
62
63
64
65
66
67












68
69
70
71
72
73
74
#include "common.h"
#include "tiny_int.h"

#include <string>

#if defined(LIBTABULA_HAVE_CSTDINT)
#	include <cstdint>


#elif defined(LIBTABULA_HAVE_BOOST_CSTDINT)
#	include <boost/cstdint.hpp>
#elif defined(LIBTABULA_HAVE_STDINT_H)
#	include <stdint.h>
#endif

namespace libtabula {
................................................................................
	typedef std::uint16_t			sql_smallint_unsigned;
	typedef std::int32_t			sql_int;
	typedef std::uint32_t			sql_int_unsigned;
	typedef std::int32_t			sql_mediumint;
	typedef std::uint32_t			sql_mediumint_unsigned;
	typedef std::int64_t			sql_bigint;
	typedef std::uint64_t			sql_bigint_unsigned;












#elif defined(LIBTABULA_HAVE_BOOST_CSTDINT)
	// Next best case: found the Boost emulation for this C++11 feature
	typedef tiny_int<boost::int8_t>	sql_tinyint;
	typedef tiny_int<boost::uint8_t>sql_tinyint_unsigned;
	typedef boost::int16_t			sql_smallint;
	typedef boost::uint16_t			sql_smallint_unsigned;
	typedef boost::int32_t			sql_int;







>
>







 







>
>
>
>
>
>
>
>
>
>
>
>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "common.h"
#include "tiny_int.h"

#include <string>

#if defined(LIBTABULA_HAVE_CSTDINT)
#	include <cstdint>
#elif defined(LIBTABULA_HAVE_TR1_CSTDINT)
#	include <tr1/cstdint>
#elif defined(LIBTABULA_HAVE_BOOST_CSTDINT)
#	include <boost/cstdint.hpp>
#elif defined(LIBTABULA_HAVE_STDINT_H)
#	include <stdint.h>
#endif

namespace libtabula {
................................................................................
	typedef std::uint16_t			sql_smallint_unsigned;
	typedef std::int32_t			sql_int;
	typedef std::uint32_t			sql_int_unsigned;
	typedef std::int32_t			sql_mediumint;
	typedef std::uint32_t			sql_mediumint_unsigned;
	typedef std::int64_t			sql_bigint;
	typedef std::uint64_t			sql_bigint_unsigned;
#elif defined(LIBTABULA_HAVE_TR1_CSTDINT)
	// Next best case: found the TR1 precursor for this C++11 feature
	typedef tiny_int<std::tr1::int8_t>sql_tinyint;
	typedef tiny_int<std::tr1::uint8_t>sql_tinyint_unsigned;
	typedef std::tr1::int16_t		sql_smallint;
	typedef std::tr1::uint16_t		sql_smallint_unsigned;
	typedef std::tr1::int32_t		sql_int;
	typedef std::tr1::uint32_t		sql_int_unsigned;
	typedef std::tr1::int32_t		sql_mediumint;
	typedef std::tr1::uint32_t		sql_mediumint_unsigned;
	typedef std::tr1::int64_t		sql_bigint;
	typedef std::tr1::uint64_t		sql_bigint_unsigned;
#elif defined(LIBTABULA_HAVE_BOOST_CSTDINT)
	// Next best case: found the Boost emulation for this C++11 feature
	typedef tiny_int<boost::int8_t>	sql_tinyint;
	typedef tiny_int<boost::uint8_t>sql_tinyint_unsigned;
	typedef boost::int16_t			sql_smallint;
	typedef boost::uint16_t			sql_smallint_unsigned;
	typedef boost::int32_t			sql_int;