mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-08 14:48:32 -04:00
applied a patch from RKITOVER (#80087) and added a fix to it
This commit is contained in:
parent
9e041ebad8
commit
2dfb20bdb2
2 changed files with 33 additions and 1 deletions
5
dbdimp.c
5
dbdimp.c
|
@ -39,6 +39,7 @@ imp_dbh_t *last_executed_dbh; /* needed by perl_tokenizer
|
|||
#define sqlite_trace(h,xxh,level,what) if ( DBIc_TRACE_LEVEL((imp_xxh_t*)xxh) >= level ) _sqlite_trace(aTHX_ __FILE__, __LINE__, h, (imp_xxh_t*)xxh, what)
|
||||
#define sqlite_exec(h,sql) _sqlite_exec(aTHX_ h, imp_dbh->db, sql)
|
||||
#define sqlite_open(dbname,db) _sqlite_open(aTHX_ dbh, dbname, db)
|
||||
#define _isspace(c) (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\v' || c == '\f')
|
||||
|
||||
static void
|
||||
_sqlite_trace(pTHX_ char *file, int line, SV *h, imp_xxh_t *imp_xxh, const char *what)
|
||||
|
@ -741,6 +742,7 @@ sqlite_st_execute(SV *sth, imp_sth_t *imp_sth)
|
|||
if (sqlite3_get_autocommit(imp_dbh->db)) {
|
||||
/* COMPAT: sqlite3_sql is only available for 3006000 or newer */
|
||||
const char *sql = sqlite3_sql(imp_sth->stmt);
|
||||
while ( _isspace(sql[0]) ) sql++;
|
||||
if ((sql[0] == 'B' || sql[0] == 'b') &&
|
||||
(sql[1] == 'E' || sql[1] == 'e') &&
|
||||
(sql[2] == 'G' || sql[2] == 'g') &&
|
||||
|
@ -766,6 +768,7 @@ sqlite_st_execute(SV *sth, imp_sth_t *imp_sth)
|
|||
else if (DBIc_is(imp_dbh, DBIcf_BegunWork)) {
|
||||
/* COMPAT: sqlite3_sql is only available for 3006000 or newer */
|
||||
const char *sql = sqlite3_sql(imp_sth->stmt);
|
||||
while ( _isspace(sql[0]) ) sql++;
|
||||
if (((sql[0] == 'C' || sql[0] == 'c') &&
|
||||
(sql[1] == 'O' || sql[1] == 'o') &&
|
||||
(sql[2] == 'M' || sql[2] == 'm') &&
|
||||
|
@ -787,7 +790,7 @@ sqlite_st_execute(SV *sth, imp_sth_t *imp_sth)
|
|||
int l = strlen(sql);
|
||||
bool is_savepoint = FALSE;
|
||||
for(i = 8; i < l; i++) {
|
||||
if (sql[i] == ' ' || sql[i] == '\t') continue;
|
||||
if (_isspace(sql[i])) continue;
|
||||
if (sql[i] == 'T' || sql[i] == 't') {
|
||||
if ((sql[i+0] == 'T' || sql[i+0] == 't') &&
|
||||
(sql[i+1] == 'R' || sql[i+1] == 'r') &&
|
||||
|
|
29
t/54_literal_txn.t
Normal file
29
t/54_literal_txn.t
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
BEGIN {
|
||||
$| = 1;
|
||||
$^W = 1;
|
||||
}
|
||||
|
||||
use t::lib::Test qw/connect_ok/;
|
||||
use Test::More;
|
||||
|
||||
my $dbh = connect_ok();
|
||||
|
||||
is $dbh->{AutoCommit}, 1,
|
||||
'AutoCommit=1 at connection';
|
||||
|
||||
$dbh->do('BEGIN TRANSACTION');
|
||||
|
||||
is $dbh->{AutoCommit}, '',
|
||||
"AutoCommit='' after 'BEGIN TRANSACTION'";
|
||||
|
||||
$dbh->do("SELECT 1 FROM sqlite_master LIMIT 1");
|
||||
|
||||
$dbh->do("\nCOMMIT");
|
||||
|
||||
is $dbh->{AutoCommit}, 1,
|
||||
'AutoCommit=1 after "\nCOMMIT"';
|
||||
|
||||
done_testing;
|
Loading…
Add table
Reference in a new issue