mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge branch '10.0' into 10.1
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -25,6 +25,7 @@ pcre/testdata/greppatN4 -text
|
|||||||
*.MYD binary
|
*.MYD binary
|
||||||
*.MYI binary
|
*.MYI binary
|
||||||
*.class binary
|
*.class binary
|
||||||
|
*.jar binary
|
||||||
|
|
||||||
*.c diff=cpp
|
*.c diff=cpp
|
||||||
*.h diff=cpp
|
*.h diff=cpp
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ static void die(const char* fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void kill_child(bool was_killed)
|
static int kill_child(bool was_killed)
|
||||||
{
|
{
|
||||||
int status= 0;
|
int status= 0;
|
||||||
|
|
||||||
@@ -108,15 +108,15 @@ static void kill_child(bool was_killed)
|
|||||||
exit_code= WEXITSTATUS(status);
|
exit_code= WEXITSTATUS(status);
|
||||||
message("Child exit: %d", exit_code);
|
message("Child exit: %d", exit_code);
|
||||||
// Exit with exit status of the child
|
// Exit with exit status of the child
|
||||||
exit(exit_code);
|
return exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WIFSIGNALED(status))
|
if (WIFSIGNALED(status))
|
||||||
message("Child killed by signal: %d", WTERMSIG(status));
|
message("Child killed by signal: %d", WTERMSIG(status));
|
||||||
|
|
||||||
exit(exit_code);
|
return exit_code;
|
||||||
}
|
}
|
||||||
exit(5);
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ extern "C" void handle_signal(int sig)
|
|||||||
terminated= 1;
|
terminated= 1;
|
||||||
|
|
||||||
if (child_pid > 0)
|
if (child_pid > 0)
|
||||||
kill_child(sig == SIGCHLD);
|
_exit(kill_child(sig == SIGCHLD));
|
||||||
|
|
||||||
// Ignore further signals
|
// Ignore further signals
|
||||||
signal(SIGTERM, SIG_IGN);
|
signal(SIGTERM, SIG_IGN);
|
||||||
@@ -300,8 +300,6 @@ int main(int argc, char* const argv[] )
|
|||||||
/* Wait for parent or child to die */
|
/* Wait for parent or child to die */
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
kill_child(0);
|
return kill_child(0);
|
||||||
|
|
||||||
return 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
5
mysql-test/r/connect_debug.result
Normal file
5
mysql-test/r/connect_debug.result
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
set @old_dbug=@@global.debug_dbug;
|
||||||
|
set global debug_dbug='+d,auth_disconnect';
|
||||||
|
create user 'bad' identified by 'worse';
|
||||||
|
set global debug_dbug=@old_dbug;
|
||||||
|
drop user bad;
|
||||||
@@ -130,3 +130,37 @@ SET @@innodb_lock_wait_timeout= @innodb_lock_wait_timeout_saved;
|
|||||||
#
|
#
|
||||||
# BUG 16041903: End of test case
|
# BUG 16041903: End of test case
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
# MDEV-15035: SP using query with outer join and a parameter
|
||||||
|
# in ON expression
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
id int NOT NULL,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1), (2);
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
id int NOT NULL,
|
||||||
|
id_foo int NOT NULL,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t2 VALUES (1, 1);
|
||||||
|
DROP PROCEDURE IF EXISTS test_proc;
|
||||||
|
CREATE PROCEDURE test_proc(IN param int)
|
||||||
|
LANGUAGE SQL
|
||||||
|
READS SQL DATA
|
||||||
|
BEGIN
|
||||||
|
SELECT DISTINCT f.id
|
||||||
|
FROM t1 f
|
||||||
|
LEFT OUTER JOIN t2 b ON b.id_foo = f.id
|
||||||
|
WHERE (param <> 0 OR b.id IS NOT NULL);
|
||||||
|
END|
|
||||||
|
CALL test_proc(0);
|
||||||
|
id
|
||||||
|
1
|
||||||
|
CALL test_proc(1);
|
||||||
|
id
|
||||||
|
1
|
||||||
|
2
|
||||||
|
DROP PROCEDURE IF EXISTS test_proc;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|||||||
@@ -3161,4 +3161,30 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where (<cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))))) where 1
|
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where (<cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))))) where 1
|
||||||
DROP TABLE t1,t2,t3,t4;
|
DROP TABLE t1,t2,t3,t4;
|
||||||
|
#
|
||||||
|
# MDEV-13699: Assertion `!new_field->field_name.str ||
|
||||||
|
# strlen(new_field->field_name.str) == new_field->field_name.length'
|
||||||
|
# failed in create_tmp_table on 2nd execution of PS with semijoin
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE TABLE t2 (b INT);
|
||||||
|
INSERT INTO t2 VALUES (3),(4);
|
||||||
|
CREATE TABLE t3 (c INT);
|
||||||
|
CREATE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
|
||||||
|
INSERT INTO t3 VALUES (5),(6);
|
||||||
|
PREPARE stmt FROM
|
||||||
|
"SELECT * FROM t1
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT * FROM t2 WHERE t1.a IN ( SELECT c AS fld FROM v3 )
|
||||||
|
)";
|
||||||
|
EXECUTE stmt;
|
||||||
|
a
|
||||||
|
EXECUTE stmt;
|
||||||
|
a
|
||||||
|
EXECUTE stmt;
|
||||||
|
a
|
||||||
|
drop view v3;
|
||||||
|
drop table t1,t2,t3;
|
||||||
|
# End of 5.5 test
|
||||||
set optimizer_switch=@subselect_sj_tmp;
|
set optimizer_switch=@subselect_sj_tmp;
|
||||||
|
|||||||
@@ -3175,6 +3175,32 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where (<cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))))) where 1
|
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where (<cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))))) where 1
|
||||||
DROP TABLE t1,t2,t3,t4;
|
DROP TABLE t1,t2,t3,t4;
|
||||||
|
#
|
||||||
|
# MDEV-13699: Assertion `!new_field->field_name.str ||
|
||||||
|
# strlen(new_field->field_name.str) == new_field->field_name.length'
|
||||||
|
# failed in create_tmp_table on 2nd execution of PS with semijoin
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE TABLE t2 (b INT);
|
||||||
|
INSERT INTO t2 VALUES (3),(4);
|
||||||
|
CREATE TABLE t3 (c INT);
|
||||||
|
CREATE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
|
||||||
|
INSERT INTO t3 VALUES (5),(6);
|
||||||
|
PREPARE stmt FROM
|
||||||
|
"SELECT * FROM t1
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT * FROM t2 WHERE t1.a IN ( SELECT c AS fld FROM v3 )
|
||||||
|
)";
|
||||||
|
EXECUTE stmt;
|
||||||
|
a
|
||||||
|
EXECUTE stmt;
|
||||||
|
a
|
||||||
|
EXECUTE stmt;
|
||||||
|
a
|
||||||
|
drop view v3;
|
||||||
|
drop table t1,t2,t3;
|
||||||
|
# End of 5.5 test
|
||||||
set optimizer_switch=@subselect_sj_tmp;
|
set optimizer_switch=@subselect_sj_tmp;
|
||||||
#
|
#
|
||||||
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
|
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ DROP TABLE t1;
|
|||||||
#
|
#
|
||||||
# MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION
|
# MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION
|
||||||
#
|
#
|
||||||
create table t1 (i int) partition by range(i) (partition p0 values less than (10));
|
--eval create table t1 (i int) engine=$engine partition by range(i) (partition p0 values less than (10))
|
||||||
lock table t1 write;
|
lock table t1 write;
|
||||||
--error ER_SAME_NAME_PARTITION
|
--error ER_SAME_NAME_PARTITION
|
||||||
alter table t1 add partition (partition p0 values less than (20));
|
alter table t1 add partition (partition p0 values less than (20));
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ PARTITION p3 VALUES IN (4,5,6)
|
|||||||
);
|
);
|
||||||
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
|
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1 (i int) partition by range(i) (partition p0 values less than (10));
|
create table t1 (i int) engine=InnoDB partition by range(i) (partition p0 values less than (10));
|
||||||
lock table t1 write;
|
lock table t1 write;
|
||||||
alter table t1 add partition (partition p0 values less than (20));
|
alter table t1 add partition (partition p0 values less than (20));
|
||||||
ERROR HY000: Duplicate partition name p0
|
ERROR HY000: Duplicate partition name p0
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ PARTITION p3 VALUES IN (4,5,6)
|
|||||||
);
|
);
|
||||||
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
|
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1 (i int) partition by range(i) (partition p0 values less than (10));
|
create table t1 (i int) engine=Aria partition by range(i) (partition p0 values less than (10));
|
||||||
lock table t1 write;
|
lock table t1 write;
|
||||||
alter table t1 add partition (partition p0 values less than (20));
|
alter table t1 add partition (partition p0 values less than (20));
|
||||||
ERROR HY000: Duplicate partition name p0
|
ERROR HY000: Duplicate partition name p0
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ PARTITION p3 VALUES IN (4,5,6)
|
|||||||
);
|
);
|
||||||
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
|
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1 (i int) partition by range(i) (partition p0 values less than (10));
|
create table t1 (i int) engine=MyISAM partition by range(i) (partition p0 values less than (10));
|
||||||
lock table t1 write;
|
lock table t1 write;
|
||||||
alter table t1 add partition (partition p0 values less than (20));
|
alter table t1 add partition (partition p0 values less than (20));
|
||||||
ERROR HY000: Duplicate partition name p0
|
ERROR HY000: Duplicate partition name p0
|
||||||
|
|||||||
12
mysql-test/t/connect_debug.test
Normal file
12
mysql-test/t/connect_debug.test
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
source include/have_debug.inc;
|
||||||
|
set @old_dbug=@@global.debug_dbug;
|
||||||
|
|
||||||
|
#
|
||||||
|
# use after free if need plugin change and auth aborted
|
||||||
|
#
|
||||||
|
set global debug_dbug='+d,auth_disconnect';
|
||||||
|
create user 'bad' identified by 'worse';
|
||||||
|
--error 1
|
||||||
|
--exec $MYSQL --default-auth=mysql_old_password --user=bad --password=worse
|
||||||
|
set global debug_dbug=@old_dbug;
|
||||||
|
drop user bad;
|
||||||
@@ -158,5 +158,47 @@ SET @@innodb_lock_wait_timeout= @innodb_lock_wait_timeout_saved;
|
|||||||
--echo # BUG 16041903: End of test case
|
--echo # BUG 16041903: End of test case
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-15035: SP using query with outer join and a parameter
|
||||||
|
--echo # in ON expression
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
id int NOT NULL,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES (1), (2);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
id int NOT NULL,
|
||||||
|
id_foo int NOT NULL,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
INSERT INTO t2 VALUES (1, 1);
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP PROCEDURE IF EXISTS test_proc;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
DELIMITER |;
|
||||||
|
CREATE PROCEDURE test_proc(IN param int)
|
||||||
|
LANGUAGE SQL
|
||||||
|
READS SQL DATA
|
||||||
|
BEGIN
|
||||||
|
SELECT DISTINCT f.id
|
||||||
|
FROM t1 f
|
||||||
|
LEFT OUTER JOIN t2 b ON b.id_foo = f.id
|
||||||
|
WHERE (param <> 0 OR b.id IS NOT NULL);
|
||||||
|
END|
|
||||||
|
DELIMITER ;|
|
||||||
|
|
||||||
|
CALL test_proc(0);
|
||||||
|
CALL test_proc(1);
|
||||||
|
|
||||||
|
DROP PROCEDURE IF EXISTS test_proc;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
# Wait till we reached the initial number of concurrent sessions
|
# Wait till we reached the initial number of concurrent sessions
|
||||||
--source include/wait_until_count_sessions.inc
|
--source include/wait_until_count_sessions.inc
|
||||||
|
|||||||
@@ -2845,5 +2845,35 @@ eval EXPLAIN EXTENDED $q2;
|
|||||||
|
|
||||||
DROP TABLE t1,t2,t3,t4;
|
DROP TABLE t1,t2,t3,t4;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-13699: Assertion `!new_field->field_name.str ||
|
||||||
|
--echo # strlen(new_field->field_name.str) == new_field->field_name.length'
|
||||||
|
--echo # failed in create_tmp_table on 2nd execution of PS with semijoin
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (b INT);
|
||||||
|
INSERT INTO t2 VALUES (3),(4);
|
||||||
|
|
||||||
|
CREATE TABLE t3 (c INT);
|
||||||
|
CREATE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
|
||||||
|
INSERT INTO t3 VALUES (5),(6);
|
||||||
|
|
||||||
|
PREPARE stmt FROM
|
||||||
|
"SELECT * FROM t1
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT * FROM t2 WHERE t1.a IN ( SELECT c AS fld FROM v3 )
|
||||||
|
)";
|
||||||
|
EXECUTE stmt;
|
||||||
|
EXECUTE stmt;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
drop view v3;
|
||||||
|
drop table t1,t2,t3;
|
||||||
|
|
||||||
|
--echo # End of 5.5 test
|
||||||
|
|
||||||
# The following command must be the last one the file
|
# The following command must be the last one the file
|
||||||
set optimizer_switch=@subselect_sj_tmp;
|
set optimizer_switch=@subselect_sj_tmp;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Email domain: cam.ac.uk
|
|||||||
University of Cambridge Computing Service,
|
University of Cambridge Computing Service,
|
||||||
Cambridge, England.
|
Cambridge, England.
|
||||||
|
|
||||||
Copyright (c) 1997-2017 University of Cambridge
|
Copyright (c) 1997-2018 University of Cambridge
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ Written by: Zoltan Herczeg
|
|||||||
Email local part: hzmester
|
Email local part: hzmester
|
||||||
Emain domain: freemail.hu
|
Emain domain: freemail.hu
|
||||||
|
|
||||||
Copyright(c) 2010-2017 Zoltan Herczeg
|
Copyright(c) 2010-2018 Zoltan Herczeg
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ Written by: Zoltan Herczeg
|
|||||||
Email local part: hzmester
|
Email local part: hzmester
|
||||||
Emain domain: freemail.hu
|
Emain domain: freemail.hu
|
||||||
|
|
||||||
Copyright(c) 2009-2017 Zoltan Herczeg
|
Copyright(c) 2009-2018 Zoltan Herczeg
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,59 @@ ChangeLog for PCRE
|
|||||||
Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All
|
Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All
|
||||||
development is happening in the PCRE2 10.xx series.
|
development is happening in the PCRE2 10.xx series.
|
||||||
|
|
||||||
|
|
||||||
|
Version 8.42 20-March-2018
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
1. Fixed a MIPS issue in the JIT compiler reported by Joshua Kinard.
|
||||||
|
|
||||||
|
2. Fixed outdated real_pcre definitions in pcre.h.in (patch by Evgeny Kotkov).
|
||||||
|
|
||||||
|
3. pcregrep was truncating components of file names to 128 characters when
|
||||||
|
processing files with the -r option, and also (some very odd code) truncating
|
||||||
|
path names to 512 characters. There is now a check on the absolute length of
|
||||||
|
full path file names, which may be up to 2047 characters long.
|
||||||
|
|
||||||
|
4. Using pcre_dfa_exec(), in UTF mode when UCP support was not defined, there
|
||||||
|
was the possibility of a false positive match when caselessly matching a "not
|
||||||
|
this character" item such as [^\x{1234}] (with a code point greater than 127)
|
||||||
|
because the "other case" variable was not being initialized.
|
||||||
|
|
||||||
|
5. Although pcre_jit_exec checks whether the pattern is compiled
|
||||||
|
in a given mode, it was also expected that at least one mode is available.
|
||||||
|
This is fixed and pcre_jit_exec returns with PCRE_ERROR_JIT_BADOPTION
|
||||||
|
when the pattern is not optimized by JIT at all.
|
||||||
|
|
||||||
|
6. The line number and related variables such as match counts in pcregrep
|
||||||
|
were all int variables, causing overflow when files with more than 2147483647
|
||||||
|
lines were processed (assuming 32-bit ints). They have all been changed to
|
||||||
|
unsigned long ints.
|
||||||
|
|
||||||
|
7. If a backreference with a minimum repeat count of zero was first in a
|
||||||
|
pattern, apart from assertions, an incorrect first matching character could be
|
||||||
|
recorded. For example, for the pattern /(?=(a))\1?b/, "b" was incorrectly set
|
||||||
|
as the first character of a match.
|
||||||
|
|
||||||
|
8. Fix out-of-bounds read for partial matching of /./ against an empty string
|
||||||
|
when the newline type is CRLF.
|
||||||
|
|
||||||
|
9. When matching using the the REG_STARTEND feature of the POSIX API with a
|
||||||
|
non-zero starting offset, unset capturing groups with lower numbers than a
|
||||||
|
group that did capture something were not being correctly returned as "unset"
|
||||||
|
(that is, with offset values of -1).
|
||||||
|
|
||||||
|
10. Matching the pattern /(*UTF)\C[^\v]+\x80/ against an 8-bit string
|
||||||
|
containing multi-code-unit characters caused bad behaviour and possibly a
|
||||||
|
crash. This issue was fixed for other kinds of repeat in release 8.37 by change
|
||||||
|
38, but repeating character classes were overlooked.
|
||||||
|
|
||||||
|
11. A small fix to pcregrep to avoid compiler warnings for -Wformat-overflow=2.
|
||||||
|
|
||||||
|
12. Added --enable-jit=auto support to configure.ac.
|
||||||
|
|
||||||
|
13. Fix misleading error message in configure.ac.
|
||||||
|
|
||||||
|
|
||||||
Version 8.41 05-July-2017
|
Version 8.41 05-July-2017
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|||||||
316
pcre/INSTALL
316
pcre/INSTALL
@@ -1,8 +1,8 @@
|
|||||||
Installation Instructions
|
Installation Instructions
|
||||||
*************************
|
*************************
|
||||||
|
|
||||||
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
|
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
|
||||||
Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
Copying and distribution of this file, with or without modification,
|
Copying and distribution of this file, with or without modification,
|
||||||
are permitted in any medium without royalty provided the copyright
|
are permitted in any medium without royalty provided the copyright
|
||||||
@@ -12,97 +12,96 @@ without warranty of any kind.
|
|||||||
Basic Installation
|
Basic Installation
|
||||||
==================
|
==================
|
||||||
|
|
||||||
Briefly, the shell command `./configure && make && make install'
|
Briefly, the shell command './configure && make && make install'
|
||||||
should configure, build, and install this package. The following
|
should configure, build, and install this package. The following
|
||||||
more-detailed instructions are generic; see the `README' file for
|
more-detailed instructions are generic; see the 'README' file for
|
||||||
instructions specific to this package. Some packages provide this
|
instructions specific to this package. Some packages provide this
|
||||||
`INSTALL' file but do not implement all of the features documented
|
'INSTALL' file but do not implement all of the features documented
|
||||||
below. The lack of an optional feature in a given package is not
|
below. The lack of an optional feature in a given package is not
|
||||||
necessarily a bug. More recommendations for GNU packages can be found
|
necessarily a bug. More recommendations for GNU packages can be found
|
||||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||||
|
|
||||||
The `configure' shell script attempts to guess correct values for
|
The 'configure' shell script attempts to guess correct values for
|
||||||
various system-dependent variables used during compilation. It uses
|
various system-dependent variables used during compilation. It uses
|
||||||
those values to create a `Makefile' in each directory of the package.
|
those values to create a 'Makefile' in each directory of the package.
|
||||||
It may also create one or more `.h' files containing system-dependent
|
It may also create one or more '.h' files containing system-dependent
|
||||||
definitions. Finally, it creates a shell script `config.status' that
|
definitions. Finally, it creates a shell script 'config.status' that
|
||||||
you can run in the future to recreate the current configuration, and a
|
you can run in the future to recreate the current configuration, and a
|
||||||
file `config.log' containing compiler output (useful mainly for
|
file 'config.log' containing compiler output (useful mainly for
|
||||||
debugging `configure').
|
debugging 'configure').
|
||||||
|
|
||||||
It can also use an optional file (typically called `config.cache'
|
It can also use an optional file (typically called 'config.cache' and
|
||||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||||
the results of its tests to speed up reconfiguring. Caching is
|
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||||
disabled by default to prevent problems with accidental use of stale
|
default to prevent problems with accidental use of stale cache files.
|
||||||
cache files.
|
|
||||||
|
|
||||||
If you need to do unusual things to compile the package, please try
|
If you need to do unusual things to compile the package, please try
|
||||||
to figure out how `configure' could check whether to do them, and mail
|
to figure out how 'configure' could check whether to do them, and mail
|
||||||
diffs or instructions to the address given in the `README' so they can
|
diffs or instructions to the address given in the 'README' so they can
|
||||||
be considered for the next release. If you are using the cache, and at
|
be considered for the next release. If you are using the cache, and at
|
||||||
some point `config.cache' contains results you don't want to keep, you
|
some point 'config.cache' contains results you don't want to keep, you
|
||||||
may remove or edit it.
|
may remove or edit it.
|
||||||
|
|
||||||
The file `configure.ac' (or `configure.in') is used to create
|
The file 'configure.ac' (or 'configure.in') is used to create
|
||||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||||
you want to change it or regenerate `configure' using a newer version
|
you want to change it or regenerate 'configure' using a newer version of
|
||||||
of `autoconf'.
|
'autoconf'.
|
||||||
|
|
||||||
The simplest way to compile this package is:
|
The simplest way to compile this package is:
|
||||||
|
|
||||||
1. `cd' to the directory containing the package's source code and type
|
1. 'cd' to the directory containing the package's source code and type
|
||||||
`./configure' to configure the package for your system.
|
'./configure' to configure the package for your system.
|
||||||
|
|
||||||
Running `configure' might take a while. While running, it prints
|
Running 'configure' might take a while. While running, it prints
|
||||||
some messages telling which features it is checking for.
|
some messages telling which features it is checking for.
|
||||||
|
|
||||||
2. Type `make' to compile the package.
|
2. Type 'make' to compile the package.
|
||||||
|
|
||||||
3. Optionally, type `make check' to run any self-tests that come with
|
3. Optionally, type 'make check' to run any self-tests that come with
|
||||||
the package, generally using the just-built uninstalled binaries.
|
the package, generally using the just-built uninstalled binaries.
|
||||||
|
|
||||||
4. Type `make install' to install the programs and any data files and
|
4. Type 'make install' to install the programs and any data files and
|
||||||
documentation. When installing into a prefix owned by root, it is
|
documentation. When installing into a prefix owned by root, it is
|
||||||
recommended that the package be configured and built as a regular
|
recommended that the package be configured and built as a regular
|
||||||
user, and only the `make install' phase executed with root
|
user, and only the 'make install' phase executed with root
|
||||||
privileges.
|
privileges.
|
||||||
|
|
||||||
5. Optionally, type `make installcheck' to repeat any self-tests, but
|
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||||
this time using the binaries in their final installed location.
|
this time using the binaries in their final installed location.
|
||||||
This target does not install anything. Running this target as a
|
This target does not install anything. Running this target as a
|
||||||
regular user, particularly if the prior `make install' required
|
regular user, particularly if the prior 'make install' required
|
||||||
root privileges, verifies that the installation completed
|
root privileges, verifies that the installation completed
|
||||||
correctly.
|
correctly.
|
||||||
|
|
||||||
6. You can remove the program binaries and object files from the
|
6. You can remove the program binaries and object files from the
|
||||||
source code directory by typing `make clean'. To also remove the
|
source code directory by typing 'make clean'. To also remove the
|
||||||
files that `configure' created (so you can compile the package for
|
files that 'configure' created (so you can compile the package for
|
||||||
a different kind of computer), type `make distclean'. There is
|
a different kind of computer), type 'make distclean'. There is
|
||||||
also a `make maintainer-clean' target, but that is intended mainly
|
also a 'make maintainer-clean' target, but that is intended mainly
|
||||||
for the package's developers. If you use it, you may have to get
|
for the package's developers. If you use it, you may have to get
|
||||||
all sorts of other programs in order to regenerate files that came
|
all sorts of other programs in order to regenerate files that came
|
||||||
with the distribution.
|
with the distribution.
|
||||||
|
|
||||||
7. Often, you can also type `make uninstall' to remove the installed
|
7. Often, you can also type 'make uninstall' to remove the installed
|
||||||
files again. In practice, not all packages have tested that
|
files again. In practice, not all packages have tested that
|
||||||
uninstallation works correctly, even though it is required by the
|
uninstallation works correctly, even though it is required by the
|
||||||
GNU Coding Standards.
|
GNU Coding Standards.
|
||||||
|
|
||||||
8. Some packages, particularly those that use Automake, provide `make
|
8. Some packages, particularly those that use Automake, provide 'make
|
||||||
distcheck', which can by used by developers to test that all other
|
distcheck', which can by used by developers to test that all other
|
||||||
targets like `make install' and `make uninstall' work correctly.
|
targets like 'make install' and 'make uninstall' work correctly.
|
||||||
This target is generally not run by end users.
|
This target is generally not run by end users.
|
||||||
|
|
||||||
Compilers and Options
|
Compilers and Options
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
Some systems require unusual options for compilation or linking that
|
Some systems require unusual options for compilation or linking that
|
||||||
the `configure' script does not know about. Run `./configure --help'
|
the 'configure' script does not know about. Run './configure --help'
|
||||||
for details on some of the pertinent environment variables.
|
for details on some of the pertinent environment variables.
|
||||||
|
|
||||||
You can give `configure' initial values for configuration parameters
|
You can give 'configure' initial values for configuration parameters
|
||||||
by setting variables in the command line or in the environment. Here
|
by setting variables in the command line or in the environment. Here is
|
||||||
is an example:
|
an example:
|
||||||
|
|
||||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||||
|
|
||||||
@@ -113,21 +112,21 @@ Compiling For Multiple Architectures
|
|||||||
|
|
||||||
You can compile the package for more than one kind of computer at the
|
You can compile the package for more than one kind of computer at the
|
||||||
same time, by placing the object files for each architecture in their
|
same time, by placing the object files for each architecture in their
|
||||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||||
directory where you want the object files and executables to go and run
|
directory where you want the object files and executables to go and run
|
||||||
the `configure' script. `configure' automatically checks for the
|
the 'configure' script. 'configure' automatically checks for the source
|
||||||
source code in the directory that `configure' is in and in `..'. This
|
code in the directory that 'configure' is in and in '..'. This is known
|
||||||
is known as a "VPATH" build.
|
as a "VPATH" build.
|
||||||
|
|
||||||
With a non-GNU `make', it is safer to compile the package for one
|
With a non-GNU 'make', it is safer to compile the package for one
|
||||||
architecture at a time in the source code directory. After you have
|
architecture at a time in the source code directory. After you have
|
||||||
installed the package for one architecture, use `make distclean' before
|
installed the package for one architecture, use 'make distclean' before
|
||||||
reconfiguring for another architecture.
|
reconfiguring for another architecture.
|
||||||
|
|
||||||
On MacOS X 10.5 and later systems, you can create libraries and
|
On MacOS X 10.5 and later systems, you can create libraries and
|
||||||
executables that work on multiple system types--known as "fat" or
|
executables that work on multiple system types--known as "fat" or
|
||||||
"universal" binaries--by specifying multiple `-arch' options to the
|
"universal" binaries--by specifying multiple '-arch' options to the
|
||||||
compiler but only a single `-arch' option to the preprocessor. Like
|
compiler but only a single '-arch' option to the preprocessor. Like
|
||||||
this:
|
this:
|
||||||
|
|
||||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||||
@@ -136,105 +135,104 @@ this:
|
|||||||
|
|
||||||
This is not guaranteed to produce working output in all cases, you
|
This is not guaranteed to produce working output in all cases, you
|
||||||
may have to build one architecture at a time and combine the results
|
may have to build one architecture at a time and combine the results
|
||||||
using the `lipo' tool if you have problems.
|
using the 'lipo' tool if you have problems.
|
||||||
|
|
||||||
Installation Names
|
Installation Names
|
||||||
==================
|
==================
|
||||||
|
|
||||||
By default, `make install' installs the package's commands under
|
By default, 'make install' installs the package's commands under
|
||||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||||
can specify an installation prefix other than `/usr/local' by giving
|
can specify an installation prefix other than '/usr/local' by giving
|
||||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
|
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||||
absolute file name.
|
absolute file name.
|
||||||
|
|
||||||
You can specify separate installation prefixes for
|
You can specify separate installation prefixes for
|
||||||
architecture-specific files and architecture-independent files. If you
|
architecture-specific files and architecture-independent files. If you
|
||||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||||
PREFIX as the prefix for installing programs and libraries.
|
PREFIX as the prefix for installing programs and libraries.
|
||||||
Documentation and other data files still use the regular prefix.
|
Documentation and other data files still use the regular prefix.
|
||||||
|
|
||||||
In addition, if you use an unusual directory layout you can give
|
In addition, if you use an unusual directory layout you can give
|
||||||
options like `--bindir=DIR' to specify different values for particular
|
options like '--bindir=DIR' to specify different values for particular
|
||||||
kinds of files. Run `configure --help' for a list of the directories
|
kinds of files. Run 'configure --help' for a list of the directories
|
||||||
you can set and what kinds of files go in them. In general, the
|
you can set and what kinds of files go in them. In general, the default
|
||||||
default for these options is expressed in terms of `${prefix}', so that
|
for these options is expressed in terms of '${prefix}', so that
|
||||||
specifying just `--prefix' will affect all of the other directory
|
specifying just '--prefix' will affect all of the other directory
|
||||||
specifications that were not explicitly provided.
|
specifications that were not explicitly provided.
|
||||||
|
|
||||||
The most portable way to affect installation locations is to pass the
|
The most portable way to affect installation locations is to pass the
|
||||||
correct locations to `configure'; however, many packages provide one or
|
correct locations to 'configure'; however, many packages provide one or
|
||||||
both of the following shortcuts of passing variable assignments to the
|
both of the following shortcuts of passing variable assignments to the
|
||||||
`make install' command line to change installation locations without
|
'make install' command line to change installation locations without
|
||||||
having to reconfigure or recompile.
|
having to reconfigure or recompile.
|
||||||
|
|
||||||
The first method involves providing an override variable for each
|
The first method involves providing an override variable for each
|
||||||
affected directory. For example, `make install
|
affected directory. For example, 'make install
|
||||||
prefix=/alternate/directory' will choose an alternate location for all
|
prefix=/alternate/directory' will choose an alternate location for all
|
||||||
directory configuration variables that were expressed in terms of
|
directory configuration variables that were expressed in terms of
|
||||||
`${prefix}'. Any directories that were specified during `configure',
|
'${prefix}'. Any directories that were specified during 'configure',
|
||||||
but not in terms of `${prefix}', must each be overridden at install
|
but not in terms of '${prefix}', must each be overridden at install time
|
||||||
time for the entire installation to be relocated. The approach of
|
for the entire installation to be relocated. The approach of makefile
|
||||||
makefile variable overrides for each directory variable is required by
|
variable overrides for each directory variable is required by the GNU
|
||||||
the GNU Coding Standards, and ideally causes no recompilation.
|
Coding Standards, and ideally causes no recompilation. However, some
|
||||||
However, some platforms have known limitations with the semantics of
|
platforms have known limitations with the semantics of shared libraries
|
||||||
shared libraries that end up requiring recompilation when using this
|
that end up requiring recompilation when using this method, particularly
|
||||||
method, particularly noticeable in packages that use GNU Libtool.
|
noticeable in packages that use GNU Libtool.
|
||||||
|
|
||||||
The second method involves providing the `DESTDIR' variable. For
|
The second method involves providing the 'DESTDIR' variable. For
|
||||||
example, `make install DESTDIR=/alternate/directory' will prepend
|
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||||
`/alternate/directory' before all installation names. The approach of
|
'/alternate/directory' before all installation names. The approach of
|
||||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
|
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||||
does not work on platforms that have drive letters. On the other hand,
|
does not work on platforms that have drive letters. On the other hand,
|
||||||
it does better at avoiding recompilation issues, and works well even
|
it does better at avoiding recompilation issues, and works well even
|
||||||
when some directory options were not specified in terms of `${prefix}'
|
when some directory options were not specified in terms of '${prefix}'
|
||||||
at `configure' time.
|
at 'configure' time.
|
||||||
|
|
||||||
Optional Features
|
Optional Features
|
||||||
=================
|
=================
|
||||||
|
|
||||||
If the package supports it, you can cause programs to be installed
|
If the package supports it, you can cause programs to be installed
|
||||||
with an extra prefix or suffix on their names by giving `configure' the
|
with an extra prefix or suffix on their names by giving 'configure' the
|
||||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||||
|
|
||||||
Some packages pay attention to `--enable-FEATURE' options to
|
Some packages pay attention to '--enable-FEATURE' options to
|
||||||
`configure', where FEATURE indicates an optional part of the package.
|
'configure', where FEATURE indicates an optional part of the package.
|
||||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||||
is something like `gnu-as' or `x' (for the X Window System). The
|
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||||
`README' should mention any `--enable-' and `--with-' options that the
|
'README' should mention any '--enable-' and '--with-' options that the
|
||||||
package recognizes.
|
package recognizes.
|
||||||
|
|
||||||
For packages that use the X Window System, `configure' can usually
|
For packages that use the X Window System, 'configure' can usually
|
||||||
find the X include and library files automatically, but if it doesn't,
|
find the X include and library files automatically, but if it doesn't,
|
||||||
you can use the `configure' options `--x-includes=DIR' and
|
you can use the 'configure' options '--x-includes=DIR' and
|
||||||
`--x-libraries=DIR' to specify their locations.
|
'--x-libraries=DIR' to specify their locations.
|
||||||
|
|
||||||
Some packages offer the ability to configure how verbose the
|
Some packages offer the ability to configure how verbose the
|
||||||
execution of `make' will be. For these packages, running `./configure
|
execution of 'make' will be. For these packages, running './configure
|
||||||
--enable-silent-rules' sets the default to minimal output, which can be
|
--enable-silent-rules' sets the default to minimal output, which can be
|
||||||
overridden with `make V=1'; while running `./configure
|
overridden with 'make V=1'; while running './configure
|
||||||
--disable-silent-rules' sets the default to verbose, which can be
|
--disable-silent-rules' sets the default to verbose, which can be
|
||||||
overridden with `make V=0'.
|
overridden with 'make V=0'.
|
||||||
|
|
||||||
Particular systems
|
Particular systems
|
||||||
==================
|
==================
|
||||||
|
|
||||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||||
CC is not installed, it is recommended to use the following options in
|
is not installed, it is recommended to use the following options in
|
||||||
order to use an ANSI C compiler:
|
order to use an ANSI C compiler:
|
||||||
|
|
||||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||||
|
|
||||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||||
|
|
||||||
HP-UX `make' updates targets which have the same time stamps as
|
HP-UX 'make' updates targets which have the same time stamps as their
|
||||||
their prerequisites, which makes it generally unusable when shipped
|
prerequisites, which makes it generally unusable when shipped generated
|
||||||
generated files such as `configure' are involved. Use GNU `make'
|
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||||
instead.
|
|
||||||
|
|
||||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||||
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
|
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||||
to try
|
try
|
||||||
|
|
||||||
./configure CC="cc"
|
./configure CC="cc"
|
||||||
|
|
||||||
@@ -242,26 +240,26 @@ and if that doesn't work, try
|
|||||||
|
|
||||||
./configure CC="cc -nodtk"
|
./configure CC="cc -nodtk"
|
||||||
|
|
||||||
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
|
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||||
directory contains several dysfunctional programs; working variants of
|
directory contains several dysfunctional programs; working variants of
|
||||||
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
|
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||||
in your `PATH', put it _after_ `/usr/bin'.
|
in your 'PATH', put it _after_ '/usr/bin'.
|
||||||
|
|
||||||
On Haiku, software installed for all users goes in `/boot/common',
|
On Haiku, software installed for all users goes in '/boot/common',
|
||||||
not `/usr/local'. It is recommended to use the following options:
|
not '/usr/local'. It is recommended to use the following options:
|
||||||
|
|
||||||
./configure --prefix=/boot/common
|
./configure --prefix=/boot/common
|
||||||
|
|
||||||
Specifying the System Type
|
Specifying the System Type
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
There may be some features `configure' cannot figure out
|
There may be some features 'configure' cannot figure out
|
||||||
automatically, but needs to determine by the type of machine the package
|
automatically, but needs to determine by the type of machine the package
|
||||||
will run on. Usually, assuming the package is built to be run on the
|
will run on. Usually, assuming the package is built to be run on the
|
||||||
_same_ architectures, `configure' can figure that out, but if it prints
|
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||||
a message saying it cannot guess the machine type, give it the
|
a message saying it cannot guess the machine type, give it the
|
||||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||||
type, such as `sun4', or a canonical name which has the form:
|
type, such as 'sun4', or a canonical name which has the form:
|
||||||
|
|
||||||
CPU-COMPANY-SYSTEM
|
CPU-COMPANY-SYSTEM
|
||||||
|
|
||||||
@@ -270,101 +268,101 @@ where SYSTEM can have one of these forms:
|
|||||||
OS
|
OS
|
||||||
KERNEL-OS
|
KERNEL-OS
|
||||||
|
|
||||||
See the file `config.sub' for the possible values of each field. If
|
See the file 'config.sub' for the possible values of each field. If
|
||||||
`config.sub' isn't included in this package, then this package doesn't
|
'config.sub' isn't included in this package, then this package doesn't
|
||||||
need to know the machine type.
|
need to know the machine type.
|
||||||
|
|
||||||
If you are _building_ compiler tools for cross-compiling, you should
|
If you are _building_ compiler tools for cross-compiling, you should
|
||||||
use the option `--target=TYPE' to select the type of system they will
|
use the option '--target=TYPE' to select the type of system they will
|
||||||
produce code for.
|
produce code for.
|
||||||
|
|
||||||
If you want to _use_ a cross compiler, that generates code for a
|
If you want to _use_ a cross compiler, that generates code for a
|
||||||
platform different from the build platform, you should specify the
|
platform different from the build platform, you should specify the
|
||||||
"host" platform (i.e., that on which the generated programs will
|
"host" platform (i.e., that on which the generated programs will
|
||||||
eventually be run) with `--host=TYPE'.
|
eventually be run) with '--host=TYPE'.
|
||||||
|
|
||||||
Sharing Defaults
|
Sharing Defaults
|
||||||
================
|
================
|
||||||
|
|
||||||
If you want to set default values for `configure' scripts to share,
|
If you want to set default values for 'configure' scripts to share,
|
||||||
you can create a site shell script called `config.site' that gives
|
you can create a site shell script called 'config.site' that gives
|
||||||
default values for variables like `CC', `cache_file', and `prefix'.
|
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||||
`CONFIG_SITE' environment variable to the location of the site script.
|
'CONFIG_SITE' environment variable to the location of the site script.
|
||||||
A warning: not all `configure' scripts look for a site script.
|
A warning: not all 'configure' scripts look for a site script.
|
||||||
|
|
||||||
Defining Variables
|
Defining Variables
|
||||||
==================
|
==================
|
||||||
|
|
||||||
Variables not defined in a site shell script can be set in the
|
Variables not defined in a site shell script can be set in the
|
||||||
environment passed to `configure'. However, some packages may run
|
environment passed to 'configure'. However, some packages may run
|
||||||
configure again during the build, and the customized values of these
|
configure again during the build, and the customized values of these
|
||||||
variables may be lost. In order to avoid this problem, you should set
|
variables may be lost. In order to avoid this problem, you should set
|
||||||
them in the `configure' command line, using `VAR=value'. For example:
|
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||||
|
|
||||||
./configure CC=/usr/local2/bin/gcc
|
./configure CC=/usr/local2/bin/gcc
|
||||||
|
|
||||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||||
overridden in the site shell script).
|
overridden in the site shell script).
|
||||||
|
|
||||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||||
an Autoconf limitation. Until the limitation is lifted, you can use
|
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||||
this workaround:
|
workaround:
|
||||||
|
|
||||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||||
|
|
||||||
`configure' Invocation
|
'configure' Invocation
|
||||||
======================
|
======================
|
||||||
|
|
||||||
`configure' recognizes the following options to control how it
|
'configure' recognizes the following options to control how it
|
||||||
operates.
|
operates.
|
||||||
|
|
||||||
`--help'
|
'--help'
|
||||||
`-h'
|
'-h'
|
||||||
Print a summary of all of the options to `configure', and exit.
|
Print a summary of all of the options to 'configure', and exit.
|
||||||
|
|
||||||
`--help=short'
|
'--help=short'
|
||||||
`--help=recursive'
|
'--help=recursive'
|
||||||
Print a summary of the options unique to this package's
|
Print a summary of the options unique to this package's
|
||||||
`configure', and exit. The `short' variant lists options used
|
'configure', and exit. The 'short' variant lists options used only
|
||||||
only in the top level, while the `recursive' variant lists options
|
in the top level, while the 'recursive' variant lists options also
|
||||||
also present in any nested packages.
|
present in any nested packages.
|
||||||
|
|
||||||
`--version'
|
'--version'
|
||||||
`-V'
|
'-V'
|
||||||
Print the version of Autoconf used to generate the `configure'
|
Print the version of Autoconf used to generate the 'configure'
|
||||||
script, and exit.
|
script, and exit.
|
||||||
|
|
||||||
`--cache-file=FILE'
|
'--cache-file=FILE'
|
||||||
Enable the cache: use and save the results of the tests in FILE,
|
Enable the cache: use and save the results of the tests in FILE,
|
||||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||||
disable caching.
|
disable caching.
|
||||||
|
|
||||||
`--config-cache'
|
'--config-cache'
|
||||||
`-C'
|
'-C'
|
||||||
Alias for `--cache-file=config.cache'.
|
Alias for '--cache-file=config.cache'.
|
||||||
|
|
||||||
`--quiet'
|
'--quiet'
|
||||||
`--silent'
|
'--silent'
|
||||||
`-q'
|
'-q'
|
||||||
Do not print messages saying which checks are being made. To
|
Do not print messages saying which checks are being made. To
|
||||||
suppress all normal output, redirect it to `/dev/null' (any error
|
suppress all normal output, redirect it to '/dev/null' (any error
|
||||||
messages will still be shown).
|
messages will still be shown).
|
||||||
|
|
||||||
`--srcdir=DIR'
|
'--srcdir=DIR'
|
||||||
Look for the package's source code in directory DIR. Usually
|
Look for the package's source code in directory DIR. Usually
|
||||||
`configure' can determine that directory automatically.
|
'configure' can determine that directory automatically.
|
||||||
|
|
||||||
`--prefix=DIR'
|
'--prefix=DIR'
|
||||||
Use DIR as the installation prefix. *note Installation Names::
|
Use DIR as the installation prefix. *note Installation Names:: for
|
||||||
for more details, including other options available for fine-tuning
|
more details, including other options available for fine-tuning the
|
||||||
the installation locations.
|
installation locations.
|
||||||
|
|
||||||
`--no-create'
|
'--no-create'
|
||||||
`-n'
|
'-n'
|
||||||
Run the configure checks, but stop before creating any output
|
Run the configure checks, but stop before creating any output
|
||||||
files.
|
files.
|
||||||
|
|
||||||
`configure' also accepts some other, not widely useful, options. Run
|
'configure' also accepts some other, not widely useful, options. Run
|
||||||
`configure --help' for more details.
|
'configure --help' for more details.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Email domain: cam.ac.uk
|
|||||||
University of Cambridge Computing Service,
|
University of Cambridge Computing Service,
|
||||||
Cambridge, England.
|
Cambridge, England.
|
||||||
|
|
||||||
Copyright (c) 1997-2017 University of Cambridge
|
Copyright (c) 1997-2018 University of Cambridge
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ Written by: Zoltan Herczeg
|
|||||||
Email local part: hzmester
|
Email local part: hzmester
|
||||||
Emain domain: freemail.hu
|
Emain domain: freemail.hu
|
||||||
|
|
||||||
Copyright(c) 2010-2017 Zoltan Herczeg
|
Copyright(c) 2010-2018 Zoltan Herczeg
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ Written by: Zoltan Herczeg
|
|||||||
Email local part: hzmester
|
Email local part: hzmester
|
||||||
Emain domain: freemail.hu
|
Emain domain: freemail.hu
|
||||||
|
|
||||||
Copyright(c) 2009-2017 Zoltan Herczeg
|
Copyright(c) 2009-2018 Zoltan Herczeg
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
News about PCRE releases
|
News about PCRE releases
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
Release 8.42 20-March-2018
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
This is a bug-fix release.
|
||||||
|
|
||||||
|
|
||||||
Release 8.41 13-June-2017
|
Release 8.41 13-June-2017
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -760,13 +760,14 @@ The character code used is EBCDIC, not ASCII or Unicode. In z/OS, UNIX APIs and
|
|||||||
applications can be supported through UNIX System Services, and in such an
|
applications can be supported through UNIX System Services, and in such an
|
||||||
environment PCRE can be built in the same way as in other systems. However, in
|
environment PCRE can be built in the same way as in other systems. However, in
|
||||||
native z/OS (without UNIX System Services) and in z/VM, special ports are
|
native z/OS (without UNIX System Services) and in z/VM, special ports are
|
||||||
required. For details, please see this web site:
|
required. PCRE1 version 8.39 is available in file 882 on this site:
|
||||||
|
|
||||||
http://www.zaconsultants.net
|
http://www.cbttape.org
|
||||||
|
|
||||||
You may download PCRE from WWW.CBTTAPE.ORG, file 882. Everything, source and
|
Everything, source and executable, is in EBCDIC and native z/OS file formats.
|
||||||
executable, is in EBCDIC and native z/OS file formats and this is the
|
However, this software is not maintained and will not be upgraded. If you are
|
||||||
recommended download site.
|
new to PCRE you should be looking at PCRE2 (version 10.30 or later).
|
||||||
|
|
||||||
==========================
|
===============================
|
||||||
Last Updated: 25 June 2015
|
Last Updated: 13 September 2017
|
||||||
|
===============================
|
||||||
|
|||||||
@@ -9,18 +9,18 @@ dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
|
|||||||
dnl be defined as -RC2, for example. For real releases, it should be empty.
|
dnl be defined as -RC2, for example. For real releases, it should be empty.
|
||||||
|
|
||||||
m4_define(pcre_major, [8])
|
m4_define(pcre_major, [8])
|
||||||
m4_define(pcre_minor, [41])
|
m4_define(pcre_minor, [42])
|
||||||
m4_define(pcre_prerelease, [])
|
m4_define(pcre_prerelease, [])
|
||||||
m4_define(pcre_date, [2017-07-05])
|
m4_define(pcre_date, [2018-03-20])
|
||||||
|
|
||||||
# NOTE: The CMakeLists.txt file searches for the above variables in the first
|
# NOTE: The CMakeLists.txt file searches for the above variables in the first
|
||||||
# 50 lines of this file. Please update that if the variables above are moved.
|
# 50 lines of this file. Please update that if the variables above are moved.
|
||||||
|
|
||||||
# Libtool shared library interface versions (current:revision:age)
|
# Libtool shared library interface versions (current:revision:age)
|
||||||
m4_define(libpcre_version, [3:9:2])
|
m4_define(libpcre_version, [3:10:2])
|
||||||
m4_define(libpcre16_version, [2:9:2])
|
m4_define(libpcre16_version, [2:10:2])
|
||||||
m4_define(libpcre32_version, [0:9:0])
|
m4_define(libpcre32_version, [0:10:0])
|
||||||
m4_define(libpcreposix_version, [0:5:0])
|
m4_define(libpcreposix_version, [0:6:0])
|
||||||
m4_define(libpcrecpp_version, [0:1:0])
|
m4_define(libpcrecpp_version, [0:1:0])
|
||||||
|
|
||||||
AC_PREREQ(2.57)
|
AC_PREREQ(2.57)
|
||||||
@@ -155,6 +155,18 @@ AC_ARG_ENABLE(jit,
|
|||||||
[enable Just-In-Time compiling support]),
|
[enable Just-In-Time compiling support]),
|
||||||
, enable_jit=no)
|
, enable_jit=no)
|
||||||
|
|
||||||
|
# This code enables JIT if the hardware supports it.
|
||||||
|
|
||||||
|
if test "$enable_jit" = "auto"; then
|
||||||
|
AC_LANG(C)
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||||
|
#define SLJIT_CONFIG_AUTO 1
|
||||||
|
#include "sljit/sljitConfigInternal.h"
|
||||||
|
#if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
|
||||||
|
#error unsupported
|
||||||
|
#endif]])], enable_jit=yes, enable_jit=no)
|
||||||
|
fi
|
||||||
|
|
||||||
# Handle --disable-pcregrep-jit (enabled by default)
|
# Handle --disable-pcregrep-jit (enabled by default)
|
||||||
AC_ARG_ENABLE(pcregrep-jit,
|
AC_ARG_ENABLE(pcregrep-jit,
|
||||||
AS_HELP_STRING([--disable-pcregrep-jit],
|
AS_HELP_STRING([--disable-pcregrep-jit],
|
||||||
@@ -469,7 +481,7 @@ pcre_have_type_traits="0"
|
|||||||
pcre_have_bits_type_traits="0"
|
pcre_have_bits_type_traits="0"
|
||||||
|
|
||||||
if test "x$enable_cpp" = "xyes" -a -z "$CXX"; then
|
if test "x$enable_cpp" = "xyes" -a -z "$CXX"; then
|
||||||
AC_MSG_ERROR([You need a C++ compiler for C++ support.])
|
AC_MSG_ERROR([Invalid C++ compiler or C++ compiler flags])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$enable_cpp" = "xyes" -a -n "$CXX"
|
if test "x$enable_cpp" = "xyes" -a -n "$CXX"
|
||||||
|
|||||||
@@ -760,13 +760,14 @@ The character code used is EBCDIC, not ASCII or Unicode. In z/OS, UNIX APIs and
|
|||||||
applications can be supported through UNIX System Services, and in such an
|
applications can be supported through UNIX System Services, and in such an
|
||||||
environment PCRE can be built in the same way as in other systems. However, in
|
environment PCRE can be built in the same way as in other systems. However, in
|
||||||
native z/OS (without UNIX System Services) and in z/VM, special ports are
|
native z/OS (without UNIX System Services) and in z/VM, special ports are
|
||||||
required. For details, please see this web site:
|
required. PCRE1 version 8.39 is available in file 882 on this site:
|
||||||
|
|
||||||
http://www.zaconsultants.net
|
http://www.cbttape.org
|
||||||
|
|
||||||
You may download PCRE from WWW.CBTTAPE.ORG, file 882. Everything, source and
|
Everything, source and executable, is in EBCDIC and native z/OS file formats.
|
||||||
executable, is in EBCDIC and native z/OS file formats and this is the
|
However, this software is not maintained and will not be upgraded. If you are
|
||||||
recommended download site.
|
new to PCRE you should be looking at PCRE2 (version 10.30 or later).
|
||||||
|
|
||||||
==========================
|
===============================
|
||||||
Last Updated: 25 June 2015
|
Last Updated: 13 September 2017
|
||||||
|
===============================
|
||||||
|
|||||||
@@ -321,11 +321,11 @@ these bits, just add new ones on the end, in order to remain compatible. */
|
|||||||
|
|
||||||
/* Types */
|
/* Types */
|
||||||
|
|
||||||
struct real_pcre; /* declaration; the definition is private */
|
struct real_pcre8_or_16; /* declaration; the definition is private */
|
||||||
typedef struct real_pcre pcre;
|
typedef struct real_pcre8_or_16 pcre;
|
||||||
|
|
||||||
struct real_pcre16; /* declaration; the definition is private */
|
struct real_pcre8_or_16; /* declaration; the definition is private */
|
||||||
typedef struct real_pcre16 pcre16;
|
typedef struct real_pcre8_or_16 pcre16;
|
||||||
|
|
||||||
struct real_pcre32; /* declaration; the definition is private */
|
struct real_pcre32; /* declaration; the definition is private */
|
||||||
typedef struct real_pcre32 pcre32;
|
typedef struct real_pcre32 pcre32;
|
||||||
|
|||||||
@@ -8063,7 +8063,7 @@ for (;; ptr++)
|
|||||||
single group (i.e. not to a duplicated name. */
|
single group (i.e. not to a duplicated name. */
|
||||||
|
|
||||||
HANDLE_REFERENCE:
|
HANDLE_REFERENCE:
|
||||||
if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
|
if (firstcharflags == REQ_UNSET) zerofirstcharflags = firstcharflags = REQ_NONE;
|
||||||
previous = code;
|
previous = code;
|
||||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||||
*code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;
|
*code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;
|
||||||
|
|||||||
@@ -2287,12 +2287,14 @@ for (;;)
|
|||||||
case OP_NOTI:
|
case OP_NOTI:
|
||||||
if (clen > 0)
|
if (clen > 0)
|
||||||
{
|
{
|
||||||
unsigned int otherd;
|
pcre_uint32 otherd;
|
||||||
#ifdef SUPPORT_UTF
|
#ifdef SUPPORT_UTF
|
||||||
if (utf && d >= 128)
|
if (utf && d >= 128)
|
||||||
{
|
{
|
||||||
#ifdef SUPPORT_UCP
|
#ifdef SUPPORT_UCP
|
||||||
otherd = UCD_OTHERCASE(d);
|
otherd = UCD_OTHERCASE(d);
|
||||||
|
#else
|
||||||
|
otherd = d;
|
||||||
#endif /* SUPPORT_UCP */
|
#endif /* SUPPORT_UCP */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
and semantics are as close as possible to those of the Perl 5 language.
|
and semantics are as close as possible to those of the Perl 5 language.
|
||||||
|
|
||||||
Written by Philip Hazel
|
Written by Philip Hazel
|
||||||
Copyright (c) 1997-2014 University of Cambridge
|
Copyright (c) 1997-2018 University of Cambridge
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
@@ -2313,7 +2313,7 @@ for (;;)
|
|||||||
case OP_ANY:
|
case OP_ANY:
|
||||||
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
|
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
|
||||||
if (md->partial != 0 &&
|
if (md->partial != 0 &&
|
||||||
eptr + 1 >= md->end_subject &&
|
eptr == md->end_subject - 1 &&
|
||||||
NLBLOCK->nltype == NLTYPE_FIXED &&
|
NLBLOCK->nltype == NLTYPE_FIXED &&
|
||||||
NLBLOCK->nllen == 2 &&
|
NLBLOCK->nllen == 2 &&
|
||||||
UCHAR21TEST(eptr) == NLBLOCK->nl[0])
|
UCHAR21TEST(eptr) == NLBLOCK->nl[0])
|
||||||
@@ -3061,7 +3061,7 @@ for (;;)
|
|||||||
{
|
{
|
||||||
RMATCH(eptr, ecode, offset_top, md, eptrb, RM18);
|
RMATCH(eptr, ecode, offset_top, md, eptrb, RM18);
|
||||||
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
||||||
if (eptr-- == pp) break; /* Stop if tried at original pos */
|
if (eptr-- <= pp) break; /* Stop if tried at original pos */
|
||||||
BACKCHAR(eptr);
|
BACKCHAR(eptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3218,7 +3218,7 @@ for (;;)
|
|||||||
{
|
{
|
||||||
RMATCH(eptr, ecode, offset_top, md, eptrb, RM21);
|
RMATCH(eptr, ecode, offset_top, md, eptrb, RM21);
|
||||||
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
||||||
if (eptr-- == pp) break; /* Stop if tried at original pos */
|
if (eptr-- <= pp) break; /* Stop if tried at original pos */
|
||||||
#ifdef SUPPORT_UTF
|
#ifdef SUPPORT_UTF
|
||||||
if (utf) BACKCHAR(eptr);
|
if (utf) BACKCHAR(eptr);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -164,7 +164,6 @@ typedef struct jit_arguments {
|
|||||||
const pcre_uchar *begin;
|
const pcre_uchar *begin;
|
||||||
const pcre_uchar *end;
|
const pcre_uchar *end;
|
||||||
int *offsets;
|
int *offsets;
|
||||||
pcre_uchar *uchar_ptr;
|
|
||||||
pcre_uchar *mark_ptr;
|
pcre_uchar *mark_ptr;
|
||||||
void *callout_data;
|
void *callout_data;
|
||||||
/* Everything else after. */
|
/* Everything else after. */
|
||||||
@@ -214,7 +213,7 @@ enum control_types {
|
|||||||
type_then_trap = 1
|
type_then_trap = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int (SLJIT_CALL *jit_function)(jit_arguments *args);
|
typedef int (SLJIT_FUNC *jit_function)(jit_arguments *args);
|
||||||
|
|
||||||
/* The following structure is the key data type for the recursive
|
/* The following structure is the key data type for the recursive
|
||||||
code generator. It is allocated by compile_matchingpath, and contains
|
code generator. It is allocated by compile_matchingpath, and contains
|
||||||
@@ -489,9 +488,24 @@ typedef struct compare_context {
|
|||||||
/* Used for accessing the elements of the stack. */
|
/* Used for accessing the elements of the stack. */
|
||||||
#define STACK(i) ((i) * (int)sizeof(sljit_sw))
|
#define STACK(i) ((i) * (int)sizeof(sljit_sw))
|
||||||
|
|
||||||
|
#ifdef SLJIT_PREF_SHIFT_REG
|
||||||
|
#if SLJIT_PREF_SHIFT_REG == SLJIT_R2
|
||||||
|
/* Nothing. */
|
||||||
|
#elif SLJIT_PREF_SHIFT_REG == SLJIT_R3
|
||||||
|
#define SHIFT_REG_IS_R3
|
||||||
|
#else
|
||||||
|
#error "Unsupported shift register"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TMP1 SLJIT_R0
|
#define TMP1 SLJIT_R0
|
||||||
|
#ifdef SHIFT_REG_IS_R3
|
||||||
|
#define TMP2 SLJIT_R3
|
||||||
|
#define TMP3 SLJIT_R2
|
||||||
|
#else
|
||||||
#define TMP2 SLJIT_R2
|
#define TMP2 SLJIT_R2
|
||||||
#define TMP3 SLJIT_R3
|
#define TMP3 SLJIT_R3
|
||||||
|
#endif
|
||||||
#define STR_PTR SLJIT_S0
|
#define STR_PTR SLJIT_S0
|
||||||
#define STR_END SLJIT_S1
|
#define STR_END SLJIT_S1
|
||||||
#define STACK_TOP SLJIT_R1
|
#define STACK_TOP SLJIT_R1
|
||||||
@@ -520,13 +534,10 @@ the start pointers when the end of the capturing group has not yet reached. */
|
|||||||
|
|
||||||
#if defined COMPILE_PCRE8
|
#if defined COMPILE_PCRE8
|
||||||
#define MOV_UCHAR SLJIT_MOV_U8
|
#define MOV_UCHAR SLJIT_MOV_U8
|
||||||
#define MOVU_UCHAR SLJIT_MOVU_U8
|
|
||||||
#elif defined COMPILE_PCRE16
|
#elif defined COMPILE_PCRE16
|
||||||
#define MOV_UCHAR SLJIT_MOV_U16
|
#define MOV_UCHAR SLJIT_MOV_U16
|
||||||
#define MOVU_UCHAR SLJIT_MOVU_U16
|
|
||||||
#elif defined COMPILE_PCRE32
|
#elif defined COMPILE_PCRE32
|
||||||
#define MOV_UCHAR SLJIT_MOV_U32
|
#define MOV_UCHAR SLJIT_MOV_U32
|
||||||
#define MOVU_UCHAR SLJIT_MOVU_U32
|
|
||||||
#else
|
#else
|
||||||
#error Unsupported compiling mode
|
#error Unsupported compiling mode
|
||||||
#endif
|
#endif
|
||||||
@@ -2383,12 +2394,25 @@ if (length < 8)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GET_LOCAL_BASE(SLJIT_R1, 0, OVECTOR_START);
|
if (sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_STORE | SLJIT_MEM_PRE, SLJIT_R0, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw)) == SLJIT_SUCCESS)
|
||||||
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
|
{
|
||||||
loop = LABEL();
|
GET_LOCAL_BASE(SLJIT_R1, 0, OVECTOR_START);
|
||||||
OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw), SLJIT_R0, 0);
|
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
|
||||||
OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
|
loop = LABEL();
|
||||||
JUMPTO(SLJIT_NOT_ZERO, loop);
|
sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_STORE | SLJIT_MEM_PRE, SLJIT_R0, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw));
|
||||||
|
OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
|
||||||
|
JUMPTO(SLJIT_NOT_ZERO, loop);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GET_LOCAL_BASE(SLJIT_R1, 0, OVECTOR_START + sizeof(sljit_sw));
|
||||||
|
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
|
||||||
|
loop = LABEL();
|
||||||
|
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), 0, SLJIT_R0, 0);
|
||||||
|
OP2(SLJIT_ADD, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, sizeof(sljit_sw));
|
||||||
|
OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
|
||||||
|
JUMPTO(SLJIT_NOT_ZERO, loop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2421,12 +2445,25 @@ if (length < 8)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GET_LOCAL_BASE(TMP2, 0, OVECTOR_START + sizeof(sljit_sw));
|
if (sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_STORE | SLJIT_MEM_PRE, TMP1, SLJIT_MEM1(TMP2), sizeof(sljit_sw)) == SLJIT_SUCCESS)
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, length - 2);
|
{
|
||||||
loop = LABEL();
|
GET_LOCAL_BASE(TMP2, 0, OVECTOR_START + sizeof(sljit_sw));
|
||||||
OP1(SLJIT_MOVU, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, length - 2);
|
||||||
OP2(SLJIT_SUB | SLJIT_SET_Z, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
|
loop = LABEL();
|
||||||
JUMPTO(SLJIT_NOT_ZERO, loop);
|
sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_STORE | SLJIT_MEM_PRE, TMP1, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
|
||||||
|
OP2(SLJIT_SUB | SLJIT_SET_Z, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
|
||||||
|
JUMPTO(SLJIT_NOT_ZERO, loop);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GET_LOCAL_BASE(TMP2, 0, OVECTOR_START + 2 * sizeof(sljit_sw));
|
||||||
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, length - 2);
|
||||||
|
loop = LABEL();
|
||||||
|
OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, TMP1, 0);
|
||||||
|
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, SLJIT_IMM, sizeof(sljit_sw));
|
||||||
|
OP2(SLJIT_SUB | SLJIT_SET_Z, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
|
||||||
|
JUMPTO(SLJIT_NOT_ZERO, loop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, ARGUMENTS, 0);
|
OP1(SLJIT_MOV, STACK_TOP, 0, ARGUMENTS, 0);
|
||||||
@@ -2436,10 +2473,10 @@ if (common->control_head_ptr != 0)
|
|||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
|
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(jit_arguments, stack));
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(jit_arguments, stack));
|
||||||
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
|
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(struct sljit_stack, base));
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(struct sljit_stack, end));
|
||||||
}
|
}
|
||||||
|
|
||||||
static sljit_sw SLJIT_CALL do_search_mark(sljit_sw *current, const pcre_uchar *skip_arg)
|
static sljit_sw SLJIT_FUNC do_search_mark(sljit_sw *current, const pcre_uchar *skip_arg)
|
||||||
{
|
{
|
||||||
while (current != NULL)
|
while (current != NULL)
|
||||||
{
|
{
|
||||||
@@ -2460,7 +2497,7 @@ while (current != NULL)
|
|||||||
SLJIT_ASSERT(current[0] == 0 || current < (sljit_sw*)current[0]);
|
SLJIT_ASSERT(current[0] == 0 || current < (sljit_sw*)current[0]);
|
||||||
current = (sljit_sw*)current[0];
|
current = (sljit_sw*)current[0];
|
||||||
}
|
}
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SLJIT_INLINE void copy_ovector(compiler_common *common, int topbracket)
|
static SLJIT_INLINE void copy_ovector(compiler_common *common, int topbracket)
|
||||||
@@ -2468,6 +2505,7 @@ static SLJIT_INLINE void copy_ovector(compiler_common *common, int topbracket)
|
|||||||
DEFINE_COMPILER;
|
DEFINE_COMPILER;
|
||||||
struct sljit_label *loop;
|
struct sljit_label *loop;
|
||||||
struct sljit_jump *early_quit;
|
struct sljit_jump *early_quit;
|
||||||
|
BOOL has_pre;
|
||||||
|
|
||||||
/* At this point we can freely use all registers. */
|
/* At this point we can freely use all registers. */
|
||||||
OP1(SLJIT_MOV, SLJIT_S2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1));
|
OP1(SLJIT_MOV, SLJIT_S2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1));
|
||||||
@@ -2481,17 +2519,30 @@ if (common->mark_ptr != 0)
|
|||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0);
|
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0);
|
||||||
OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, offsets), SLJIT_IMM, sizeof(int));
|
OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, offsets), SLJIT_IMM, sizeof(int));
|
||||||
OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, begin));
|
OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, begin));
|
||||||
GET_LOCAL_BASE(SLJIT_S0, 0, OVECTOR_START);
|
|
||||||
|
has_pre = sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, SLJIT_S1, SLJIT_MEM1(SLJIT_S0), sizeof(sljit_sw)) == SLJIT_SUCCESS;
|
||||||
|
GET_LOCAL_BASE(SLJIT_S0, 0, OVECTOR_START - (has_pre ? sizeof(sljit_sw) : 0));
|
||||||
|
|
||||||
/* Unlikely, but possible */
|
/* Unlikely, but possible */
|
||||||
early_quit = CMP(SLJIT_EQUAL, SLJIT_R1, 0, SLJIT_IMM, 0);
|
early_quit = CMP(SLJIT_EQUAL, SLJIT_R1, 0, SLJIT_IMM, 0);
|
||||||
loop = LABEL();
|
loop = LABEL();
|
||||||
OP2(SLJIT_SUB, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 0, SLJIT_R0, 0);
|
|
||||||
OP2(SLJIT_ADD, SLJIT_S0, 0, SLJIT_S0, 0, SLJIT_IMM, sizeof(sljit_sw));
|
if (has_pre)
|
||||||
|
sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_PRE, SLJIT_S1, SLJIT_MEM1(SLJIT_S0), sizeof(sljit_sw));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OP1(SLJIT_MOV, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 0);
|
||||||
|
OP2(SLJIT_ADD, SLJIT_S0, 0, SLJIT_S0, 0, SLJIT_IMM, sizeof(sljit_sw));
|
||||||
|
}
|
||||||
|
|
||||||
|
OP2(SLJIT_ADD, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, sizeof(int));
|
||||||
|
OP2(SLJIT_SUB, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_R0, 0);
|
||||||
/* Copy the integer value to the output buffer */
|
/* Copy the integer value to the output buffer */
|
||||||
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
|
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
|
||||||
OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);
|
OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);
|
||||||
#endif
|
#endif
|
||||||
OP1(SLJIT_MOVU_S32, SLJIT_MEM1(SLJIT_R2), sizeof(int), SLJIT_S1, 0);
|
|
||||||
|
OP1(SLJIT_MOV_S32, SLJIT_MEM1(SLJIT_R2), 0, SLJIT_S1, 0);
|
||||||
OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
|
OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
|
||||||
JUMPTO(SLJIT_NOT_ZERO, loop);
|
JUMPTO(SLJIT_NOT_ZERO, loop);
|
||||||
JUMPHERE(early_quit);
|
JUMPHERE(early_quit);
|
||||||
@@ -2499,14 +2550,29 @@ JUMPHERE(early_quit);
|
|||||||
/* Calculate the return value, which is the maximum ovector value. */
|
/* Calculate the return value, which is the maximum ovector value. */
|
||||||
if (topbracket > 1)
|
if (topbracket > 1)
|
||||||
{
|
{
|
||||||
GET_LOCAL_BASE(SLJIT_R0, 0, OVECTOR_START + topbracket * 2 * sizeof(sljit_sw));
|
if (sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, SLJIT_R2, SLJIT_MEM1(SLJIT_R0), -(2 * (sljit_sw)sizeof(sljit_sw))) == SLJIT_SUCCESS)
|
||||||
OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, topbracket + 1);
|
{
|
||||||
|
GET_LOCAL_BASE(SLJIT_R0, 0, OVECTOR_START + topbracket * 2 * sizeof(sljit_sw));
|
||||||
|
OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, topbracket + 1);
|
||||||
|
|
||||||
/* OVECTOR(0) is never equal to SLJIT_S2. */
|
/* OVECTOR(0) is never equal to SLJIT_S2. */
|
||||||
loop = LABEL();
|
loop = LABEL();
|
||||||
OP1(SLJIT_MOVU, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), -(2 * (sljit_sw)sizeof(sljit_sw)));
|
sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_PRE, SLJIT_R2, SLJIT_MEM1(SLJIT_R0), -(2 * (sljit_sw)sizeof(sljit_sw)));
|
||||||
OP2(SLJIT_SUB, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
|
OP2(SLJIT_SUB, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
|
||||||
CMPTO(SLJIT_EQUAL, SLJIT_R2, 0, SLJIT_S2, 0, loop);
|
CMPTO(SLJIT_EQUAL, SLJIT_R2, 0, SLJIT_S2, 0, loop);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GET_LOCAL_BASE(SLJIT_R0, 0, OVECTOR_START + (topbracket - 1) * 2 * sizeof(sljit_sw));
|
||||||
|
OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, topbracket + 1);
|
||||||
|
|
||||||
|
/* OVECTOR(0) is never equal to SLJIT_S2. */
|
||||||
|
loop = LABEL();
|
||||||
|
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), 0);
|
||||||
|
OP2(SLJIT_SUB, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_IMM, 2 * (sljit_sw)sizeof(sljit_sw));
|
||||||
|
OP2(SLJIT_SUB, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
|
||||||
|
CMPTO(SLJIT_EQUAL, SLJIT_R2, 0, SLJIT_S2, 0, loop);
|
||||||
|
}
|
||||||
OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_R1, 0);
|
OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_R1, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -5167,93 +5233,190 @@ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
|
|||||||
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
|
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHAR1 STR_END
|
|
||||||
#define CHAR2 STACK_TOP
|
|
||||||
|
|
||||||
static void do_casefulcmp(compiler_common *common)
|
static void do_casefulcmp(compiler_common *common)
|
||||||
{
|
{
|
||||||
DEFINE_COMPILER;
|
DEFINE_COMPILER;
|
||||||
struct sljit_jump *jump;
|
struct sljit_jump *jump;
|
||||||
struct sljit_label *label;
|
struct sljit_label *label;
|
||||||
|
int char1_reg;
|
||||||
|
int char2_reg;
|
||||||
|
|
||||||
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
|
if (sljit_get_register_index(TMP3) < 0)
|
||||||
|
{
|
||||||
|
char1_reg = STR_END;
|
||||||
|
char2_reg = STACK_TOP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char1_reg = TMP3;
|
||||||
|
char2_reg = RETURN_ADDR;
|
||||||
|
}
|
||||||
|
|
||||||
|
sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
|
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
|
||||||
OP1(SLJIT_MOV, TMP3, 0, CHAR1, 0);
|
|
||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, CHAR2, 0);
|
|
||||||
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
|
|
||||||
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
|
||||||
|
|
||||||
label = LABEL();
|
if (char1_reg == STR_END)
|
||||||
OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
|
{
|
||||||
OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
|
OP1(SLJIT_MOV, TMP3, 0, char1_reg, 0);
|
||||||
jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
|
OP1(SLJIT_MOV, RETURN_ADDR, 0, char2_reg, 0);
|
||||||
OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
|
}
|
||||||
JUMPTO(SLJIT_NOT_ZERO, label);
|
|
||||||
|
|
||||||
JUMPHERE(jump);
|
if (sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_SUPP | SLJIT_MEM_POST, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1)) == SLJIT_SUCCESS)
|
||||||
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
{
|
||||||
OP1(SLJIT_MOV, CHAR1, 0, TMP3, 0);
|
label = LABEL();
|
||||||
OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_POST, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1));
|
||||||
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
|
sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_POST, char2_reg, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
|
||||||
|
jump = CMP(SLJIT_NOT_EQUAL, char1_reg, 0, char2_reg, 0);
|
||||||
|
OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
JUMPTO(SLJIT_NOT_ZERO, label);
|
||||||
|
|
||||||
|
JUMPHERE(jump);
|
||||||
|
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
|
}
|
||||||
|
else if (sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1)) == SLJIT_SUCCESS)
|
||||||
|
{
|
||||||
|
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
|
||||||
|
label = LABEL();
|
||||||
|
sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_PRE, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1));
|
||||||
|
sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_PRE, char2_reg, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
|
||||||
|
jump = CMP(SLJIT_NOT_EQUAL, char1_reg, 0, char2_reg, 0);
|
||||||
|
OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
JUMPTO(SLJIT_NOT_ZERO, label);
|
||||||
|
|
||||||
|
JUMPHERE(jump);
|
||||||
|
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
|
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label = LABEL();
|
||||||
|
OP1(MOV_UCHAR, char1_reg, 0, SLJIT_MEM1(TMP1), 0);
|
||||||
|
OP1(MOV_UCHAR, char2_reg, 0, SLJIT_MEM1(STR_PTR), 0);
|
||||||
|
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
jump = CMP(SLJIT_NOT_EQUAL, char1_reg, 0, char2_reg, 0);
|
||||||
|
OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
JUMPTO(SLJIT_NOT_ZERO, label);
|
||||||
|
|
||||||
|
JUMPHERE(jump);
|
||||||
|
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (char1_reg == STR_END)
|
||||||
|
{
|
||||||
|
OP1(SLJIT_MOV, char1_reg, 0, TMP3, 0);
|
||||||
|
OP1(SLJIT_MOV, char2_reg, 0, RETURN_ADDR, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
sljit_emit_fast_return(compiler, TMP1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LCC_TABLE STACK_LIMIT
|
|
||||||
|
|
||||||
static void do_caselesscmp(compiler_common *common)
|
static void do_caselesscmp(compiler_common *common)
|
||||||
{
|
{
|
||||||
DEFINE_COMPILER;
|
DEFINE_COMPILER;
|
||||||
struct sljit_jump *jump;
|
struct sljit_jump *jump;
|
||||||
struct sljit_label *label;
|
struct sljit_label *label;
|
||||||
|
int char1_reg = STR_END;
|
||||||
|
int char2_reg;
|
||||||
|
int lcc_table;
|
||||||
|
int opt_type = 0;
|
||||||
|
|
||||||
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
|
if (sljit_get_register_index(TMP3) < 0)
|
||||||
|
{
|
||||||
|
char2_reg = STACK_TOP;
|
||||||
|
lcc_table = STACK_LIMIT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char2_reg = RETURN_ADDR;
|
||||||
|
lcc_table = TMP3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_SUPP | SLJIT_MEM_POST, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1)) == SLJIT_SUCCESS)
|
||||||
|
opt_type = 1;
|
||||||
|
else if (sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1)) == SLJIT_SUCCESS)
|
||||||
|
opt_type = 2;
|
||||||
|
|
||||||
|
sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
|
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
|
||||||
|
|
||||||
OP1(SLJIT_MOV, TMP3, 0, LCC_TABLE, 0);
|
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, char1_reg, 0);
|
||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, CHAR1, 0);
|
|
||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, CHAR2, 0);
|
if (char2_reg == STACK_TOP)
|
||||||
OP1(SLJIT_MOV, LCC_TABLE, 0, SLJIT_IMM, common->lcc);
|
{
|
||||||
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
|
OP1(SLJIT_MOV, TMP3, 0, char2_reg, 0);
|
||||||
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
OP1(SLJIT_MOV, RETURN_ADDR, 0, lcc_table, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
OP1(SLJIT_MOV, lcc_table, 0, SLJIT_IMM, common->lcc);
|
||||||
|
|
||||||
|
if (opt_type == 1)
|
||||||
|
{
|
||||||
|
label = LABEL();
|
||||||
|
sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_POST, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1));
|
||||||
|
sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_POST, char2_reg, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
|
||||||
|
}
|
||||||
|
else if (opt_type == 2)
|
||||||
|
{
|
||||||
|
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
|
||||||
|
label = LABEL();
|
||||||
|
sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_PRE, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1));
|
||||||
|
sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_PRE, char2_reg, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label = LABEL();
|
||||||
|
OP1(MOV_UCHAR, char1_reg, 0, SLJIT_MEM1(TMP1), 0);
|
||||||
|
OP1(MOV_UCHAR, char2_reg, 0, SLJIT_MEM1(STR_PTR), 0);
|
||||||
|
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
}
|
||||||
|
|
||||||
label = LABEL();
|
|
||||||
OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
|
|
||||||
OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
|
|
||||||
#ifndef COMPILE_PCRE8
|
#ifndef COMPILE_PCRE8
|
||||||
jump = CMP(SLJIT_GREATER, CHAR1, 0, SLJIT_IMM, 255);
|
jump = CMP(SLJIT_GREATER, char1_reg, 0, SLJIT_IMM, 255);
|
||||||
#endif
|
#endif
|
||||||
OP1(SLJIT_MOV_U8, CHAR1, 0, SLJIT_MEM2(LCC_TABLE, CHAR1), 0);
|
OP1(SLJIT_MOV_U8, char1_reg, 0, SLJIT_MEM2(lcc_table, char1_reg), 0);
|
||||||
#ifndef COMPILE_PCRE8
|
#ifndef COMPILE_PCRE8
|
||||||
JUMPHERE(jump);
|
JUMPHERE(jump);
|
||||||
jump = CMP(SLJIT_GREATER, CHAR2, 0, SLJIT_IMM, 255);
|
jump = CMP(SLJIT_GREATER, char2_reg, 0, SLJIT_IMM, 255);
|
||||||
#endif
|
#endif
|
||||||
OP1(SLJIT_MOV_U8, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);
|
OP1(SLJIT_MOV_U8, char2_reg, 0, SLJIT_MEM2(lcc_table, char2_reg), 0);
|
||||||
#ifndef COMPILE_PCRE8
|
#ifndef COMPILE_PCRE8
|
||||||
JUMPHERE(jump);
|
JUMPHERE(jump);
|
||||||
#endif
|
#endif
|
||||||
jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
|
|
||||||
|
if (opt_type == 0)
|
||||||
|
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
|
|
||||||
|
jump = CMP(SLJIT_NOT_EQUAL, char1_reg, 0, char2_reg, 0);
|
||||||
OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
|
OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
JUMPTO(SLJIT_NOT_ZERO, label);
|
JUMPTO(SLJIT_NOT_ZERO, label);
|
||||||
|
|
||||||
JUMPHERE(jump);
|
JUMPHERE(jump);
|
||||||
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
OP1(SLJIT_MOV, LCC_TABLE, 0, TMP3, 0);
|
|
||||||
OP1(SLJIT_MOV, CHAR1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
|
||||||
OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
|
|
||||||
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef LCC_TABLE
|
if (opt_type == 2)
|
||||||
#undef CHAR1
|
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
|
||||||
#undef CHAR2
|
|
||||||
|
if (char2_reg == STACK_TOP)
|
||||||
|
{
|
||||||
|
OP1(SLJIT_MOV, char2_reg, 0, TMP3, 0);
|
||||||
|
OP1(SLJIT_MOV, lcc_table, 0, RETURN_ADDR, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
OP1(SLJIT_MOV, char1_reg, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
|
||||||
|
sljit_emit_fast_return(compiler, TMP1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined SUPPORT_UTF && defined SUPPORT_UCP
|
#if defined SUPPORT_UTF && defined SUPPORT_UCP
|
||||||
|
|
||||||
static const pcre_uchar * SLJIT_CALL do_utf_caselesscmp(pcre_uchar *src1, jit_arguments *args, pcre_uchar *end1)
|
static const pcre_uchar * SLJIT_FUNC do_utf_caselesscmp(pcre_uchar *src1, pcre_uchar *src2, pcre_uchar *end1, pcre_uchar *end2)
|
||||||
{
|
{
|
||||||
/* This function would be ineffective to do in JIT level. */
|
/* This function would be ineffective to do in JIT level. */
|
||||||
sljit_u32 c1, c2;
|
sljit_u32 c1, c2;
|
||||||
const pcre_uchar *src2 = args->uchar_ptr;
|
|
||||||
const pcre_uchar *end2 = args->end;
|
|
||||||
const ucd_record *ur;
|
const ucd_record *ur;
|
||||||
const sljit_u32 *pp;
|
const sljit_u32 *pp;
|
||||||
|
|
||||||
@@ -6776,32 +6939,37 @@ else
|
|||||||
#if defined SUPPORT_UTF && defined SUPPORT_UCP
|
#if defined SUPPORT_UTF && defined SUPPORT_UCP
|
||||||
if (common->utf && *cc == OP_REFI)
|
if (common->utf && *cc == OP_REFI)
|
||||||
{
|
{
|
||||||
SLJIT_ASSERT(TMP1 == SLJIT_R0 && STACK_TOP == SLJIT_R1 && TMP2 == SLJIT_R2);
|
SLJIT_ASSERT(TMP1 == SLJIT_R0 && STACK_TOP == SLJIT_R1);
|
||||||
if (ref)
|
if (ref)
|
||||||
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1));
|
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1));
|
||||||
else
|
else
|
||||||
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
|
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
|
||||||
|
|
||||||
if (withchecks)
|
if (withchecks)
|
||||||
jump = CMP(SLJIT_EQUAL, TMP1, 0, TMP2, 0);
|
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_R2, 0);
|
||||||
|
|
||||||
/* Needed to save important temporary registers. */
|
/* No free saved registers so save data on stack. */
|
||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
|
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
|
||||||
OP1(SLJIT_MOV, SLJIT_R1, 0, ARGUMENTS, 0);
|
OP1(SLJIT_MOV, SLJIT_R1, 0, STR_PTR, 0);
|
||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, uchar_ptr), STR_PTR, 0);
|
OP1(SLJIT_MOV, SLJIT_R3, 0, STR_END, 0);
|
||||||
sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp));
|
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp));
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
|
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
|
||||||
|
|
||||||
if (common->mode == JIT_COMPILE)
|
if (common->mode == JIT_COMPILE)
|
||||||
add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1));
|
add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));
|
OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_LESS, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
|
||||||
nopartial = CMP(SLJIT_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
|
|
||||||
|
add_jump(compiler, backtracks, JUMP(SLJIT_LESS));
|
||||||
|
|
||||||
|
nopartial = JUMP(SLJIT_NOT_EQUAL);
|
||||||
|
OP1(SLJIT_MOV, STR_PTR, 0, STR_END, 0);
|
||||||
check_partial(common, FALSE);
|
check_partial(common, FALSE);
|
||||||
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
|
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
|
||||||
JUMPHERE(nopartial);
|
JUMPHERE(nopartial);
|
||||||
}
|
}
|
||||||
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* SUPPORT_UTF && SUPPORT_UCP */
|
#endif /* SUPPORT_UTF && SUPPORT_UCP */
|
||||||
@@ -7125,7 +7293,7 @@ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IM
|
|||||||
return cc + 1 + LINK_SIZE;
|
return cc + 1 + LINK_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SLJIT_CALL do_callout(struct jit_arguments *arguments, PUBL(callout_block) *callout_block, pcre_uchar **jit_ovector)
|
static sljit_s32 SLJIT_FUNC do_callout(struct jit_arguments *arguments, PUBL(callout_block) *callout_block, pcre_uchar **jit_ovector)
|
||||||
{
|
{
|
||||||
const pcre_uchar *begin = arguments->begin;
|
const pcre_uchar *begin = arguments->begin;
|
||||||
int *offset_vector = arguments->offsets;
|
int *offset_vector = arguments->offsets;
|
||||||
@@ -7207,18 +7375,17 @@ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
|
|||||||
/* SLJIT_R0 = arguments */
|
/* SLJIT_R0 = arguments */
|
||||||
OP1(SLJIT_MOV, SLJIT_R1, 0, STACK_TOP, 0);
|
OP1(SLJIT_MOV, SLJIT_R1, 0, STACK_TOP, 0);
|
||||||
GET_LOCAL_BASE(SLJIT_R2, 0, OVECTOR_START);
|
GET_LOCAL_BASE(SLJIT_R2, 0, OVECTOR_START);
|
||||||
sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout));
|
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(S32) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout));
|
||||||
OP1(SLJIT_MOV_S32, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0);
|
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
|
free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
|
||||||
|
|
||||||
/* Check return value. */
|
/* Check return value. */
|
||||||
OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_SIG_GREATER, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
|
OP2(SLJIT_SUB32 | SLJIT_SET_Z | SLJIT_SET_SIG_GREATER, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
|
||||||
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_SIG_GREATER));
|
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_SIG_GREATER32));
|
||||||
if (common->forced_quit_label == NULL)
|
if (common->forced_quit_label == NULL)
|
||||||
add_jump(compiler, &common->forced_quit, JUMP(SLJIT_NOT_EQUAL) /* SIG_LESS */);
|
add_jump(compiler, &common->forced_quit, JUMP(SLJIT_NOT_EQUAL32) /* SIG_LESS */);
|
||||||
else
|
else
|
||||||
JUMPTO(SLJIT_NOT_EQUAL /* SIG_LESS */, common->forced_quit_label);
|
JUMPTO(SLJIT_NOT_EQUAL32 /* SIG_LESS */, common->forced_quit_label);
|
||||||
return cc + 2 + 2 * LINK_SIZE;
|
return cc + 2 + 2 * LINK_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10439,11 +10606,11 @@ if (opcode == OP_SKIP_ARG)
|
|||||||
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
|
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
|
||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
|
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, (sljit_sw)(current->cc + 2));
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, (sljit_sw)(current->cc + 2));
|
||||||
sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_search_mark));
|
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(do_search_mark));
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
|
|
||||||
OP1(SLJIT_MOV, STR_PTR, 0, TMP1, 0);
|
OP1(SLJIT_MOV, STR_PTR, 0, TMP1, 0);
|
||||||
add_jump(compiler, &common->reset_match, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, -1));
|
add_jump(compiler, &common->reset_match, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11031,7 +11198,7 @@ if (!compiler)
|
|||||||
common->compiler = compiler;
|
common->compiler = compiler;
|
||||||
|
|
||||||
/* Main pcre_jit_exec entry. */
|
/* Main pcre_jit_exec entry. */
|
||||||
sljit_emit_enter(compiler, 0, 1, 5, 5, 0, 0, private_data_size);
|
sljit_emit_enter(compiler, 0, SLJIT_ARG1(SW), 5, 5, 0, 0, private_data_size);
|
||||||
|
|
||||||
/* Register init. */
|
/* Register init. */
|
||||||
reset_ovector(common, (re->top_bracket + 1) * 2);
|
reset_ovector(common, (re->top_bracket + 1) * 2);
|
||||||
@@ -11044,8 +11211,8 @@ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str))
|
|||||||
OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, end));
|
OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, end));
|
||||||
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
|
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
|
||||||
OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, limit_match));
|
OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, limit_match));
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, base));
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, end));
|
||||||
OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, limit));
|
OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, start));
|
||||||
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
|
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
|
||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LIMIT_MATCH, TMP1, 0);
|
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LIMIT_MATCH, TMP1, 0);
|
||||||
|
|
||||||
@@ -11251,20 +11418,22 @@ common->quit_label = quit_label;
|
|||||||
set_jumps(common->stackalloc, LABEL());
|
set_jumps(common->stackalloc, LABEL());
|
||||||
/* RETURN_ADDR is not a saved register. */
|
/* RETURN_ADDR is not a saved register. */
|
||||||
sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP2, 0);
|
|
||||||
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
|
|
||||||
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
|
|
||||||
OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, top), STACK_TOP, 0);
|
|
||||||
OP2(SLJIT_SUB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit), SLJIT_IMM, STACK_GROWTH_RATE);
|
|
||||||
|
|
||||||
sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_stack_resize));
|
SLJIT_ASSERT(TMP1 == SLJIT_R0 && STACK_TOP == SLJIT_R1);
|
||||||
jump = CMP(SLJIT_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
|
|
||||||
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
|
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, STACK_TOP, 0);
|
||||||
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
|
OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0);
|
||||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, top));
|
OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_LIMIT, 0, SLJIT_IMM, STACK_GROWTH_RATE);
|
||||||
OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit));
|
OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, stack));
|
||||||
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
|
OP1(SLJIT_MOV, STACK_LIMIT, 0, TMP2, 0);
|
||||||
sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
|
||||||
|
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_stack_resize));
|
||||||
|
jump = CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
|
||||||
|
OP1(SLJIT_MOV, TMP2, 0, STACK_LIMIT, 0);
|
||||||
|
OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_RETURN_REG, 0);
|
||||||
|
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
|
||||||
|
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
|
||||||
|
sljit_emit_fast_return(compiler, TMP1, 0);
|
||||||
|
|
||||||
/* Allocation failed. */
|
/* Allocation failed. */
|
||||||
JUMPHERE(jump);
|
JUMPHERE(jump);
|
||||||
@@ -11409,9 +11578,9 @@ union {
|
|||||||
sljit_u8 local_space[MACHINE_STACK_SIZE];
|
sljit_u8 local_space[MACHINE_STACK_SIZE];
|
||||||
struct sljit_stack local_stack;
|
struct sljit_stack local_stack;
|
||||||
|
|
||||||
local_stack.max_limit = local_space;
|
local_stack.min_start = local_space;
|
||||||
local_stack.limit = local_space;
|
local_stack.start = local_space;
|
||||||
local_stack.base = local_space + MACHINE_STACK_SIZE;
|
local_stack.end = local_space + MACHINE_STACK_SIZE;
|
||||||
local_stack.top = local_space + MACHINE_STACK_SIZE;
|
local_stack.top = local_space + MACHINE_STACK_SIZE;
|
||||||
arguments->stack = &local_stack;
|
arguments->stack = &local_stack;
|
||||||
convert_executable_func.executable_func = executable_func;
|
convert_executable_func.executable_func = executable_func;
|
||||||
@@ -11529,7 +11698,7 @@ if ((options & PCRE_PARTIAL_HARD) != 0)
|
|||||||
else if ((options & PCRE_PARTIAL_SOFT) != 0)
|
else if ((options & PCRE_PARTIAL_SOFT) != 0)
|
||||||
mode = JIT_PARTIAL_SOFT_COMPILE;
|
mode = JIT_PARTIAL_SOFT_COMPILE;
|
||||||
|
|
||||||
if (functions->executable_funcs[mode] == NULL)
|
if (functions == NULL || functions->executable_funcs[mode] == NULL)
|
||||||
return PCRE_ERROR_JIT_BADOPTION;
|
return PCRE_ERROR_JIT_BADOPTION;
|
||||||
|
|
||||||
/* Sanity checks should be handled by pcre_exec. */
|
/* Sanity checks should be handled by pcre_exec. */
|
||||||
|
|||||||
@@ -1387,8 +1387,8 @@ Returns: nothing
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_after_lines(int lastmatchnumber, char *lastmatchrestart, char *endptr,
|
do_after_lines(unsigned long int lastmatchnumber, char *lastmatchrestart,
|
||||||
char *printname)
|
char *endptr, char *printname)
|
||||||
{
|
{
|
||||||
if (after_context > 0 && lastmatchnumber > 0)
|
if (after_context > 0 && lastmatchnumber > 0)
|
||||||
{
|
{
|
||||||
@@ -1398,7 +1398,7 @@ if (after_context > 0 && lastmatchnumber > 0)
|
|||||||
int ellength;
|
int ellength;
|
||||||
char *pp = lastmatchrestart;
|
char *pp = lastmatchrestart;
|
||||||
if (printname != NULL) fprintf(stdout, "%s-", printname);
|
if (printname != NULL) fprintf(stdout, "%s-", printname);
|
||||||
if (number) fprintf(stdout, "%d-", lastmatchnumber++);
|
if (number) fprintf(stdout, "%lu-", lastmatchnumber++);
|
||||||
pp = end_of_line(pp, endptr, &ellength);
|
pp = end_of_line(pp, endptr, &ellength);
|
||||||
FWRITE(lastmatchrestart, 1, pp - lastmatchrestart, stdout);
|
FWRITE(lastmatchrestart, 1, pp - lastmatchrestart, stdout);
|
||||||
lastmatchrestart = pp;
|
lastmatchrestart = pp;
|
||||||
@@ -1502,11 +1502,11 @@ static int
|
|||||||
pcregrep(void *handle, int frtype, char *filename, char *printname)
|
pcregrep(void *handle, int frtype, char *filename, char *printname)
|
||||||
{
|
{
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
int linenumber = 1;
|
|
||||||
int lastmatchnumber = 0;
|
|
||||||
int count = 0;
|
|
||||||
int filepos = 0;
|
int filepos = 0;
|
||||||
int offsets[OFFSET_SIZE];
|
int offsets[OFFSET_SIZE];
|
||||||
|
unsigned long int linenumber = 1;
|
||||||
|
unsigned long int lastmatchnumber = 0;
|
||||||
|
unsigned long int count = 0;
|
||||||
char *lastmatchrestart = NULL;
|
char *lastmatchrestart = NULL;
|
||||||
char *ptr = main_buffer;
|
char *ptr = main_buffer;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
@@ -1609,7 +1609,7 @@ while (ptr < endptr)
|
|||||||
|
|
||||||
if (endlinelength == 0 && t == main_buffer + bufsize)
|
if (endlinelength == 0 && t == main_buffer + bufsize)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "pcregrep: line %d%s%s is too long for the internal buffer\n"
|
fprintf(stderr, "pcregrep: line %lu%s%s is too long for the internal buffer\n"
|
||||||
"pcregrep: check the --buffer-size option\n",
|
"pcregrep: check the --buffer-size option\n",
|
||||||
linenumber,
|
linenumber,
|
||||||
(filename == NULL)? "" : " of file ",
|
(filename == NULL)? "" : " of file ",
|
||||||
@@ -1747,7 +1747,7 @@ while (ptr < endptr)
|
|||||||
prevoffsets[1] = offsets[1];
|
prevoffsets[1] = offsets[1];
|
||||||
|
|
||||||
if (printname != NULL) fprintf(stdout, "%s:", printname);
|
if (printname != NULL) fprintf(stdout, "%s:", printname);
|
||||||
if (number) fprintf(stdout, "%d:", linenumber);
|
if (number) fprintf(stdout, "%lu:", linenumber);
|
||||||
|
|
||||||
/* Handle --line-offsets */
|
/* Handle --line-offsets */
|
||||||
|
|
||||||
@@ -1862,7 +1862,7 @@ while (ptr < endptr)
|
|||||||
{
|
{
|
||||||
char *pp = lastmatchrestart;
|
char *pp = lastmatchrestart;
|
||||||
if (printname != NULL) fprintf(stdout, "%s-", printname);
|
if (printname != NULL) fprintf(stdout, "%s-", printname);
|
||||||
if (number) fprintf(stdout, "%d-", lastmatchnumber++);
|
if (number) fprintf(stdout, "%lu-", lastmatchnumber++);
|
||||||
pp = end_of_line(pp, endptr, &ellength);
|
pp = end_of_line(pp, endptr, &ellength);
|
||||||
FWRITE(lastmatchrestart, 1, pp - lastmatchrestart, stdout);
|
FWRITE(lastmatchrestart, 1, pp - lastmatchrestart, stdout);
|
||||||
lastmatchrestart = pp;
|
lastmatchrestart = pp;
|
||||||
@@ -1902,7 +1902,7 @@ while (ptr < endptr)
|
|||||||
int ellength;
|
int ellength;
|
||||||
char *pp = p;
|
char *pp = p;
|
||||||
if (printname != NULL) fprintf(stdout, "%s-", printname);
|
if (printname != NULL) fprintf(stdout, "%s-", printname);
|
||||||
if (number) fprintf(stdout, "%d-", linenumber - linecount--);
|
if (number) fprintf(stdout, "%lu-", linenumber - linecount--);
|
||||||
pp = end_of_line(pp, endptr, &ellength);
|
pp = end_of_line(pp, endptr, &ellength);
|
||||||
FWRITE(p, 1, pp - p, stdout);
|
FWRITE(p, 1, pp - p, stdout);
|
||||||
p = pp;
|
p = pp;
|
||||||
@@ -1916,7 +1916,7 @@ while (ptr < endptr)
|
|||||||
endhyphenpending = TRUE;
|
endhyphenpending = TRUE;
|
||||||
|
|
||||||
if (printname != NULL) fprintf(stdout, "%s:", printname);
|
if (printname != NULL) fprintf(stdout, "%s:", printname);
|
||||||
if (number) fprintf(stdout, "%d:", linenumber);
|
if (number) fprintf(stdout, "%lu:", linenumber);
|
||||||
|
|
||||||
/* In multiline mode, we want to print to the end of the line in which
|
/* In multiline mode, we want to print to the end of the line in which
|
||||||
the end of the matched string is found, so we adjust linelength and the
|
the end of the matched string is found, so we adjust linelength and the
|
||||||
@@ -2112,7 +2112,7 @@ if (count_only && !quiet)
|
|||||||
{
|
{
|
||||||
if (printname != NULL && filenames != FN_NONE)
|
if (printname != NULL && filenames != FN_NONE)
|
||||||
fprintf(stdout, "%s:", printname);
|
fprintf(stdout, "%s:", printname);
|
||||||
fprintf(stdout, "%d\n", count);
|
fprintf(stdout, "%lu\n", count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2234,7 +2234,7 @@ if (isdirectory(pathname))
|
|||||||
|
|
||||||
if (dee_action == dee_RECURSE)
|
if (dee_action == dee_RECURSE)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[2048];
|
||||||
char *nextfile;
|
char *nextfile;
|
||||||
directory_type *dir = opendirectory(pathname);
|
directory_type *dir = opendirectory(pathname);
|
||||||
|
|
||||||
@@ -2249,7 +2249,14 @@ if (isdirectory(pathname))
|
|||||||
while ((nextfile = readdirectory(dir)) != NULL)
|
while ((nextfile = readdirectory(dir)) != NULL)
|
||||||
{
|
{
|
||||||
int frc;
|
int frc;
|
||||||
sprintf(buffer, "%.512s%c%.128s", pathname, FILESEP, nextfile);
|
int fnlength = strlen(pathname) + strlen(nextfile) + 2;
|
||||||
|
if (fnlength > 2048)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "pcre2grep: recursive filename is too long\n");
|
||||||
|
rc = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sprintf(buffer, "%s%c%s", pathname, FILESEP, nextfile);
|
||||||
frc = grep_or_recurse(buffer, dir_recurse, FALSE);
|
frc = grep_or_recurse(buffer, dir_recurse, FALSE);
|
||||||
if (frc > 1) rc = frc;
|
if (frc > 1) rc = frc;
|
||||||
else if (frc == 0 && rc == 1) rc = 0;
|
else if (frc == 0 && rc == 1) rc = 0;
|
||||||
@@ -2520,7 +2527,14 @@ if ((popts & PO_FIXED_STRINGS) != 0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buffer, "%s%.*s%s", prefix[popts], patlen, ps, suffix[popts]);
|
if (snprintf(buffer, PATBUFSIZE, "%s%.*s%s", prefix[popts], patlen, ps,
|
||||||
|
suffix[popts]) > PATBUFSIZE)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "pcregrep: Buffer overflow while compiling \"%s\"\n",
|
||||||
|
ps);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
p->compiled = pcre_compile(buffer, options, &error, &errptr, pcretables);
|
p->compiled = pcre_compile(buffer, options, &error, &errptr, pcretables);
|
||||||
if (p->compiled != NULL) return TRUE;
|
if (p->compiled != NULL) return TRUE;
|
||||||
|
|
||||||
@@ -2756,8 +2770,15 @@ for (i = 1; i < argc; i++)
|
|||||||
int arglen = (argequals == NULL || equals == NULL)?
|
int arglen = (argequals == NULL || equals == NULL)?
|
||||||
(int)strlen(arg) : (int)(argequals - arg);
|
(int)strlen(arg) : (int)(argequals - arg);
|
||||||
|
|
||||||
sprintf(buff1, "%.*s", baselen, op->long_name);
|
if (snprintf(buff1, sizeof(buff1), "%.*s", baselen, op->long_name) >
|
||||||
sprintf(buff2, "%s%.*s", buff1, fulllen - baselen - 2, opbra + 1);
|
(int)sizeof(buff1) ||
|
||||||
|
snprintf(buff2, sizeof(buff2), "%s%.*s", buff1,
|
||||||
|
fulllen - baselen - 2, opbra + 1) > (int)sizeof(buff2))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "pcregrep: Buffer overflow when parsing %s option\n",
|
||||||
|
op->long_name);
|
||||||
|
pcregrep_exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
if (strncmp(arg, buff1, arglen) == 0 ||
|
if (strncmp(arg, buff1, arglen) == 0 ||
|
||||||
strncmp(arg, buff2, arglen) == 0)
|
strncmp(arg, buff2, arglen) == 0)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
and semantics are as close as possible to those of the Perl 5 language.
|
and semantics are as close as possible to those of the Perl 5 language.
|
||||||
|
|
||||||
Written by Philip Hazel
|
Written by Philip Hazel
|
||||||
Copyright (c) 1997-2017 University of Cambridge
|
Copyright (c) 1997-2018 University of Cambridge
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
@@ -389,8 +389,8 @@ if (rc >= 0)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < (size_t)rc; i++)
|
for (i = 0; i < (size_t)rc; i++)
|
||||||
{
|
{
|
||||||
pmatch[i].rm_so = ovector[i*2] + so;
|
pmatch[i].rm_so = (ovector[i*2] < 0)? -1 : ovector[i*2] + so;
|
||||||
pmatch[i].rm_eo = ovector[i*2+1] + so;
|
pmatch[i].rm_eo = (ovector[i*2+1] < 0)? -1: ovector[i*2+1] + so;
|
||||||
}
|
}
|
||||||
if (allocated_ovector) free(ovector);
|
if (allocated_ovector) free(ovector);
|
||||||
for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
|
for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
|
||||||
|
|||||||
8
pcre/testdata/testinput2
vendored
8
pcre/testdata/testinput2
vendored
@@ -4249,4 +4249,12 @@ backtracking verbs. --/
|
|||||||
|
|
||||||
/(?=.*[A-Z])/I
|
/(?=.*[A-Z])/I
|
||||||
|
|
||||||
|
"(?<=(a))\1?b"
|
||||||
|
ab
|
||||||
|
aaab
|
||||||
|
|
||||||
|
"(?=(a))\1?b"
|
||||||
|
ab
|
||||||
|
aaab
|
||||||
|
|
||||||
/-- End of testinput2 --/
|
/-- End of testinput2 --/
|
||||||
|
|||||||
6
pcre/testdata/testinput5
vendored
6
pcre/testdata/testinput5
vendored
@@ -798,4 +798,10 @@
|
|||||||
\x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
|
\x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
|
||||||
|
|
||||||
/(?<=\K\x{17f})/8G+
|
/(?<=\K\x{17f})/8G+
|
||||||
|
\x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
|
||||||
|
|
||||||
|
/\C[^\v]+\x80/8
|
||||||
|
[AΏBŀC]
|
||||||
|
|
||||||
|
/\C[^\d]+\x80/8
|
||||||
[AΏBŀC]
|
[AΏBŀC]
|
||||||
|
|||||||
16
pcre/testdata/testoutput2
vendored
16
pcre/testdata/testoutput2
vendored
@@ -14705,4 +14705,20 @@ No options
|
|||||||
No first char
|
No first char
|
||||||
No need char
|
No need char
|
||||||
|
|
||||||
|
"(?<=(a))\1?b"
|
||||||
|
ab
|
||||||
|
0: b
|
||||||
|
1: a
|
||||||
|
aaab
|
||||||
|
0: ab
|
||||||
|
1: a
|
||||||
|
|
||||||
|
"(?=(a))\1?b"
|
||||||
|
ab
|
||||||
|
0: ab
|
||||||
|
1: a
|
||||||
|
aaab
|
||||||
|
0: ab
|
||||||
|
1: a
|
||||||
|
|
||||||
/-- End of testinput2 --/
|
/-- End of testinput2 --/
|
||||||
|
|||||||
8
pcre/testdata/testoutput5
vendored
8
pcre/testdata/testoutput5
vendored
@@ -1942,4 +1942,12 @@ Need char = 'z'
|
|||||||
0: \x{17f}
|
0: \x{17f}
|
||||||
0+ \x{17f}
|
0+ \x{17f}
|
||||||
0: \x{17f}
|
0: \x{17f}
|
||||||
|
0+
|
||||||
|
|
||||||
|
/\C[^\v]+\x80/8
|
||||||
|
[AΏBŀC]
|
||||||
|
No match
|
||||||
|
|
||||||
|
/\C[^\d]+\x80/8
|
||||||
|
[AΏBŀC]
|
||||||
No match
|
No match
|
||||||
|
|||||||
@@ -1348,7 +1348,9 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
|||||||
{
|
{
|
||||||
uchar *pos;
|
uchar *pos;
|
||||||
/* fields count may be wrong */
|
/* fields count may be wrong */
|
||||||
DBUG_ASSERT((uint) (field - result) < fields);
|
if (field - result >= fields)
|
||||||
|
goto err;
|
||||||
|
|
||||||
cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
|
cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
|
||||||
field->catalog= strmake_root(alloc,(char*) row->data[0], lengths[0]);
|
field->catalog= strmake_root(alloc,(char*) row->data[0], lengths[0]);
|
||||||
field->db= strmake_root(alloc,(char*) row->data[1], lengths[1]);
|
field->db= strmake_root(alloc,(char*) row->data[1], lengths[1]);
|
||||||
@@ -1366,12 +1368,7 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
|||||||
|
|
||||||
/* Unpack fixed length parts */
|
/* Unpack fixed length parts */
|
||||||
if (lengths[6] != 12)
|
if (lengths[6] != 12)
|
||||||
{
|
goto err;
|
||||||
/* malformed packet. signal an error. */
|
|
||||||
free_rows(data); /* Free old data */
|
|
||||||
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
pos= (uchar*) row->data[6];
|
pos= (uchar*) row->data[6];
|
||||||
field->charsetnr= uint2korr(pos);
|
field->charsetnr= uint2korr(pos);
|
||||||
@@ -1398,6 +1395,8 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
|||||||
/* old protocol, for backward compatibility */
|
/* old protocol, for backward compatibility */
|
||||||
for (row=data->data; row ; row = row->next,field++)
|
for (row=data->data; row ; row = row->next,field++)
|
||||||
{
|
{
|
||||||
|
if (field - result >= fields)
|
||||||
|
goto err;
|
||||||
cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5);
|
cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5);
|
||||||
field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]);
|
field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]);
|
||||||
field->name= strdup_root(alloc,(char*) row->data[1]);
|
field->name= strdup_root(alloc,(char*) row->data[1]);
|
||||||
@@ -1434,8 +1433,17 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* DELETE_SUPPORT_OF_4_0_PROTOCOL */
|
#endif /* DELETE_SUPPORT_OF_4_0_PROTOCOL */
|
||||||
|
if (field - result < fields)
|
||||||
|
goto err;
|
||||||
free_rows(data); /* Free old data */
|
free_rows(data); /* Free old data */
|
||||||
DBUG_RETURN(result);
|
DBUG_RETURN(result);
|
||||||
|
|
||||||
|
err:
|
||||||
|
/* malformed packet. signal an error. */
|
||||||
|
free_rows(data);
|
||||||
|
free_root(alloc, MYF(0));
|
||||||
|
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
|
||||||
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read all rows (fields or data) from server */
|
/* Read all rows (fields or data) from server */
|
||||||
@@ -1504,7 +1512,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
cur->data[field] = to;
|
cur->data[field] = to;
|
||||||
if (len > (ulong) (end_to - to))
|
if (unlikely(len > (ulong)(end_to-to) || to > end_to))
|
||||||
{
|
{
|
||||||
free_rows(result);
|
free_rows(result);
|
||||||
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
|
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
|
||||||
@@ -1576,7 +1584,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pos + len > end_pos)
|
if (unlikely(len > (ulong)(end_pos - pos) || pos > end_pos))
|
||||||
{
|
{
|
||||||
set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
|
set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -2738,7 +2746,7 @@ static int client_mpvio_read_packet(struct st_plugin_vio *mpv, uchar **buf)
|
|||||||
*buf= mysql->net.read_pos;
|
*buf= mysql->net.read_pos;
|
||||||
|
|
||||||
/* was it a request to change plugins ? */
|
/* was it a request to change plugins ? */
|
||||||
if (**buf == 254)
|
if (pkt_len == packet_error || **buf == 254)
|
||||||
return (int)packet_error; /* if yes, this plugin shan't continue */
|
return (int)packet_error; /* if yes, this plugin shan't continue */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2923,7 +2931,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
|
|||||||
|
|
||||||
compile_time_assert(CR_OK == -1);
|
compile_time_assert(CR_OK == -1);
|
||||||
compile_time_assert(CR_ERROR == 0);
|
compile_time_assert(CR_ERROR == 0);
|
||||||
if (res > CR_OK && mysql->net.read_pos[0] != 254)
|
if (res > CR_OK && (mysql->net.last_errno || mysql->net.read_pos[0] != 254))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
the plugin returned an error. write it down in mysql,
|
the plugin returned an error. write it down in mysql,
|
||||||
|
|||||||
10
sql/item.cc
10
sql/item.cc
@@ -472,7 +472,9 @@ Item::Item(THD *thd):
|
|||||||
maybe_null=null_value=with_sum_func=with_field=0;
|
maybe_null=null_value=with_sum_func=with_field=0;
|
||||||
in_rollup= 0;
|
in_rollup= 0;
|
||||||
with_subselect= 0;
|
with_subselect= 0;
|
||||||
/* Initially this item is not attached to any JOIN_TAB. */
|
with_param= 0;
|
||||||
|
|
||||||
|
/* Initially this item is not attached to any JOIN_TAB. */
|
||||||
join_tab_idx= MAX_TABLES;
|
join_tab_idx= MAX_TABLES;
|
||||||
|
|
||||||
/* Put item in free list so that we can free all items at end */
|
/* Put item in free list so that we can free all items at end */
|
||||||
@@ -514,6 +516,7 @@ Item::Item(THD *thd, Item *item):
|
|||||||
in_rollup(item->in_rollup),
|
in_rollup(item->in_rollup),
|
||||||
null_value(item->null_value),
|
null_value(item->null_value),
|
||||||
with_sum_func(item->with_sum_func),
|
with_sum_func(item->with_sum_func),
|
||||||
|
with_param(item->with_param),
|
||||||
with_field(item->with_field),
|
with_field(item->with_field),
|
||||||
fixed(item->fixed),
|
fixed(item->fixed),
|
||||||
is_autogenerated_name(item->is_autogenerated_name),
|
is_autogenerated_name(item->is_autogenerated_name),
|
||||||
@@ -1423,6 +1426,9 @@ bool Item_sp_variable::fix_fields(THD *thd, Item **)
|
|||||||
max_length= it->max_length;
|
max_length= it->max_length;
|
||||||
decimals= it->decimals;
|
decimals= it->decimals;
|
||||||
unsigned_flag= it->unsigned_flag;
|
unsigned_flag= it->unsigned_flag;
|
||||||
|
with_param= 1;
|
||||||
|
if (thd->lex->current_select->master_unit()->item)
|
||||||
|
thd->lex->current_select->master_unit()->item->with_param= 1;
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
collation.set(it->collation.collation, it->collation.derivation);
|
collation.set(it->collation.collation, it->collation.derivation);
|
||||||
|
|
||||||
@@ -7178,6 +7184,7 @@ void Item_ref::set_properties()
|
|||||||
split_sum_func() doesn't try to change the reference.
|
split_sum_func() doesn't try to change the reference.
|
||||||
*/
|
*/
|
||||||
with_sum_func= (*ref)->with_sum_func;
|
with_sum_func= (*ref)->with_sum_func;
|
||||||
|
with_param= (*ref)->with_param;
|
||||||
with_field= (*ref)->with_field;
|
with_field= (*ref)->with_field;
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
if (alias_name_used)
|
if (alias_name_used)
|
||||||
@@ -7603,6 +7610,7 @@ Item_cache_wrapper::Item_cache_wrapper(THD *thd, Item *item_arg):
|
|||||||
Type_std_attributes::set(orig_item);
|
Type_std_attributes::set(orig_item);
|
||||||
maybe_null= orig_item->maybe_null;
|
maybe_null= orig_item->maybe_null;
|
||||||
with_sum_func= orig_item->with_sum_func;
|
with_sum_func= orig_item->with_sum_func;
|
||||||
|
with_param= orig_item->with_param;
|
||||||
with_field= orig_item->with_field;
|
with_field= orig_item->with_field;
|
||||||
name= item_arg->name;
|
name= item_arg->name;
|
||||||
name_length= item_arg->name_length;
|
name_length= item_arg->name_length;
|
||||||
|
|||||||
@@ -694,6 +694,7 @@ public:
|
|||||||
of a query with ROLLUP */
|
of a query with ROLLUP */
|
||||||
bool null_value; /* if item is null */
|
bool null_value; /* if item is null */
|
||||||
bool with_sum_func; /* True if item contains a sum func */
|
bool with_sum_func; /* True if item contains a sum func */
|
||||||
|
bool with_param; /* True if contains an SP parameter */
|
||||||
/**
|
/**
|
||||||
True if any item except Item_sum contains a field. Set during parsing.
|
True if any item except Item_sum contains a field. Set during parsing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1358,6 +1358,7 @@ bool Item_in_optimizer::fix_left(THD *thd)
|
|||||||
}
|
}
|
||||||
eval_not_null_tables(NULL);
|
eval_not_null_tables(NULL);
|
||||||
with_sum_func= args[0]->with_sum_func;
|
with_sum_func= args[0]->with_sum_func;
|
||||||
|
with_param= args[0]->with_param || args[1]->with_param;
|
||||||
with_field= args[0]->with_field;
|
with_field= args[0]->with_field;
|
||||||
if ((const_item_cache= args[0]->const_item()))
|
if ((const_item_cache= args[0]->const_item()))
|
||||||
{
|
{
|
||||||
@@ -1406,6 +1407,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
|
|||||||
with_subselect= 1;
|
with_subselect= 1;
|
||||||
with_sum_func= with_sum_func || args[1]->with_sum_func;
|
with_sum_func= with_sum_func || args[1]->with_sum_func;
|
||||||
with_field= with_field || args[1]->with_field;
|
with_field= with_field || args[1]->with_field;
|
||||||
|
with_param= args[0]->with_param || args[1]->with_param;
|
||||||
used_tables_and_const_cache_join(args[1]);
|
used_tables_and_const_cache_join(args[1]);
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1955,6 +1957,7 @@ void Item_func_interval::fix_length_and_dec()
|
|||||||
used_tables_and_const_cache_join(row);
|
used_tables_and_const_cache_join(row);
|
||||||
not_null_tables_cache= row->not_null_tables();
|
not_null_tables_cache= row->not_null_tables();
|
||||||
with_sum_func= with_sum_func || row->with_sum_func;
|
with_sum_func= with_sum_func || row->with_sum_func;
|
||||||
|
with_param= with_param || row->with_param;
|
||||||
with_field= with_field || row->with_field;
|
with_field= with_field || row->with_field;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4573,6 +4576,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
|
|||||||
List_iterator<Item> li(list);
|
List_iterator<Item> li(list);
|
||||||
Item *item;
|
Item *item;
|
||||||
uchar buff[sizeof(char*)]; // Max local vars in function
|
uchar buff[sizeof(char*)]; // Max local vars in function
|
||||||
|
bool is_and_cond= functype() == Item_func::COND_AND_FUNC;
|
||||||
not_null_tables_cache= 0;
|
not_null_tables_cache= 0;
|
||||||
used_tables_and_const_cache_init();
|
used_tables_and_const_cache_init();
|
||||||
|
|
||||||
@@ -4635,26 +4639,33 @@ Item_cond::fix_fields(THD *thd, Item **ref)
|
|||||||
(item= *li.ref())->check_cols(1))
|
(item= *li.ref())->check_cols(1))
|
||||||
return TRUE; /* purecov: inspected */
|
return TRUE; /* purecov: inspected */
|
||||||
used_tables_cache|= item->used_tables();
|
used_tables_cache|= item->used_tables();
|
||||||
if (item->const_item())
|
if (item->const_item() && !item->with_param &&
|
||||||
|
!item->is_expensive() && !cond_has_datetime_is_null(item))
|
||||||
{
|
{
|
||||||
if (!item->is_expensive() && !cond_has_datetime_is_null(item) &&
|
if (item->val_int() == is_and_cond && top_level())
|
||||||
item->val_int() == 0)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This is "... OR false_cond OR ..."
|
a. This is "... AND true_cond AND ..."
|
||||||
|
In this case, true_cond has no effect on cond_and->not_null_tables()
|
||||||
|
b. This is "... OR false_cond/null cond OR ..."
|
||||||
In this case, false_cond has no effect on cond_or->not_null_tables()
|
In this case, false_cond has no effect on cond_or->not_null_tables()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This is "... OR const_cond OR ..."
|
a. This is "... AND false_cond/null_cond AND ..."
|
||||||
|
The whole condition is FALSE/UNKNOWN.
|
||||||
|
b. This is "... OR const_cond OR ..."
|
||||||
In this case, cond_or->not_null_tables()=0, because the condition
|
In this case, cond_or->not_null_tables()=0, because the condition
|
||||||
const_cond might evaluate to true (regardless of whether some tables
|
const_cond might evaluate to true (regardless of whether some tables
|
||||||
were NULL-complemented).
|
were NULL-complemented).
|
||||||
*/
|
*/
|
||||||
|
not_null_tables_cache= (table_map) 0;
|
||||||
and_tables_cache= (table_map) 0;
|
and_tables_cache= (table_map) 0;
|
||||||
}
|
}
|
||||||
|
if (thd->is_error())
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4666,6 +4677,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
with_sum_func= with_sum_func || item->with_sum_func;
|
with_sum_func= with_sum_func || item->with_sum_func;
|
||||||
|
with_param= with_param || item->with_param;
|
||||||
with_field= with_field || item->with_field;
|
with_field= with_field || item->with_field;
|
||||||
with_subselect|= item->has_subquery();
|
with_subselect|= item->has_subquery();
|
||||||
if (item->maybe_null)
|
if (item->maybe_null)
|
||||||
@@ -4681,30 +4693,36 @@ bool
|
|||||||
Item_cond::eval_not_null_tables(uchar *opt_arg)
|
Item_cond::eval_not_null_tables(uchar *opt_arg)
|
||||||
{
|
{
|
||||||
Item *item;
|
Item *item;
|
||||||
|
bool is_and_cond= functype() == Item_func::COND_AND_FUNC;
|
||||||
List_iterator<Item> li(list);
|
List_iterator<Item> li(list);
|
||||||
not_null_tables_cache= (table_map) 0;
|
not_null_tables_cache= (table_map) 0;
|
||||||
and_tables_cache= ~(table_map) 0;
|
and_tables_cache= ~(table_map) 0;
|
||||||
while ((item=li++))
|
while ((item=li++))
|
||||||
{
|
{
|
||||||
table_map tmp_table_map;
|
table_map tmp_table_map;
|
||||||
if (item->const_item())
|
if (item->const_item() && !item->with_param &&
|
||||||
|
!item->is_expensive() && !cond_has_datetime_is_null(item))
|
||||||
{
|
{
|
||||||
if (!item->is_expensive() && !cond_has_datetime_is_null(item) &&
|
if (item->val_int() == is_and_cond && top_level())
|
||||||
item->val_int() == 0)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This is "... OR false_cond OR ..."
|
a. This is "... AND true_cond AND ..."
|
||||||
|
In this case, true_cond has no effect on cond_and->not_null_tables()
|
||||||
|
b. This is "... OR false_cond/null cond OR ..."
|
||||||
In this case, false_cond has no effect on cond_or->not_null_tables()
|
In this case, false_cond has no effect on cond_or->not_null_tables()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This is "... OR const_cond OR ..."
|
a. This is "... AND false_cond/null_cond AND ..."
|
||||||
|
The whole condition is FALSE/UNKNOWN.
|
||||||
|
b. This is "... OR const_cond OR ..."
|
||||||
In this case, cond_or->not_null_tables()=0, because the condition
|
In this case, cond_or->not_null_tables()=0, because the condition
|
||||||
some_cond_or might be true regardless of what tables are
|
const_cond might evaluate to true (regardless of whether some tables
|
||||||
NULL-complemented.
|
were NULL-complemented).
|
||||||
*/
|
*/
|
||||||
|
not_null_tables_cache= (table_map) 0;
|
||||||
and_tables_cache= (table_map) 0;
|
and_tables_cache= (table_map) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ void Item_func::sync_with_sum_func_and_with_field(List<Item> &list)
|
|||||||
{
|
{
|
||||||
with_sum_func|= item->with_sum_func;
|
with_sum_func|= item->with_sum_func;
|
||||||
with_field|= item->with_field;
|
with_field|= item->with_field;
|
||||||
|
with_param|= item->with_param;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,6 +227,7 @@ Item_func::fix_fields(THD *thd, Item **ref)
|
|||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
|
|
||||||
with_sum_func= with_sum_func || item->with_sum_func;
|
with_sum_func= with_sum_func || item->with_sum_func;
|
||||||
|
with_param= with_param || item->with_param;
|
||||||
with_field= with_field || item->with_field;
|
with_field= with_field || item->with_field;
|
||||||
used_tables_and_const_cache_join(item);
|
used_tables_and_const_cache_join(item);
|
||||||
with_subselect|= item->has_subquery();
|
with_subselect|= item->has_subquery();
|
||||||
@@ -3506,6 +3508,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
|
|||||||
func->maybe_null=1;
|
func->maybe_null=1;
|
||||||
func->with_sum_func= func->with_sum_func || item->with_sum_func;
|
func->with_sum_func= func->with_sum_func || item->with_sum_func;
|
||||||
func->with_field= func->with_field || item->with_field;
|
func->with_field= func->with_field || item->with_field;
|
||||||
|
func->with_param= func->with_param || item->with_param;
|
||||||
func->with_subselect|= item->with_subselect;
|
func->with_subselect|= item->with_subselect;
|
||||||
func->used_tables_and_const_cache_join(item);
|
func->used_tables_and_const_cache_join(item);
|
||||||
f_args.arg_type[i]=item->result_type();
|
f_args.arg_type[i]=item->result_type();
|
||||||
|
|||||||
@@ -74,16 +74,19 @@ public:
|
|||||||
{
|
{
|
||||||
with_sum_func= 0;
|
with_sum_func= 0;
|
||||||
with_field= 0;
|
with_field= 0;
|
||||||
|
with_param= 0;
|
||||||
}
|
}
|
||||||
Item_func(THD *thd, Item *a): Item_func_or_sum(thd, a), allowed_arg_cols(1)
|
Item_func(THD *thd, Item *a): Item_func_or_sum(thd, a), allowed_arg_cols(1)
|
||||||
{
|
{
|
||||||
with_sum_func= a->with_sum_func;
|
with_sum_func= a->with_sum_func;
|
||||||
|
with_param= a->with_param;
|
||||||
with_field= a->with_field;
|
with_field= a->with_field;
|
||||||
}
|
}
|
||||||
Item_func(THD *thd, Item *a, Item *b):
|
Item_func(THD *thd, Item *a, Item *b):
|
||||||
Item_func_or_sum(thd, a, b), allowed_arg_cols(1)
|
Item_func_or_sum(thd, a, b), allowed_arg_cols(1)
|
||||||
{
|
{
|
||||||
with_sum_func= a->with_sum_func || b->with_sum_func;
|
with_sum_func= a->with_sum_func || b->with_sum_func;
|
||||||
|
with_param= a->with_param || b->with_param;
|
||||||
with_field= a->with_field || b->with_field;
|
with_field= a->with_field || b->with_field;
|
||||||
}
|
}
|
||||||
Item_func(THD *thd, Item *a, Item *b, Item *c):
|
Item_func(THD *thd, Item *a, Item *b, Item *c):
|
||||||
@@ -91,6 +94,7 @@ public:
|
|||||||
{
|
{
|
||||||
with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
|
with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
|
||||||
with_field= a->with_field || b->with_field || c->with_field;
|
with_field= a->with_field || b->with_field || c->with_field;
|
||||||
|
with_param= a->with_param || b->with_param || c->with_param;
|
||||||
}
|
}
|
||||||
Item_func(THD *thd, Item *a, Item *b, Item *c, Item *d):
|
Item_func(THD *thd, Item *a, Item *b, Item *c, Item *d):
|
||||||
Item_func_or_sum(thd, a, b, c, d), allowed_arg_cols(1)
|
Item_func_or_sum(thd, a, b, c, d), allowed_arg_cols(1)
|
||||||
@@ -99,6 +103,8 @@ public:
|
|||||||
c->with_sum_func || d->with_sum_func;
|
c->with_sum_func || d->with_sum_func;
|
||||||
with_field= a->with_field || b->with_field ||
|
with_field= a->with_field || b->with_field ||
|
||||||
c->with_field || d->with_field;
|
c->with_field || d->with_field;
|
||||||
|
with_param= a->with_param || b->with_param ||
|
||||||
|
c->with_param || d->with_param;
|
||||||
}
|
}
|
||||||
Item_func(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e):
|
Item_func(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e):
|
||||||
Item_func_or_sum(thd, a, b, c, d, e), allowed_arg_cols(1)
|
Item_func_or_sum(thd, a, b, c, d, e), allowed_arg_cols(1)
|
||||||
@@ -107,6 +113,8 @@ public:
|
|||||||
c->with_sum_func || d->with_sum_func || e->with_sum_func;
|
c->with_sum_func || d->with_sum_func || e->with_sum_func;
|
||||||
with_field= a->with_field || b->with_field ||
|
with_field= a->with_field || b->with_field ||
|
||||||
c->with_field || d->with_field || e->with_field;
|
c->with_field || d->with_field || e->with_field;
|
||||||
|
with_param= a->with_param || b->with_param ||
|
||||||
|
c->with_param || d->with_param || e->with_param;
|
||||||
}
|
}
|
||||||
Item_func(THD *thd, List<Item> &list):
|
Item_func(THD *thd, List<Item> &list):
|
||||||
Item_func_or_sum(thd, list), allowed_arg_cols(1)
|
Item_func_or_sum(thd, list), allowed_arg_cols(1)
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ bool Item_row::fix_fields(THD *thd, Item **ref)
|
|||||||
with_sum_func= with_sum_func || item->with_sum_func;
|
with_sum_func= with_sum_func || item->with_sum_func;
|
||||||
with_field= with_field || item->with_field;
|
with_field= with_field || item->with_field;
|
||||||
with_subselect|= item->with_subselect;
|
with_subselect|= item->with_subselect;
|
||||||
|
with_param|= item->with_param;
|
||||||
}
|
}
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -1159,6 +1159,7 @@ Item_sum_num::fix_fields(THD *thd, Item **ref)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
set_if_bigger(decimals, args[i]->decimals);
|
set_if_bigger(decimals, args[i]->decimals);
|
||||||
with_subselect|= args[i]->with_subselect;
|
with_subselect|= args[i]->with_subselect;
|
||||||
|
with_param|= args[i]->with_param;
|
||||||
}
|
}
|
||||||
result_field=0;
|
result_field=0;
|
||||||
max_length=float_length(decimals);
|
max_length=float_length(decimals);
|
||||||
@@ -1190,6 +1191,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
Type_std_attributes::set(args[0]);
|
Type_std_attributes::set(args[0]);
|
||||||
with_subselect= args[0]->with_subselect;
|
with_subselect= args[0]->with_subselect;
|
||||||
|
with_param= args[0]->with_param;
|
||||||
|
|
||||||
Item *item2= item->real_item();
|
Item *item2= item->real_item();
|
||||||
if (item2->type() == Item::FIELD_ITEM)
|
if (item2->type() == Item::FIELD_ITEM)
|
||||||
@@ -3361,6 +3363,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
|
|||||||
args[i]->check_cols(1))
|
args[i]->check_cols(1))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
with_subselect|= args[i]->with_subselect;
|
with_subselect|= args[i]->with_subselect;
|
||||||
|
with_param|= args[i]->with_param;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* skip charset aggregation for order columns */
|
/* skip charset aggregation for order columns */
|
||||||
|
|||||||
@@ -3744,22 +3744,30 @@ bool setup_sj_materialization_part1(JOIN_TAB *sjm_tab)
|
|||||||
sjm= emb_sj_nest->sj_mat_info;
|
sjm= emb_sj_nest->sj_mat_info;
|
||||||
thd= tab->join->thd;
|
thd= tab->join->thd;
|
||||||
/* First the calls come to the materialization function */
|
/* First the calls come to the materialization function */
|
||||||
//List<Item> &item_list= emb_sj_nest->sj_subq_pred->unit->first_select()->item_list;
|
|
||||||
|
|
||||||
DBUG_ASSERT(sjm->is_used);
|
DBUG_ASSERT(sjm->is_used);
|
||||||
/*
|
/*
|
||||||
Set up the table to write to, do as select_union::create_result_table does
|
Set up the table to write to, do as select_union::create_result_table does
|
||||||
*/
|
*/
|
||||||
sjm->sjm_table_param.init();
|
sjm->sjm_table_param.init();
|
||||||
sjm->sjm_table_param.bit_fields_as_long= TRUE;
|
sjm->sjm_table_param.bit_fields_as_long= TRUE;
|
||||||
//List_iterator<Item> it(item_list);
|
|
||||||
SELECT_LEX *subq_select= emb_sj_nest->sj_subq_pred->unit->first_select();
|
SELECT_LEX *subq_select= emb_sj_nest->sj_subq_pred->unit->first_select();
|
||||||
Item **p_item= subq_select->ref_pointer_array;
|
List_iterator<Item> it(subq_select->item_list);
|
||||||
Item **p_end= p_item + subq_select->item_list.elements;
|
Item *item;
|
||||||
//while((right_expr= it++))
|
while((item= it++))
|
||||||
for(;p_item != p_end; p_item++)
|
{
|
||||||
sjm->sjm_table_cols.push_back(*p_item, thd->mem_root);
|
/*
|
||||||
|
This semi-join replaced the subquery (subq_select) and so on
|
||||||
|
re-executing it will not be prepared. To use the Items from its
|
||||||
|
select list we have to prepare (fix_fields) them
|
||||||
|
*/
|
||||||
|
if (!item->fixed && item->fix_fields(thd, it.ref()))
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
|
item= *(it.ref()); // it can be changed by fix_fields
|
||||||
|
DBUG_ASSERT(!item->name_length || item->name_length == strlen(item->name));
|
||||||
|
sjm->sjm_table_cols.push_back(item, thd->mem_root);
|
||||||
|
}
|
||||||
|
|
||||||
sjm->sjm_table_param.field_count= subq_select->item_list.elements;
|
sjm->sjm_table_param.field_count= subq_select->item_list.elements;
|
||||||
sjm->sjm_table_param.force_not_null_cols= TRUE;
|
sjm->sjm_table_param.force_not_null_cols= TRUE;
|
||||||
|
|
||||||
|
|||||||
@@ -11475,6 +11475,7 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
|
|||||||
const char *client_auth_plugin=
|
const char *client_auth_plugin=
|
||||||
((st_mysql_auth *) (plugin_decl(mpvio->plugin)->info))->client_auth_plugin;
|
((st_mysql_auth *) (plugin_decl(mpvio->plugin)->info))->client_auth_plugin;
|
||||||
|
|
||||||
|
DBUG_EXECUTE_IF("auth_disconnect", { vio_close(net->vio); DBUG_RETURN(1); });
|
||||||
DBUG_ASSERT(client_auth_plugin);
|
DBUG_ASSERT(client_auth_plugin);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -995,10 +995,7 @@ void close_thread_tables(THD *thd)
|
|||||||
we will exit this function a few lines below.
|
we will exit this function a few lines below.
|
||||||
*/
|
*/
|
||||||
if (! thd->lex->requires_prelocking())
|
if (! thd->lex->requires_prelocking())
|
||||||
{
|
|
||||||
thd->locked_tables_list.reopen_tables(thd, true);
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We are in the top-level statement of a prelocked statement,
|
We are in the top-level statement of a prelocked statement,
|
||||||
|
|||||||
@@ -5722,6 +5722,10 @@ finish:
|
|||||||
|
|
||||||
lex->unit.cleanup();
|
lex->unit.cleanup();
|
||||||
|
|
||||||
|
/* close/reopen tables that were marked to need reopen under LOCK TABLES */
|
||||||
|
if (! thd->lex->requires_prelocking())
|
||||||
|
thd->locked_tables_list.reopen_tables(thd, true);
|
||||||
|
|
||||||
if (! thd->in_sub_stmt)
|
if (! thd->in_sub_stmt)
|
||||||
{
|
{
|
||||||
if (thd->killed != NOT_KILLED)
|
if (thd->killed != NOT_KILLED)
|
||||||
|
|||||||
@@ -1148,9 +1148,6 @@ JOIN::optimize_inner()
|
|||||||
|
|
||||||
eval_select_list_used_tables();
|
eval_select_list_used_tables();
|
||||||
|
|
||||||
if (optimize_constant_subqueries())
|
|
||||||
DBUG_RETURN(1);
|
|
||||||
|
|
||||||
table_count= select_lex->leaf_tables.elements;
|
table_count= select_lex->leaf_tables.elements;
|
||||||
|
|
||||||
if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */
|
if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */
|
||||||
@@ -1212,6 +1209,9 @@ JOIN::optimize_inner()
|
|||||||
thd->restore_active_arena(arena, &backup);
|
thd->restore_active_arena(arena, &backup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (optimize_constant_subqueries())
|
||||||
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
if (setup_jtbm_semi_joins(this, join_list, &conds))
|
if (setup_jtbm_semi_joins(this, join_list, &conds))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ ENDIF(CONNECT_WITH_ODBC)
|
|||||||
#
|
#
|
||||||
# JDBC with MongoDB Java Driver included but disabled if without MONGO
|
# JDBC with MongoDB Java Driver included but disabled if without MONGO
|
||||||
#
|
#
|
||||||
# OPTION(CONNECT_WITH_MONGO "Compile CONNECT storage engine with MONGO support" ON)
|
#OPTION(CONNECT_WITH_MONGO "Compile CONNECT storage engine with MONGO support" ON)
|
||||||
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON)
|
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON)
|
||||||
|
|
||||||
IF(CONNECT_WITH_JDBC)
|
IF(CONNECT_WITH_JDBC)
|
||||||
@@ -326,6 +326,13 @@ IF(NOT TARGET connect)
|
|||||||
RETURN()
|
RETURN()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
IF (libmongoc-1.0_FOUND)
|
||||||
|
SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS
|
||||||
|
"/DELAYLOAD:libbson-1.0.dll /DELAYLOAD:libmongoc-1.0.dll")
|
||||||
|
ENDIF(libmongoc-1.0_FOUND)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
# Install some extra files that belong to connect engine
|
# Install some extra files that belong to connect engine
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
# install ha_connect.lib
|
# install ha_connect.lib
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
|
|
||||||
package wrappers;
|
package wrappers;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.Console;
|
import java.io.Console;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.sql.Time;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
public class Client {
|
public class Client {
|
||||||
static boolean DEBUG = true;
|
static boolean DEBUG = true;
|
||||||
@@ -58,6 +62,9 @@ public class Client {
|
|||||||
String query;
|
String query;
|
||||||
System.out.println("Successfully connected to " + parms[1]);
|
System.out.println("Successfully connected to " + parms[1]);
|
||||||
|
|
||||||
|
s = jdi.GetQuoteString();
|
||||||
|
System.out.println("Qstr = '" + s + "'");
|
||||||
|
|
||||||
while ((query = getLine("Query: ", false)) != null) {
|
while ((query = getLine("Query: ", false)) != null) {
|
||||||
n = jdi.Execute(query);
|
n = jdi.Execute(query);
|
||||||
System.out.println("Returned n = " + n);
|
System.out.println("Returned n = " + n);
|
||||||
@@ -79,7 +86,11 @@ public class Client {
|
|||||||
private static void PrintResult(int ncol) {
|
private static void PrintResult(int ncol) {
|
||||||
// Get result set meta data
|
// Get result set meta data
|
||||||
int i;
|
int i;
|
||||||
|
Date date = new Date(0);
|
||||||
|
Time time = new Time(0);
|
||||||
|
Timestamp tsp = new Timestamp(0);
|
||||||
String columnName;
|
String columnName;
|
||||||
|
Object job;
|
||||||
|
|
||||||
// Get the column names; column indices start from 1
|
// Get the column names; column indices start from 1
|
||||||
for (i = 1; i <= ncol; i++) {
|
for (i = 1; i <= ncol; i++) {
|
||||||
@@ -112,6 +123,7 @@ public class Client {
|
|||||||
case java.sql.Types.VARCHAR:
|
case java.sql.Types.VARCHAR:
|
||||||
case java.sql.Types.LONGVARCHAR:
|
case java.sql.Types.LONGVARCHAR:
|
||||||
case java.sql.Types.CHAR:
|
case java.sql.Types.CHAR:
|
||||||
|
case 1111:
|
||||||
System.out.print(jdi.StringField(i, null));
|
System.out.print(jdi.StringField(i, null));
|
||||||
break;
|
break;
|
||||||
case java.sql.Types.INTEGER:
|
case java.sql.Types.INTEGER:
|
||||||
@@ -120,14 +132,17 @@ public class Client {
|
|||||||
case java.sql.Types.BIGINT:
|
case java.sql.Types.BIGINT:
|
||||||
System.out.print(jdi.BigintField(i, null));
|
System.out.print(jdi.BigintField(i, null));
|
||||||
break;
|
break;
|
||||||
case java.sql.Types.TIMESTAMP:
|
|
||||||
System.out.print(jdi.TimestampField(i, null));
|
|
||||||
break;
|
|
||||||
case java.sql.Types.TIME:
|
case java.sql.Types.TIME:
|
||||||
System.out.print(jdi.TimeField(i, null));
|
time.setTime((long)jdi.TimeField(i, null) * 1000);
|
||||||
|
System.out.print(time);
|
||||||
break;
|
break;
|
||||||
case java.sql.Types.DATE:
|
case java.sql.Types.DATE:
|
||||||
System.out.print(jdi.DateField(i, null));
|
date.setTime((long)jdi.DateField(i, null) * 1000);
|
||||||
|
System.out.print(date);
|
||||||
|
break;
|
||||||
|
case java.sql.Types.TIMESTAMP:
|
||||||
|
tsp.setTime((long)jdi.TimestampField(i, null) * 1000);
|
||||||
|
System.out.print(tsp);
|
||||||
break;
|
break;
|
||||||
case java.sql.Types.SMALLINT:
|
case java.sql.Types.SMALLINT:
|
||||||
System.out.print(jdi.IntField(i, null));
|
System.out.print(jdi.IntField(i, null));
|
||||||
@@ -141,6 +156,8 @@ public class Client {
|
|||||||
case java.sql.Types.BOOLEAN:
|
case java.sql.Types.BOOLEAN:
|
||||||
System.out.print(jdi.BooleanField(i, null));
|
System.out.print(jdi.BooleanField(i, null));
|
||||||
default:
|
default:
|
||||||
|
job = jdi.ObjectField(i, null);
|
||||||
|
System.out.print(job.toString());
|
||||||
break;
|
break;
|
||||||
} // endswitch Type
|
} // endswitch Type
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -1,10 +1,22 @@
|
|||||||
package wrappers;
|
package wrappers;
|
||||||
|
|
||||||
import java.math.*;
|
import java.math.BigDecimal;
|
||||||
import java.sql.*;
|
import java.sql.Connection;
|
||||||
|
import java.sql.DatabaseMetaData;
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.sql.Driver;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.ResultSetMetaData;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.sql.Time;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@@ -223,6 +235,24 @@ public class JdbcInterface {
|
|||||||
|
|
||||||
} // end of SetTimestampParm
|
} // end of SetTimestampParm
|
||||||
|
|
||||||
|
public void SetUuidParm(int i, String s) {
|
||||||
|
try {
|
||||||
|
UUID uuid;
|
||||||
|
|
||||||
|
if (s == null)
|
||||||
|
uuid = null;
|
||||||
|
else if (s.isEmpty())
|
||||||
|
uuid = UUID.randomUUID();
|
||||||
|
else
|
||||||
|
uuid = UUID.fromString(s);
|
||||||
|
|
||||||
|
pstmt.setObject(i, uuid);
|
||||||
|
} catch (Exception e) {
|
||||||
|
SetErrmsg(e);
|
||||||
|
} // end try/catch
|
||||||
|
|
||||||
|
} // end of SetUuidParm
|
||||||
|
|
||||||
public int SetNullParm(int i, int typ) {
|
public int SetNullParm(int i, int typ) {
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
@@ -481,6 +511,8 @@ public class JdbcInterface {
|
|||||||
System.out.println("Executing query '" + query + "'");
|
System.out.println("Executing query '" + query + "'");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (rs != null)
|
||||||
|
rs.close();
|
||||||
rs = stmt.executeQuery(query);
|
rs = stmt.executeQuery(query);
|
||||||
rsmd = rs.getMetaData();
|
rsmd = rs.getMetaData();
|
||||||
ncol = rsmd.getColumnCount();
|
ncol = rsmd.getColumnCount();
|
||||||
@@ -708,7 +740,7 @@ public class JdbcInterface {
|
|||||||
return 0;
|
return 0;
|
||||||
} // end of TimestampField
|
} // end of TimestampField
|
||||||
|
|
||||||
public Object ObjectField(int n, String name) {
|
public Object ObjectField(int n, String name) {
|
||||||
if (rs == null) {
|
if (rs == null) {
|
||||||
System.out.println("No result set");
|
System.out.println("No result set");
|
||||||
} else try {
|
} else try {
|
||||||
@@ -720,6 +752,22 @@ public class JdbcInterface {
|
|||||||
return null;
|
return null;
|
||||||
} // end of ObjectField
|
} // end of ObjectField
|
||||||
|
|
||||||
|
public String UuidField(int n, String name) {
|
||||||
|
Object job;
|
||||||
|
|
||||||
|
if (rs == null) {
|
||||||
|
System.out.println("No result set");
|
||||||
|
} else
|
||||||
|
try {
|
||||||
|
job = (n > 0) ? rs.getObject(n) : rs.getObject(name);
|
||||||
|
return job.toString();
|
||||||
|
} catch (SQLException se) {
|
||||||
|
SetErrmsg(se);
|
||||||
|
} // end try/catch
|
||||||
|
|
||||||
|
return null;
|
||||||
|
} // end of UuidField
|
||||||
|
|
||||||
public int GetDrivers(String[] s, int mxs) {
|
public int GetDrivers(String[] s, int mxs) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
List<Driver> drivers = Collections.list(DriverManager.getDrivers());
|
List<Driver> drivers = Collections.list(DriverManager.getDrivers());
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package wrappers;
|
package wrappers;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.SQLException;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.postgresql.jdbc2.optional.PoolingDataSource;
|
import org.postgresql.jdbc2.optional.PoolingDataSource;
|
||||||
|
|
||||||
public class PostgresqlInterface extends JdbcInterface {
|
public class PostgresqlInterface extends JdbcInterface {
|
||||||
@@ -19,7 +20,7 @@ public class PostgresqlInterface extends JdbcInterface {
|
|||||||
|
|
||||||
} // end of constructor
|
} // end of constructor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int JdbcConnect(String[] parms, int fsize, boolean scrollable) {
|
public int JdbcConnect(String[] parms, int fsize, boolean scrollable) {
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
String url = parms[1];
|
String url = parms[1];
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp)
|
|||||||
if ((valtyp = pp->Type) != TYPE_STRING)
|
if ((valtyp = pp->Type) != TYPE_STRING)
|
||||||
len = 1;
|
len = 1;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("valtyp=%d len=%d\n", valtyp, len);
|
htrc("valtyp=%d len=%d\n", valtyp, len);
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
@@ -287,7 +287,7 @@ bool ARRAY::AddValue(PGLOBAL g, PSZ strp)
|
|||||||
return true;
|
return true;
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" adding string(%d): '%s'\n", Nval, strp);
|
htrc(" adding string(%d): '%s'\n", Nval, strp);
|
||||||
|
|
||||||
//Value->SetValue_psz(strp);
|
//Value->SetValue_psz(strp);
|
||||||
@@ -306,7 +306,7 @@ bool ARRAY::AddValue(PGLOBAL g, void *p)
|
|||||||
return true;
|
return true;
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" adding pointer(%d): %p\n", Nval, p);
|
htrc(" adding pointer(%d): %p\n", Nval, p);
|
||||||
|
|
||||||
Vblp->SetValue((PSZ)p, Nval++);
|
Vblp->SetValue((PSZ)p, Nval++);
|
||||||
@@ -323,7 +323,7 @@ bool ARRAY::AddValue(PGLOBAL g, short n)
|
|||||||
return true;
|
return true;
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" adding SHORT(%d): %hd\n", Nval, n);
|
htrc(" adding SHORT(%d): %hd\n", Nval, n);
|
||||||
|
|
||||||
//Value->SetValue(n);
|
//Value->SetValue(n);
|
||||||
@@ -342,7 +342,7 @@ bool ARRAY::AddValue(PGLOBAL g, int n)
|
|||||||
return true;
|
return true;
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" adding int(%d): %d\n", Nval, n);
|
htrc(" adding int(%d): %d\n", Nval, n);
|
||||||
|
|
||||||
//Value->SetValue(n);
|
//Value->SetValue(n);
|
||||||
@@ -361,7 +361,7 @@ bool ARRAY::AddValue(PGLOBAL g, double d)
|
|||||||
return true;
|
return true;
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" adding float(%d): %lf\n", Nval, d);
|
htrc(" adding float(%d): %lf\n", Nval, d);
|
||||||
|
|
||||||
Value->SetValue(d);
|
Value->SetValue(d);
|
||||||
@@ -380,7 +380,7 @@ bool ARRAY::AddValue(PGLOBAL g, PXOB xp)
|
|||||||
return true;
|
return true;
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" adding (%d) from xp=%p\n", Nval, xp);
|
htrc(" adding (%d) from xp=%p\n", Nval, xp);
|
||||||
|
|
||||||
//AddValue(xp->GetValue());
|
//AddValue(xp->GetValue());
|
||||||
@@ -399,7 +399,7 @@ bool ARRAY::AddValue(PGLOBAL g, PVAL vp)
|
|||||||
return true;
|
return true;
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" adding (%d) from vp=%p\n", Nval, vp);
|
htrc(" adding (%d) from vp=%p\n", Nval, vp);
|
||||||
|
|
||||||
Vblp->SetValue(vp, Nval++);
|
Vblp->SetValue(vp, Nval++);
|
||||||
@@ -520,7 +520,7 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm)
|
|||||||
|
|
||||||
} else if (opc != OP_EXIST) {
|
} else if (opc != OP_EXIST) {
|
||||||
sprintf(g->Message, MSG(MISSING_ARG), opc);
|
sprintf(g->Message, MSG(MISSING_ARG), opc);
|
||||||
throw (int)TYPE_ARRAY;
|
throw (int)TYPE_ARRAY;
|
||||||
} else // OP_EXIST
|
} else // OP_EXIST
|
||||||
return Nval > 0;
|
return Nval > 0;
|
||||||
|
|
||||||
@@ -990,7 +990,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
|
|||||||
len += strlen(tp);
|
len += strlen(tp);
|
||||||
} // enfor i
|
} // enfor i
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Arraylist: len=%d\n", len);
|
htrc("Arraylist: len=%d\n", len);
|
||||||
|
|
||||||
p = (char *)PlugSubAlloc(g, NULL, len);
|
p = (char *)PlugSubAlloc(g, NULL, len);
|
||||||
@@ -1003,7 +1003,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
|
|||||||
strcat(p, (++i == Nval) ? ")" : ",");
|
strcat(p, (++i == Nval) ? ")" : ",");
|
||||||
} // enfor i
|
} // enfor i
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Arraylist: newlen=%d\n", strlen(p));
|
htrc("Arraylist: newlen=%d\n", strlen(p));
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ int BLKFILARI::BlockEval(PGLOBAL)
|
|||||||
break;
|
break;
|
||||||
} // endswitch Opc
|
} // endswitch Opc
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);
|
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
@@ -338,7 +338,7 @@ int BLKFILAR2::BlockEval(PGLOBAL)
|
|||||||
break;
|
break;
|
||||||
} // endswitch Opc
|
} // endswitch Opc
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);
|
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
@@ -474,7 +474,7 @@ int BLKFILMR2::BlockEval(PGLOBAL)
|
|||||||
break;
|
break;
|
||||||
} // endswitch Opc
|
} // endswitch Opc
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);
|
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
@@ -567,7 +567,7 @@ int BLKSPCARI::BlockEval(PGLOBAL)
|
|||||||
break;
|
break;
|
||||||
} // endswitch Opc
|
} // endswitch Opc
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);
|
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ typedef class BLOCK *PBLOCK;
|
|||||||
class DllExport BLOCK {
|
class DllExport BLOCK {
|
||||||
public:
|
public:
|
||||||
void * operator new(size_t size, PGLOBAL g, void *p = NULL) {
|
void * operator new(size_t size, PGLOBAL g, void *p = NULL) {
|
||||||
// if (trace > 3)
|
if (trace(256))
|
||||||
// htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);
|
htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);
|
||||||
|
|
||||||
return (PlugSubAlloc(g, p, size));
|
return (PlugSubAlloc(g, p, size));
|
||||||
} // end of new
|
} // end of new
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ enum USETEMP {TMP_NO = 0, /* Never */
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
enum TYPCONV {TPC_NO = 0, /* Never */
|
enum TYPCONV {TPC_NO = 0, /* Never */
|
||||||
TPC_YES = 1, /* Always */
|
TPC_YES = 1, /* Always */
|
||||||
TPC_SKIP = 2}; /* Skip TEXT columns */
|
TPC_FORCE = 2, /* Also convert BLOBs */
|
||||||
|
TPC_SKIP = 3}; /* Skip TEXT columns */
|
||||||
|
|
||||||
#endif // _CHKLVL_DEFINED_
|
#endif // _CHKLVL_DEFINED_
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
|
|||||||
all = true;
|
all = true;
|
||||||
|
|
||||||
if (Pcg->Pipe) {
|
if (Pcg->Pipe) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Pipeline: %s\n", options);
|
htrc("Pipeline: %s\n", options);
|
||||||
|
|
||||||
p = strrchr(options, ']');
|
p = strrchr(options, ']');
|
||||||
@@ -330,7 +330,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
|
|||||||
*(char*)p = ']'; // Restore Colist for discovery
|
*(char*)p = ']'; // Restore Colist for discovery
|
||||||
p = s->GetStr();
|
p = s->GetStr();
|
||||||
|
|
||||||
if (trace)
|
if (trace(33))
|
||||||
htrc("New Pipeline: %s\n", p);
|
htrc("New Pipeline: %s\n", p);
|
||||||
|
|
||||||
Query = bson_new_from_json((const uint8_t *)p, -1, &Error);
|
Query = bson_new_from_json((const uint8_t *)p, -1, &Error);
|
||||||
@@ -350,7 +350,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (Pcg->Filter || filp) {
|
if (Pcg->Filter || filp) {
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
if (Pcg->Filter)
|
if (Pcg->Filter)
|
||||||
htrc("Filter: %s\n", Pcg->Filter);
|
htrc("Filter: %s\n", Pcg->Filter);
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
|
|||||||
tp->SetFilter(NULL); // Not needed anymore
|
tp->SetFilter(NULL); // Not needed anymore
|
||||||
} // endif To_Filter
|
} // endif To_Filter
|
||||||
|
|
||||||
if (trace)
|
if (trace(33))
|
||||||
htrc("selector: %s\n", s->GetStr());
|
htrc("selector: %s\n", s->GetStr());
|
||||||
|
|
||||||
s->Resize(s->GetLength() + 1);
|
s->Resize(s->GetLength() + 1);
|
||||||
@@ -393,7 +393,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
|
|||||||
|
|
||||||
if (!all) {
|
if (!all) {
|
||||||
if (options && *options) {
|
if (options && *options) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("options=%s\n", options);
|
htrc("options=%s\n", options);
|
||||||
|
|
||||||
p = options;
|
p = options;
|
||||||
@@ -450,10 +450,10 @@ int CMgoConn::ReadNext(PGLOBAL g)
|
|||||||
if (!Cursor && MakeCursor(g)) {
|
if (!Cursor && MakeCursor(g)) {
|
||||||
rc = RC_FX;
|
rc = RC_FX;
|
||||||
} else if (mongoc_cursor_next(Cursor, &Document)) {
|
} else if (mongoc_cursor_next(Cursor, &Document)) {
|
||||||
if (trace > 1) {
|
if (trace(512)) {
|
||||||
bson_iter_t iter;
|
bson_iter_t iter;
|
||||||
ShowDocument(&iter, Document, "");
|
ShowDocument(&iter, Document, "");
|
||||||
} else if (trace == 1)
|
} else if (trace(1))
|
||||||
htrc("%s\n", GetDocument(g));
|
htrc("%s\n", GetDocument(g));
|
||||||
|
|
||||||
} else if (mongoc_cursor_error(Cursor, &Error)) {
|
} else if (mongoc_cursor_error(Cursor, &Error)) {
|
||||||
@@ -589,7 +589,7 @@ int CMgoConn::Write(PGLOBAL g)
|
|||||||
if (DocWrite(g, Fpc))
|
if (DocWrite(g, Fpc))
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
|
|
||||||
if (trace) {
|
if (trace(2)) {
|
||||||
char *str = bson_as_json(Fpc->Child, NULL);
|
char *str = bson_as_json(Fpc->Child, NULL);
|
||||||
htrc("Inserting: %s\n", str);
|
htrc("Inserting: %s\n", str);
|
||||||
bson_free(str);
|
bson_free(str);
|
||||||
@@ -623,7 +623,7 @@ int CMgoConn::Write(PGLOBAL g)
|
|||||||
} // endif iter
|
} // endif iter
|
||||||
|
|
||||||
if (b) {
|
if (b) {
|
||||||
if (trace) {
|
if (trace(2)) {
|
||||||
char *str = bson_as_json(query, NULL);
|
char *str = bson_as_json(query, NULL);
|
||||||
htrc("update query: %s\n", str);
|
htrc("update query: %s\n", str);
|
||||||
bson_free(str);
|
bson_free(str);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ COLBLK::COLBLK(PCOL col1, PTDB tdbp)
|
|||||||
//To_Orig = col1;
|
//To_Orig = col1;
|
||||||
To_Tdb = tdbp;
|
To_Tdb = tdbp;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
|
htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
|
||||||
|
|
||||||
if (tdbp)
|
if (tdbp)
|
||||||
@@ -115,7 +115,7 @@ bool COLBLK::SetFormat(PGLOBAL, FORMAT& fmt)
|
|||||||
{
|
{
|
||||||
fmt = Format;
|
fmt = Format;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("COLBLK: %p format=%c(%d,%d)\n",
|
htrc("COLBLK: %p format=%c(%d,%d)\n",
|
||||||
this, *fmt.Type, fmt.Length, fmt.Prec);
|
this, *fmt.Type, fmt.Length, fmt.Prec);
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ bool COLBLK::SetFormat(PGLOBAL, FORMAT& fmt)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool COLBLK::Eval(PGLOBAL g)
|
bool COLBLK::Eval(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Col Eval: %s status=%.4X\n", Name, Status);
|
htrc("Col Eval: %s status=%.4X\n", Name, Status);
|
||||||
|
|
||||||
if (!GetStatus(BUF_READ)) {
|
if (!GetStatus(BUF_READ)) {
|
||||||
@@ -165,7 +165,7 @@ bool COLBLK::InitValue(PGLOBAL g)
|
|||||||
AddStatus(BUF_READY);
|
AddStatus(BUF_READY);
|
||||||
Value->SetNullable(Nullable);
|
Value->SetNullable(Nullable);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" colp=%p type=%d value=%p coluse=%.4X status=%.4X\n",
|
htrc(" colp=%p type=%d value=%p coluse=%.4X status=%.4X\n",
|
||||||
this, Buf_Type, Value, ColUse, Status);
|
this, Buf_Type, Value, ColUse, Status);
|
||||||
|
|
||||||
@@ -412,4 +412,3 @@ void SIDBLK::ReadColumn(PGLOBAL)
|
|||||||
// } // endif Sname
|
// } // endif Sname
|
||||||
|
|
||||||
} // end of ReadColumn
|
} // end of ReadColumn
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void CntEndDB(PGLOBAL g)
|
|||||||
|
|
||||||
free(dbuserp);
|
free(dbuserp);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("CntEndDB: Freeing Dup\n");
|
htrc("CntEndDB: Freeing Dup\n");
|
||||||
|
|
||||||
g->Activityp->Aptr = NULL;
|
g->Activityp->Aptr = NULL;
|
||||||
@@ -112,14 +112,14 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
|
|||||||
bool rc= false;
|
bool rc= false;
|
||||||
PDBUSER dbuserp= PlgGetUser(g);
|
PDBUSER dbuserp= PlgGetUser(g);
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
printf("CntCheckDB: dbuserp=%p\n", dbuserp);
|
printf("CntCheckDB: dbuserp=%p\n", dbuserp);
|
||||||
} // endif trace
|
} // endif trace
|
||||||
|
|
||||||
if (!dbuserp || !handler)
|
if (!dbuserp || !handler)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("cat=%p oldhandler=%p newhandler=%p\n", dbuserp->Catalog,
|
printf("cat=%p oldhandler=%p newhandler=%p\n", dbuserp->Catalog,
|
||||||
(dbuserp->Catalog) ? ((MYCAT*)dbuserp->Catalog)->GetHandler() : NULL,
|
(dbuserp->Catalog) ? ((MYCAT*)dbuserp->Catalog)->GetHandler() : NULL,
|
||||||
handler);
|
handler);
|
||||||
@@ -150,7 +150,7 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
sprintf(g->Message, MSG(DATABASE_LOADED), "???");
|
sprintf(g->Message, MSG(DATABASE_LOADED), "???");
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("msg=%s\n", g->Message);
|
printf("msg=%s\n", g->Message);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -198,7 +198,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
|||||||
PDBUSER dup = PlgGetUser(g);
|
PDBUSER dup = PlgGetUser(g);
|
||||||
volatile PCATLG cat = (dup) ? dup->Catalog : NULL; // Safe over throw
|
volatile PCATLG cat = (dup) ? dup->Catalog : NULL; // Safe over throw
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
|
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
|
||||||
|
|
||||||
if (!cat)
|
if (!cat)
|
||||||
@@ -208,7 +208,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
|||||||
// Get table object from the catalog
|
// Get table object from the catalog
|
||||||
tabp = new(g) XTAB(name);
|
tabp = new(g) XTAB(name);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("CntGetTDB: tabp=%p\n", tabp);
|
printf("CntGetTDB: tabp=%p\n", tabp);
|
||||||
|
|
||||||
// Perhaps this should be made thread safe
|
// Perhaps this should be made thread safe
|
||||||
@@ -218,13 +218,13 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
|||||||
printf("CntGetTDB: %s\n", g->Message);
|
printf("CntGetTDB: %s\n", g->Message);
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
strcpy(g->Message, msg);
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("Returning tdbp=%p mode=%d\n", tdbp, mode);
|
printf("Returning tdbp=%p mode=%d\n", tdbp, mode);
|
||||||
|
|
||||||
return tdbp;
|
return tdbp;
|
||||||
@@ -243,7 +243,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
//PCOLUMN cp;
|
//PCOLUMN cp;
|
||||||
PDBUSER dup= PlgGetUser(g);
|
PDBUSER dup= PlgGetUser(g);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("CntOpenTable: tdbp=%p mode=%d\n", tdbp, mode);
|
printf("CntOpenTable: tdbp=%p mode=%d\n", tdbp, mode);
|
||||||
|
|
||||||
if (!tdbp) {
|
if (!tdbp) {
|
||||||
@@ -260,7 +260,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
|
|
||||||
} else for (p = c1; *p; p += n) {
|
} else for (p = c1; *p; p += n) {
|
||||||
// Allocate only used column blocks
|
// Allocate only used column blocks
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("Allocating column %s\n", p);
|
printf("Allocating column %s\n", p);
|
||||||
|
|
||||||
g->Message[0] = 0; // To check whether ColDB made an error message
|
g->Message[0] = 0; // To check whether ColDB made an error message
|
||||||
@@ -325,7 +325,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
tdbp->SetSetCols(tdbp->GetColumns());
|
tdbp->SetSetCols(tdbp->GetColumns());
|
||||||
|
|
||||||
// Now do open the physical table
|
// Now do open the physical table
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("Opening table %s in mode %d tdbp=%p\n",
|
printf("Opening table %s in mode %d tdbp=%p\n",
|
||||||
tdbp->GetName(), mode, tdbp);
|
tdbp->GetName(), mode, tdbp);
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
} // endif del
|
} // endif del
|
||||||
|
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("About to open the table: tdbp=%p\n", tdbp);
|
printf("About to open the table: tdbp=%p\n", tdbp);
|
||||||
|
|
||||||
if (mode != MODE_ANY && mode != MODE_ALTER) {
|
if (mode != MODE_ANY && mode != MODE_ALTER) {
|
||||||
@@ -356,7 +356,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
rcop = false;
|
rcop = false;
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
strcpy(g->Message, msg);
|
||||||
@@ -399,12 +399,13 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr)
|
|||||||
} // endfor colp
|
} // endfor colp
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("Error %d reading columns: %s\n", n, g->Message);
|
printf("Error %d reading columns: %s\n", n, g->Message);
|
||||||
|
|
||||||
rc = RC_FX;
|
rc = RC_FX;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
strcpy(g->Message, msg);
|
||||||
|
rc = RC_NF;
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -549,7 +550,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
|
|||||||
return rc;
|
return rc;
|
||||||
} // endif !USE_OPEN
|
} // endif !USE_OPEN
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("CntCloseTable: tdbp=%p mode=%d nox=%d abort=%d\n",
|
printf("CntCloseTable: tdbp=%p mode=%d nox=%d abort=%d\n",
|
||||||
tdbp, tdbp->GetMode(), nox, abort);
|
tdbp, tdbp->GetMode(), nox, abort);
|
||||||
|
|
||||||
@@ -579,11 +580,11 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
|
|||||||
tdbp->CloseDB(g);
|
tdbp->CloseDB(g);
|
||||||
tdbp->SetAbort(false);
|
tdbp->SetAbort(false);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
printf("Table %s closed\n", tdbp->GetName());
|
printf("Table %s closed\n", tdbp->GetName());
|
||||||
|
|
||||||
if (!nox && tdbp->GetMode() != MODE_READ && tdbp->GetMode() != MODE_ANY) {
|
if (!nox && tdbp->GetMode() != MODE_READ && tdbp->GetMode() != MODE_ANY) {
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
printf("About to reset opt\n");
|
printf("About to reset opt\n");
|
||||||
|
|
||||||
if (!tdbp->IsRemote()) {
|
if (!tdbp->IsRemote()) {
|
||||||
@@ -603,7 +604,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
|
|||||||
rc = RC_FX;
|
rc = RC_FX;
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Done rc=%d\n", rc);
|
htrc("Done rc=%d\n", rc);
|
||||||
|
|
||||||
return (rc == RC_OK || rc == RC_INFO) ? 0 : rc;
|
return (rc == RC_OK || rc == RC_INFO) ? 0 : rc;
|
||||||
@@ -922,7 +923,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
|
|||||||
valp->SetBinValue((void*)p);
|
valp->SetBinValue((void*)p);
|
||||||
#endif // !WORDS_BIGENDIAN
|
#endif // !WORDS_BIGENDIAN
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
char bf[32];
|
char bf[32];
|
||||||
printf("i=%d n=%d key=%s\n", i, n, valp->GetCharString(bf));
|
printf("i=%d n=%d key=%s\n", i, n, valp->GetCharString(bf));
|
||||||
} // endif trace
|
} // endif trace
|
||||||
@@ -944,7 +945,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
|
|||||||
|
|
||||||
xbp->SetNval(n);
|
xbp->SetNval(n);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("xbp=%p Nval=%d i=%d incl=%d\n", xbp, n, i, incl[i]);
|
printf("xbp=%p Nval=%d i=%d incl=%d\n", xbp, n, i, incl[i]);
|
||||||
|
|
||||||
k[i]= xbp->Range(g, i + 1, incl[i]);
|
k[i]= xbp->Range(g, i + 1, incl[i]);
|
||||||
@@ -953,7 +954,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
|
|||||||
|
|
||||||
} // endfor i
|
} // endfor i
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("k1=%d k0=%d\n", k[1], k[0]);
|
printf("k1=%d k0=%d\n", k[1], k[0]);
|
||||||
|
|
||||||
return k[1] - k[0];
|
return k[1] - k[0];
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ void CSORT::Qstx(int *base, int *max)
|
|||||||
|
|
||||||
zlo = zhi = cnm = 0; // Avoid warning message
|
zlo = zhi = cnm = 0; // Avoid warning message
|
||||||
|
|
||||||
lo = max - base; // Number of elements as longs
|
lo = (int)(max - base); // Number of elements as longs
|
||||||
|
|
||||||
if (Dup)
|
if (Dup)
|
||||||
cnm = Cmpnum(lo);
|
cnm = Cmpnum(lo);
|
||||||
@@ -472,7 +472,7 @@ void CSORT::Qstx(int *base, int *max)
|
|||||||
i = him + 1;
|
i = him + 1;
|
||||||
|
|
||||||
if (Pof)
|
if (Pof)
|
||||||
Pof[him - Pex] = Pof[mid - Pex] = i - j;
|
Pof[him - Pex] = Pof[mid - Pex] = (int)(i - j);
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Look at sizes of the two partitions, do the smaller one first */
|
/* Look at sizes of the two partitions, do the smaller one first */
|
||||||
@@ -481,8 +481,8 @@ void CSORT::Qstx(int *base, int *max)
|
|||||||
/* But only repeat (recursively or by branching) if the partition */
|
/* But only repeat (recursively or by branching) if the partition */
|
||||||
/* is of at least size THRESH. */
|
/* is of at least size THRESH. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
lo = j - base;
|
lo = (int)(j - base);
|
||||||
hi = max - i;
|
hi = (int)(max - i);
|
||||||
|
|
||||||
if (Dup) { // Update progress information
|
if (Dup) { // Update progress information
|
||||||
zlo = Cmpnum(lo);
|
zlo = Cmpnum(lo);
|
||||||
@@ -726,7 +726,7 @@ void CSORT::Qstc(int *base, int *max)
|
|||||||
|
|
||||||
zlo = zhi = cnm = 0; // Avoid warning message
|
zlo = zhi = cnm = 0; // Avoid warning message
|
||||||
|
|
||||||
lo = max - base; // Number of elements as longs
|
lo = (int)(max - base); // Number of elements as longs
|
||||||
|
|
||||||
if (Dup)
|
if (Dup)
|
||||||
cnm = Cmpnum(lo);
|
cnm = Cmpnum(lo);
|
||||||
@@ -853,7 +853,7 @@ void CSORT::Qstc(int *base, int *max)
|
|||||||
/* the offset array values indicating break point and block size. */
|
/* the offset array values indicating break point and block size. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
if (Pof)
|
if (Pof)
|
||||||
Pof[lt - Pex] = Pof[(jj - 1) - Pex] = jj - lt;
|
Pof[lt - Pex] = Pof[(jj - 1) - Pex] = (int)(jj - lt);
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Look at sizes of the two partitions, do the smaller one first */
|
/* Look at sizes of the two partitions, do the smaller one first */
|
||||||
@@ -862,8 +862,8 @@ void CSORT::Qstc(int *base, int *max)
|
|||||||
/* But only repeat (recursively or by branching) if the partition */
|
/* But only repeat (recursively or by branching) if the partition */
|
||||||
/* is of at least size THRESH. */
|
/* is of at least size THRESH. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
lo = lt - base;
|
lo = (int)(lt - base);
|
||||||
hi = gt - Swix;
|
hi = (int)(gt - Swix);
|
||||||
|
|
||||||
if (Dup) { // Update progress information
|
if (Dup) { // Update progress information
|
||||||
zlo = Cmpnum(lo);
|
zlo = Cmpnum(lo);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#elif defined(MSX4)
|
#elif defined(MSX4)
|
||||||
#import "msxml4.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
|
#import "msxml4.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
|
||||||
#elif defined(MSX6)
|
#elif defined(MSX6)
|
||||||
|
#pragma warning(suppress : 4192)
|
||||||
#import "msxml6.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
|
#import "msxml6.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
|
||||||
#else // MSX4
|
#else // MSX4
|
||||||
#error MSX? is not defined
|
#error MSX? is not defined
|
||||||
@@ -540,7 +541,7 @@ PXNODE DOMNODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np)
|
|||||||
|
|
||||||
// If name has the format m[n] only m is taken as node name
|
// If name has the format m[n] only m is taken as node name
|
||||||
if ((p = strchr(name, '[')))
|
if ((p = strchr(name, '[')))
|
||||||
pn = BufAlloc(g, name, p - name);
|
pn = BufAlloc(g, name, (int)(p - name));
|
||||||
else
|
else
|
||||||
pn = name;
|
pn = name;
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ int MAPFAM::GetFileLength(PGLOBAL g)
|
|||||||
|
|
||||||
len = (To_Fb && To_Fb->Count) ? To_Fb->Length : TXTFAM::GetFileLength(g);
|
len = (To_Fb && To_Fb->Count) ? To_Fb->Length : TXTFAM::GetFileLength(g);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Mapped file length=%d\n", len);
|
htrc("Mapped file length=%d\n", len);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
@@ -128,7 +128,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
&& fp->Count && fp->Mode == mode)
|
&& fp->Count && fp->Mode == mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Mapping file, fp=%p\n", fp);
|
htrc("Mapping file, fp=%p\n", fp);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -166,7 +166,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
||||||
"map", (int) rc, filename);
|
"map", (int) rc, filename);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("CreateFileMap: %s\n", g->Message);
|
htrc("CreateFileMap: %s\n", g->Message);
|
||||||
|
|
||||||
return (mode == MODE_READ && rc == ENOENT)
|
return (mode == MODE_READ && rc == ENOENT)
|
||||||
@@ -227,7 +227,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
Fpos = Mempos = Memory;
|
Fpos = Mempos = Memory;
|
||||||
Top = Memory + len;
|
Top = Memory + len;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
|
htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
|
||||||
fp, fp->Count, Memory, len, Top);
|
fp, fp->Count, Memory, len, Top);
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ int MAPFAM::GetRowID(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MAPFAM::GetPos(void)
|
int MAPFAM::GetPos(void)
|
||||||
{
|
{
|
||||||
return Fpos - Memory;
|
return (int)(Fpos - Memory);
|
||||||
} // end of GetPos
|
} // end of GetPos
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -255,7 +255,7 @@ int MAPFAM::GetPos(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MAPFAM::GetNextPos(void)
|
int MAPFAM::GetNextPos(void)
|
||||||
{
|
{
|
||||||
return Mempos - Memory;
|
return (int)(Mempos - Memory);
|
||||||
} // end of GetNextPos
|
} // end of GetNextPos
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -368,7 +368,7 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
|
|||||||
} // endif Mempos
|
} // endif Mempos
|
||||||
|
|
||||||
// Set caller line buffer
|
// Set caller line buffer
|
||||||
len = (Mempos - Fpos) - n;
|
len = (int)(Mempos - Fpos) - n;
|
||||||
|
|
||||||
// Don't rely on ENDING setting
|
// Don't rely on ENDING setting
|
||||||
if (len > 0 && *(Mempos - 2) == '\r')
|
if (len > 0 && *(Mempos - 2) == '\r')
|
||||||
@@ -407,7 +407,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("MAP DeleteDB: irc=%d mempos=%p tobuf=%p Tpos=%p Spos=%p\n",
|
htrc("MAP DeleteDB: irc=%d mempos=%p tobuf=%p Tpos=%p Spos=%p\n",
|
||||||
irc, Mempos, To_Buf, Tpos, Spos);
|
irc, Mempos, To_Buf, Tpos, Spos);
|
||||||
|
|
||||||
@@ -417,7 +417,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = Top;
|
Fpos = Top;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Fpos placed at file top=%p\n", Fpos);
|
htrc("Fpos placed at file top=%p\n", Fpos);
|
||||||
|
|
||||||
} // endif irc
|
} // endif irc
|
||||||
@@ -428,14 +428,14 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/* not required here, just setting of future Spos and Tpos. */
|
/* not required here, just setting of future Spos and Tpos. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Tpos = Spos = Fpos;
|
Tpos = Spos = Fpos;
|
||||||
} else if ((n = Fpos - Spos) > 0) {
|
} else if ((n = (int)(Fpos - Spos)) > 0) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Non consecutive line to delete. Move intermediate lines. */
|
/* Non consecutive line to delete. Move intermediate lines. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
memmove(Tpos, Spos, n);
|
memmove(Tpos, Spos, n);
|
||||||
Tpos += n;
|
Tpos += n;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("move %d bytes\n", n);
|
htrc("move %d bytes\n", n);
|
||||||
|
|
||||||
} // endif n
|
} // endif n
|
||||||
@@ -443,7 +443,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
if (irc == RC_OK) {
|
if (irc == RC_OK) {
|
||||||
Spos = Mempos; // New start position
|
Spos = Mempos; // New start position
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
|
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
|
||||||
|
|
||||||
} else if (To_Fb) { // Can be NULL for deleted files
|
} else if (To_Fb) { // Can be NULL for deleted files
|
||||||
@@ -461,7 +461,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/* Remove extra records. */
|
/* Remove extra records. */
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
n = Tpos - Memory;
|
n = (int)(Tpos - Memory);
|
||||||
|
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
|
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
|
||||||
@@ -473,7 +473,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
|
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
|
||||||
|
|
||||||
if (!SetEndOfFile(fp->Handle)) {
|
if (!SetEndOfFile(fp->Handle)) {
|
||||||
@@ -511,7 +511,7 @@ void MAPFAM::CloseTableFile(PGLOBAL g, bool)
|
|||||||
PlugCloseFile(g, To_Fb);
|
PlugCloseFile(g, To_Fb);
|
||||||
//To_Fb = NULL; // To get correct file size in Cardinality
|
//To_Fb = NULL; // To get correct file size in Cardinality
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("MAP Close: closing %s count=%d\n",
|
htrc("MAP Close: closing %s count=%d\n",
|
||||||
To_File, (To_Fb) ? To_Fb->Count : 0);
|
To_File, (To_Fb) ? To_Fb->Count : 0);
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Set caller line buffer
|
// Set caller line buffer
|
||||||
len = (Mempos - Fpos) - Ending;
|
len = (int)(Mempos - Fpos) - Ending;
|
||||||
memcpy(Tdbp->GetLine(), Fpos, len);
|
memcpy(Tdbp->GetLine(), Fpos, len);
|
||||||
Tdbp->GetLine()[len] = '\0';
|
Tdbp->GetLine()[len] = '\0';
|
||||||
return RC_OK;
|
return RC_OK;
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
|
|||||||
PQRYRES qrp;
|
PQRYRES qrp;
|
||||||
PCOLRES crp;
|
PCOLRES crp;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("DBFColumns: File %s\n", SVP(fn));
|
htrc("DBFColumns: File %s\n", SVP(fn));
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
@@ -245,7 +245,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
|
|||||||
return qrp;
|
return qrp;
|
||||||
} // endif info
|
} // endif info
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc("Structure of %s\n", filename);
|
htrc("Structure of %s\n", filename);
|
||||||
htrc("headlen=%hd reclen=%hd degree=%d\n",
|
htrc("headlen=%hd reclen=%hd degree=%d\n",
|
||||||
mainhead.Headlen(), mainhead.Reclen(), fields);
|
mainhead.Headlen(), mainhead.Reclen(), fields);
|
||||||
@@ -271,7 +271,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
|
|||||||
} else
|
} else
|
||||||
len = thisfield.Length;
|
len = thisfield.Length;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%-11s %c %6ld %3d %2d %3d %3d\n",
|
htrc("%-11s %c %6ld %3d %2d %3d %3d\n",
|
||||||
thisfield.Name, thisfield.Type, thisfield.Offset, len,
|
thisfield.Name, thisfield.Type, thisfield.Offset, len,
|
||||||
thisfield.Decimals, thisfield.Setfield, thisfield.Mdxfield);
|
thisfield.Decimals, thisfield.Setfield, thisfield.Mdxfield);
|
||||||
@@ -522,14 +522,14 @@ bool DBFFAM::OpenTableFile(PGLOBAL g)
|
|||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
|
|
||||||
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
|
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return (mode == MODE_READ && errno == ENOENT)
|
return (mode == MODE_READ && errno == ENOENT)
|
||||||
? PushWarning(g, Tdbp) : true;
|
? PushWarning(g, Tdbp) : true;
|
||||||
} // endif Stream
|
} // endif Stream
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("File %s is open in mode %s\n", filename, opmode);
|
htrc("File %s is open in mode %s\n", filename, opmode);
|
||||||
|
|
||||||
To_Fb = dbuserp->Openlist; // Keep track of File block
|
To_Fb = dbuserp->Openlist; // Keep track of File block
|
||||||
@@ -938,7 +938,7 @@ void DBFFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
fin:
|
fin:
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("DBF CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
htrc("DBF CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
||||||
To_File, mode, wrc, rc);
|
To_File, mode, wrc, rc);
|
||||||
|
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif fseek
|
} // endif fseek
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("File position is now %d\n", ftell(Stream));
|
htrc("File position is now %d\n", ftell(Stream));
|
||||||
|
|
||||||
if (Padded)
|
if (Padded)
|
||||||
@@ -344,7 +344,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
|
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
@@ -361,7 +361,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int FIXFAM::WriteBuffer(PGLOBAL g)
|
int FIXFAM::WriteBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("FIX WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
|
htrc("FIX WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
|
||||||
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
|
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
return RC_OK; // We write only full blocks
|
return RC_OK; // We write only full blocks
|
||||||
} // endif CurNum
|
} // endif CurNum
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
|
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
|
||||||
|
|
||||||
// Now start the writing process.
|
// Now start the writing process.
|
||||||
@@ -388,7 +388,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
CurNum = 0;
|
CurNum = 0;
|
||||||
Tdbp->SetLine(To_Buf);
|
Tdbp->SetLine(To_Buf);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("write done\n");
|
htrc("write done\n");
|
||||||
|
|
||||||
} else { // Mode == MODE_UPDATE
|
} else { // Mode == MODE_UPDATE
|
||||||
@@ -431,7 +431,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/* file, and at the end erase all trailing records. */
|
/* file, and at the end erase all trailing records. */
|
||||||
/* This will be experimented. */
|
/* This will be experimented. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("DOS DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
htrc("DOS DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
||||||
irc, UseTemp, Fpos, Tpos, Spos);
|
irc, UseTemp, Fpos, Tpos, Spos);
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = Tdbp->Cardinality(g);
|
Fpos = Tdbp->Cardinality(g);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Fpos placed at file end=%d\n", Fpos);
|
htrc("Fpos placed at file end=%d\n", Fpos);
|
||||||
|
|
||||||
} else // Fpos is the deleted line position
|
} else // Fpos is the deleted line position
|
||||||
@@ -491,7 +491,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
OldBlk = -2; // To force fseek to be executed on next block
|
OldBlk = -2; // To force fseek to be executed on next block
|
||||||
} // endif moved
|
} // endif moved
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -540,7 +540,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
|
|
||||||
close(h);
|
close(h);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("done, h=%d irc=%d\n", h, irc);
|
htrc("done, h=%d irc=%d\n", h, irc);
|
||||||
|
|
||||||
} // endif UseTemp
|
} // endif UseTemp
|
||||||
@@ -572,7 +572,7 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
req = (size_t)MY_MIN(n, Dbflen);
|
req = (size_t)MY_MIN(n, Dbflen);
|
||||||
len = fread(DelBuf, Lrecl, req, Stream);
|
len = fread(DelBuf, Lrecl, req, Stream);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("after read req=%d len=%d\n", req, len);
|
htrc("after read req=%d len=%d\n", req, len);
|
||||||
|
|
||||||
if (len != req) {
|
if (len != req) {
|
||||||
@@ -591,13 +591,13 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("after write pos=%d\n", ftell(Stream));
|
htrc("after write pos=%d\n", ftell(Stream));
|
||||||
|
|
||||||
Tpos += (int)req;
|
Tpos += (int)req;
|
||||||
Spos += (int)req;
|
Spos += (int)req;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
*b = true;
|
*b = true;
|
||||||
@@ -648,7 +648,7 @@ void FIXFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
fin:
|
fin:
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("FIX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
htrc("FIX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
||||||
To_File, mode, wrc, rc);
|
To_File, mode, wrc, rc);
|
||||||
|
|
||||||
@@ -718,7 +718,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)),
|
|||||||
DWORD nbr, drc, len = (DWORD)req;
|
DWORD nbr, drc, len = (DWORD)req;
|
||||||
bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
|
bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("after read req=%d brc=%d nbr=%d\n", req, brc, nbr);
|
htrc("after read req=%d brc=%d nbr=%d\n", req, brc, nbr);
|
||||||
|
|
||||||
if (!brc) {
|
if (!brc) {
|
||||||
@@ -730,7 +730,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)),
|
|||||||
(LPTSTR)buf, sizeof(buf), NULL);
|
(LPTSTR)buf, sizeof(buf), NULL);
|
||||||
sprintf(g->Message, MSG(READ_ERROR), To_File, buf);
|
sprintf(g->Message, MSG(READ_ERROR), To_File, buf);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("BIGREAD: %s\n", g->Message);
|
htrc("BIGREAD: %s\n", g->Message);
|
||||||
|
|
||||||
rc = -1;
|
rc = -1;
|
||||||
@@ -757,7 +757,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
DWORD nbw, drc, len = (DWORD)req;
|
DWORD nbw, drc, len = (DWORD)req;
|
||||||
bool brc = WriteFile(h, inbuf, len, &nbw, NULL);
|
bool brc = WriteFile(h, inbuf, len, &nbw, NULL);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
||||||
|
|
||||||
if (!brc || nbw != len) {
|
if (!brc || nbw != len) {
|
||||||
@@ -775,7 +775,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
|
|
||||||
sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf);
|
sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
||||||
nbw, len, drc, g->Message);
|
nbw, len, drc, g->Message);
|
||||||
|
|
||||||
@@ -790,7 +790,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
|
|
||||||
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno));
|
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno));
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
||||||
nbw, len, errno, g->Message);
|
nbw, len, errno, g->Message);
|
||||||
|
|
||||||
@@ -828,7 +828,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode);
|
htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode);
|
||||||
|
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
@@ -888,7 +888,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" rc=%d access=%p share=%p creation=%d handle=%p fn=%s\n",
|
htrc(" rc=%d access=%p share=%p creation=%d handle=%p fn=%s\n",
|
||||||
rc, access, share, creation, Hfile, filename);
|
rc, access, share, creation, Hfile, filename);
|
||||||
|
|
||||||
@@ -942,7 +942,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" rc=%d oflag=%p tmode=%p handle=%p fn=%s\n",
|
htrc(" rc=%d oflag=%p tmode=%p handle=%p fn=%s\n",
|
||||||
rc, oflag, tmode, Hfile, filename);
|
rc, oflag, tmode, Hfile, filename);
|
||||||
|
|
||||||
@@ -1026,11 +1026,11 @@ int BGXFAM::Cardinality(PGLOBAL g)
|
|||||||
if (Hfile == INVALID_HANDLE_VALUE) {
|
if (Hfile == INVALID_HANDLE_VALUE) {
|
||||||
int h = open64(filename, O_RDONLY, 0);
|
int h = open64(filename, O_RDONLY, 0);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" h=%d\n", h);
|
htrc(" h=%d\n", h);
|
||||||
|
|
||||||
if (h == INVALID_HANDLE_VALUE) {
|
if (h == INVALID_HANDLE_VALUE) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" errno=%d ENOENT=%d\n", errno, ENOENT);
|
htrc(" errno=%d ENOENT=%d\n", errno, ENOENT);
|
||||||
|
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
@@ -1074,7 +1074,7 @@ int BGXFAM::Cardinality(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
card = (int)(fsize / (BIGINT)Lrecl); // Fixed length file
|
card = (int)(fsize / (BIGINT)Lrecl); // Fixed length file
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" Computed max_K=%d fsize=%lf lrecl=%d\n",
|
htrc(" Computed max_K=%d fsize=%lf lrecl=%d\n",
|
||||||
card, (double)fsize, Lrecl);
|
card, (double)fsize, Lrecl);
|
||||||
|
|
||||||
@@ -1181,7 +1181,7 @@ int BGXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
if (BigSeek(g, Hfile, (BIGINT)Fpos * (BIGINT)Lrecl))
|
if (BigSeek(g, Hfile, (BIGINT)Fpos * (BIGINT)Lrecl))
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("File position is now %d\n", Fpos);
|
htrc("File position is now %d\n", Fpos);
|
||||||
|
|
||||||
nbr = BigRead(g, Hfile, To_Buf, (Padded) ? Blksize : Lrecl * Nrec);
|
nbr = BigRead(g, Hfile, To_Buf, (Padded) ? Blksize : Lrecl * Nrec);
|
||||||
@@ -1205,7 +1205,7 @@ int BGXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int BGXFAM::WriteBuffer(PGLOBAL g)
|
int BGXFAM::WriteBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("BIG WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
|
htrc("BIG WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
|
||||||
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
|
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
|
||||||
|
|
||||||
@@ -1218,7 +1218,7 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
return RC_OK; // We write only full blocks
|
return RC_OK; // We write only full blocks
|
||||||
} // endif CurNum
|
} // endif CurNum
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
|
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
|
||||||
|
|
||||||
// Now start the writing process.
|
// Now start the writing process.
|
||||||
@@ -1229,7 +1229,7 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
CurNum = 0;
|
CurNum = 0;
|
||||||
Tdbp->SetLine(To_Buf);
|
Tdbp->SetLine(To_Buf);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("write done\n");
|
htrc("write done\n");
|
||||||
|
|
||||||
} else { // Mode == MODE_UPDATE
|
} else { // Mode == MODE_UPDATE
|
||||||
@@ -1270,7 +1270,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/* file, and at the end erase all trailing records. */
|
/* file, and at the end erase all trailing records. */
|
||||||
/* This will be experimented. */
|
/* This will be experimented. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("BGX DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
htrc("BGX DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
||||||
irc, UseTemp, Fpos, Tpos, Spos);
|
irc, UseTemp, Fpos, Tpos, Spos);
|
||||||
|
|
||||||
@@ -1280,7 +1280,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = Tdbp->Cardinality(g);
|
Fpos = Tdbp->Cardinality(g);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Fpos placed at file end=%d\n", Fpos);
|
htrc("Fpos placed at file end=%d\n", Fpos);
|
||||||
|
|
||||||
} else // Fpos is the deleted line position
|
} else // Fpos is the deleted line position
|
||||||
@@ -1318,7 +1318,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
|
|
||||||
if (irc == RC_OK) {
|
if (irc == RC_OK) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
assert(Spos == Fpos);
|
assert(Spos == Fpos);
|
||||||
|
|
||||||
Spos++; // New start position is on next line
|
Spos++; // New start position is on next line
|
||||||
@@ -1330,7 +1330,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
OldBlk = -2; // To force fseek to be executed on next block
|
OldBlk = -2; // To force fseek to be executed on next block
|
||||||
} // endif moved
|
} // endif moved
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
} else if (irc != RC_OK) {
|
} else if (irc != RC_OK) {
|
||||||
@@ -1459,7 +1459,7 @@ bool BGXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
Tpos += (int)req;
|
Tpos += (int)req;
|
||||||
Spos += (int)req;
|
Spos += (int)req;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
*b = true;
|
*b = true;
|
||||||
@@ -1510,7 +1510,7 @@ void BGXFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
fin:
|
fin:
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BGX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
htrc("BGX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
||||||
To_File, mode, wrc, rc);
|
To_File, mode, wrc, rc);
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ bool GZFAM::AllocateBuffer(PGLOBAL g)
|
|||||||
Buflen = Lrecl + 2; // Lrecl does not include CRLF
|
Buflen = Lrecl + 2; // Lrecl does not include CRLF
|
||||||
//Buflen *= ((Mode == MODE_DELETE) ? DOS_BUFF_LEN : 1); NIY
|
//Buflen *= ((Mode == MODE_DELETE) ? DOS_BUFF_LEN : 1); NIY
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("SubAllocating a buffer of %d bytes\n", Buflen);
|
htrc("SubAllocating a buffer of %d bytes\n", Buflen);
|
||||||
|
|
||||||
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
|
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
|
||||||
@@ -347,7 +347,7 @@ int GZFAM::ReadBuffer(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
rc = Zerror(g);
|
rc = Zerror(g);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" Read: '%s' rc=%d\n", To_Buf, rc);
|
htrc(" Read: '%s' rc=%d\n", To_Buf, rc);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -389,7 +389,7 @@ void GZFAM::CloseTableFile(PGLOBAL, bool)
|
|||||||
{
|
{
|
||||||
int rc = gzclose(Zfile);
|
int rc = gzclose(Zfile);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
|
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
|
||||||
|
|
||||||
Zfile = NULL; // So we can know whether table is open
|
Zfile = NULL; // So we can know whether table is open
|
||||||
@@ -537,7 +537,7 @@ int ZBKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
while (*NxtLine++ != '\n') ;
|
while (*NxtLine++ != '\n') ;
|
||||||
|
|
||||||
// Set caller line buffer
|
// Set caller line buffer
|
||||||
n = NxtLine - CurLine - Ending;
|
n = (int)(NxtLine - CurLine - Ending);
|
||||||
memcpy(Tdbp->GetLine(), CurLine, n);
|
memcpy(Tdbp->GetLine(), CurLine, n);
|
||||||
Tdbp->GetLine()[n] = '\0';
|
Tdbp->GetLine()[n] = '\0';
|
||||||
return RC_OK;
|
return RC_OK;
|
||||||
@@ -588,7 +588,7 @@ int ZBKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
for (NxtLine = CurLine; *NxtLine++ != '\n';) ;
|
for (NxtLine = CurLine; *NxtLine++ != '\n';) ;
|
||||||
|
|
||||||
// Set caller line buffer
|
// Set caller line buffer
|
||||||
n = NxtLine - CurLine - Ending;
|
n = (int)(NxtLine - CurLine - Ending);
|
||||||
memcpy(Tdbp->GetLine(), CurLine, n);
|
memcpy(Tdbp->GetLine(), CurLine, n);
|
||||||
Tdbp->GetLine()[n] = '\0';
|
Tdbp->GetLine()[n] = '\0';
|
||||||
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
|
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
|
||||||
@@ -702,7 +702,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
|
|||||||
} else
|
} else
|
||||||
rc = gzclose(Zfile);
|
rc = gzclose(Zfile);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
|
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
|
||||||
|
|
||||||
Zfile = NULL; // So we can know whether table is open
|
Zfile = NULL; // So we can know whether table is open
|
||||||
@@ -1087,7 +1087,7 @@ bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZLBFAM::ReadBuffer(PGLOBAL g)
|
int ZLBFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int n;
|
size_t n;
|
||||||
void *rdbuf;
|
void *rdbuf;
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
@@ -1299,7 +1299,7 @@ int ZLBFAM::WriteBuffer(PGLOBAL g)
|
|||||||
else
|
else
|
||||||
NxtLine = CurLine + Lrecl;
|
NxtLine = CurLine + Lrecl;
|
||||||
|
|
||||||
BlkLen = NxtLine - To_Buf;
|
BlkLen = (int)(NxtLine - To_Buf);
|
||||||
|
|
||||||
if (WriteCompressedBuffer(g)) {
|
if (WriteCompressedBuffer(g)) {
|
||||||
Closing = TRUE; // To tell CloseDB about a Write error
|
Closing = TRUE; // To tell CloseDB about a Write error
|
||||||
@@ -1382,7 +1382,7 @@ void ZLBFAM::CloseTableFile(PGLOBAL g, bool)
|
|||||||
} else
|
} else
|
||||||
rc = fclose(Stream);
|
rc = fclose(Stream);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("ZLB CloseTableFile: closing %s mode=%d rc=%d\n",
|
htrc("ZLB CloseTableFile: closing %s mode=%d rc=%d\n",
|
||||||
To_File, Tdbp->GetMode(), rc);
|
To_File, Tdbp->GetMode(), rc);
|
||||||
|
|
||||||
@@ -1408,7 +1408,7 @@ void ZLBFAM::Rewind(void)
|
|||||||
|
|
||||||
rewind(Stream);
|
rewind(Stream);
|
||||||
|
|
||||||
if (!(st = fread(Zlenp, sizeof(int), 1, Stream)) && trace)
|
if (!(st = fread(Zlenp, sizeof(int), 1, Stream)) && trace(1))
|
||||||
htrc("fread error %d in Rewind", errno);
|
htrc("fread error %d in Rewind", errno);
|
||||||
|
|
||||||
fseek(Stream, *Zlenp + sizeof(int), SEEK_SET);
|
fseek(Stream, *Zlenp + sizeof(int), SEEK_SET);
|
||||||
|
|||||||
@@ -194,12 +194,12 @@ int TXTFAM::GetFileLength(PGLOBAL g)
|
|||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
h= global_open(g, MSGID_OPEN_MODE_STRERROR, filename, _O_RDONLY);
|
h= global_open(g, MSGID_OPEN_MODE_STRERROR, filename, _O_RDONLY);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetFileLength: fn=%s h=%d\n", filename, h);
|
htrc("GetFileLength: fn=%s h=%d\n", filename, h);
|
||||||
|
|
||||||
if (h == -1) {
|
if (h == -1) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
len = -1;
|
len = -1;
|
||||||
@@ -249,7 +249,7 @@ int TXTFAM::Cardinality(PGLOBAL g)
|
|||||||
|
|
||||||
} // endif Padded
|
} // endif Padded
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" Computed max_K=%d Filen=%d lrecl=%d\n",
|
htrc(" Computed max_K=%d Filen=%d lrecl=%d\n",
|
||||||
card, len, Lrecl);
|
card, len, Lrecl);
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ int TXTFAM::UpdateSortedRows(PGLOBAL g)
|
|||||||
return RC_OK;
|
return RC_OK;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
@@ -439,7 +439,7 @@ int TXTFAM::DeleteSortedRows(PGLOBAL g)
|
|||||||
return RC_OK;
|
return RC_OK;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
@@ -512,7 +512,7 @@ int DOSFAM::GetFileLength(PGLOBAL g)
|
|||||||
if ((len = _filelength(_fileno(Stream))) < 0)
|
if ((len = _filelength(_fileno(Stream))) < 0)
|
||||||
sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", To_File);
|
sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", To_File);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("File length=%d\n", len);
|
htrc("File length=%d\n", len);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
@@ -598,14 +598,14 @@ bool DOSFAM::OpenTableFile(PGLOBAL g)
|
|||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
|
|
||||||
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
|
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return (mode == MODE_READ && errno == ENOENT)
|
return (mode == MODE_READ && errno == ENOENT)
|
||||||
? PushWarning(g, Tdbp) : true;
|
? PushWarning(g, Tdbp) : true;
|
||||||
} // endif Stream
|
} // endif Stream
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("File %s open Stream=%p mode=%s\n", filename, Stream, opmode);
|
htrc("File %s open Stream=%p mode=%s\n", filename, Stream, opmode);
|
||||||
|
|
||||||
To_Fb = dbuserp->Openlist; // Keep track of File block
|
To_Fb = dbuserp->Openlist; // Keep track of File block
|
||||||
@@ -628,7 +628,7 @@ bool DOSFAM::AllocateBuffer(PGLOBAL g)
|
|||||||
// Lrecl does not include line ending
|
// Lrecl does not include line ending
|
||||||
Buflen = Lrecl + Ending + ((Bin) ? 1 : 0) + 1; // Sergei
|
Buflen = Lrecl + Ending + ((Bin) ? 1 : 0) + 1; // Sergei
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("SubAllocating a buffer of %d bytes\n", Buflen);
|
htrc("SubAllocating a buffer of %d bytes\n", Buflen);
|
||||||
|
|
||||||
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
|
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
|
||||||
@@ -768,7 +768,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
|
|||||||
if (!Stream)
|
if (!Stream)
|
||||||
return RC_EF;
|
return RC_EF;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("ReadBuffer: Tdbp=%p To_Line=%p Placed=%d\n",
|
htrc("ReadBuffer: Tdbp=%p To_Line=%p Placed=%d\n",
|
||||||
Tdbp, Tdbp->To_Line, Placed);
|
Tdbp, Tdbp->To_Line, Placed);
|
||||||
|
|
||||||
@@ -782,7 +782,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
|
|||||||
|
|
||||||
CurBlk = (int)Rows++;
|
CurBlk = (int)Rows++;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("ReadBuffer: CurBlk=%d\n", CurBlk);
|
htrc("ReadBuffer: CurBlk=%d\n", CurBlk);
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
@@ -803,14 +803,14 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
|
|||||||
} else
|
} else
|
||||||
Placed = false;
|
Placed = false;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" About to read: stream=%p To_Buf=%p Buflen=%d\n",
|
htrc(" About to read: stream=%p To_Buf=%p Buflen=%d\n",
|
||||||
Stream, To_Buf, Buflen);
|
Stream, To_Buf, Buflen);
|
||||||
|
|
||||||
if (fgets(To_Buf, Buflen, Stream)) {
|
if (fgets(To_Buf, Buflen, Stream)) {
|
||||||
p = To_Buf + strlen(To_Buf) - 1;
|
p = To_Buf + strlen(To_Buf) - 1;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p);
|
htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p);
|
||||||
|
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
@@ -838,7 +838,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
|
|||||||
} else if (*p == '\n')
|
} else if (*p == '\n')
|
||||||
*p = '\0'; // Eliminate ending new-line character
|
*p = '\0'; // Eliminate ending new-line character
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" To_Buf='%s'\n", To_Buf);
|
htrc(" To_Buf='%s'\n", To_Buf);
|
||||||
|
|
||||||
strcpy(Tdbp->To_Line, To_Buf);
|
strcpy(Tdbp->To_Line, To_Buf);
|
||||||
@@ -853,13 +853,13 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
|
|||||||
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
|
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
rc = RC_FX;
|
rc = RC_FX;
|
||||||
} // endif's fgets
|
} // endif's fgets
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("ReadBuffer: rc=%d\n", rc);
|
htrc("ReadBuffer: rc=%d\n", rc);
|
||||||
|
|
||||||
IsRead = true;
|
IsRead = true;
|
||||||
@@ -895,7 +895,7 @@ int DOSFAM::WriteBuffer(PGLOBAL g)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
curpos = ftell(Stream);
|
curpos = ftell(Stream);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Last : %d cur: %d\n", Fpos, curpos);
|
htrc("Last : %d cur: %d\n", Fpos, curpos);
|
||||||
|
|
||||||
if (UseTemp) {
|
if (UseTemp) {
|
||||||
@@ -937,7 +937,7 @@ int DOSFAM::WriteBuffer(PGLOBAL g)
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("write done\n");
|
htrc("write done\n");
|
||||||
|
|
||||||
return RC_OK;
|
return RC_OK;
|
||||||
@@ -960,7 +960,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/* file, and at the end erase all trailing records. */
|
/* file, and at the end erase all trailing records. */
|
||||||
/* This will be experimented. */
|
/* This will be experimented. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(
|
htrc(
|
||||||
"DOS DeleteDB: rc=%d UseTemp=%d curpos=%d Fpos=%d Tpos=%d Spos=%d\n",
|
"DOS DeleteDB: rc=%d UseTemp=%d curpos=%d Fpos=%d Tpos=%d Spos=%d\n",
|
||||||
irc, UseTemp, curpos, Fpos, Tpos, Spos);
|
irc, UseTemp, curpos, Fpos, Tpos, Spos);
|
||||||
@@ -972,7 +972,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
fseek(Stream, 0, SEEK_END);
|
fseek(Stream, 0, SEEK_END);
|
||||||
Fpos = ftell(Stream);
|
Fpos = ftell(Stream);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Fpos placed at file end=%d\n", Fpos);
|
htrc("Fpos placed at file end=%d\n", Fpos);
|
||||||
|
|
||||||
} // endif irc
|
} // endif irc
|
||||||
@@ -1015,7 +1015,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
|
|
||||||
Spos = GetNextPos(); // New start position
|
Spos = GetNextPos(); // New start position
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1058,7 +1058,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
|
|
||||||
close(h);
|
close(h);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("done, h=%d irc=%d\n", h, irc);
|
htrc("done, h=%d irc=%d\n", h, irc);
|
||||||
|
|
||||||
} // endif !UseTemp
|
} // endif !UseTemp
|
||||||
@@ -1083,7 +1083,7 @@ bool DOSFAM::OpenTempFile(PGLOBAL g)
|
|||||||
strcat(PlugRemoveType(tempname, tempname), ".t");
|
strcat(PlugRemoveType(tempname, tempname), ".t");
|
||||||
|
|
||||||
if (!(T_Stream = PlugOpenFile(g, tempname, "wb"))) {
|
if (!(T_Stream = PlugOpenFile(g, tempname, "wb"))) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
rc = true;
|
rc = true;
|
||||||
@@ -1112,7 +1112,7 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
req = (size_t)MY_MIN(n, Dbflen);
|
req = (size_t)MY_MIN(n, Dbflen);
|
||||||
len = fread(DelBuf, 1, req, Stream);
|
len = fread(DelBuf, 1, req, Stream);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after read req=%d len=%d\n", req, len);
|
htrc("after read req=%d len=%d\n", req, len);
|
||||||
|
|
||||||
if (len != req) {
|
if (len != req) {
|
||||||
@@ -1131,13 +1131,13 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after write pos=%d\n", ftell(Stream));
|
htrc("after write pos=%d\n", ftell(Stream));
|
||||||
|
|
||||||
Tpos += (int)req;
|
Tpos += (int)req;
|
||||||
Spos += (int)req;
|
Spos += (int)req;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
*b = true;
|
*b = true;
|
||||||
@@ -1217,7 +1217,7 @@ void DOSFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
} else {
|
} else {
|
||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("DOS Close: closing %s rc=%d\n", To_File, rc);
|
htrc("DOS Close: closing %s rc=%d\n", To_File, rc);
|
||||||
|
|
||||||
} // endif UseTemp
|
} // endif UseTemp
|
||||||
@@ -1351,7 +1351,7 @@ int BLKFAM::GetPos(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int BLKFAM::GetNextPos(void)
|
int BLKFAM::GetNextPos(void)
|
||||||
{
|
{
|
||||||
return Fpos + NxtLine - CurLine;
|
return (int)(Fpos + NxtLine - CurLine);
|
||||||
} // end of GetNextPos
|
} // end of GetNextPos
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -1396,7 +1396,8 @@ int BLKFAM::SkipRecord(PGLOBAL, bool header)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int BLKFAM::ReadBuffer(PGLOBAL g)
|
int BLKFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int i, n, rc = RC_OK;
|
int i, rc = RC_OK;
|
||||||
|
size_t n;
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Sequential reading when Placed is not true. */
|
/* Sequential reading when Placed is not true. */
|
||||||
@@ -1452,13 +1453,13 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
// Calculate the length of block to read
|
// Calculate the length of block to read
|
||||||
BlkLen = BlkPos[CurBlk + 1] - BlkPos[CurBlk];
|
BlkLen = BlkPos[CurBlk + 1] - BlkPos[CurBlk];
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("File position is now %d\n", ftell(Stream));
|
htrc("File position is now %d\n", ftell(Stream));
|
||||||
|
|
||||||
// Read the entire next block
|
// Read the entire next block
|
||||||
n = fread(To_Buf, 1, (size_t)BlkLen, Stream);
|
n = fread(To_Buf, 1, (size_t)BlkLen, Stream);
|
||||||
|
|
||||||
if (n == BlkLen) {
|
if ((size_t) n == (size_t) BlkLen) {
|
||||||
// ReadBlks++;
|
// ReadBlks++;
|
||||||
num_read++;
|
num_read++;
|
||||||
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
|
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
|
||||||
@@ -1486,7 +1487,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
|
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
@@ -1497,7 +1498,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
|
|
||||||
fin:
|
fin:
|
||||||
// Store the current record file position for Delete and Update
|
// Store the current record file position for Delete and Update
|
||||||
Fpos = BlkPos[CurBlk] + CurLine - To_Buf;
|
Fpos = (int)(BlkPos[CurBlk] + CurLine - To_Buf);
|
||||||
return rc;
|
return rc;
|
||||||
} // end of ReadBuffer
|
} // end of ReadBuffer
|
||||||
|
|
||||||
@@ -1524,7 +1525,7 @@ int BLKFAM::WriteBuffer(PGLOBAL g)
|
|||||||
|
|
||||||
// Now start the writing process.
|
// Now start the writing process.
|
||||||
NxtLine = CurLine + strlen(CurLine);
|
NxtLine = CurLine + strlen(CurLine);
|
||||||
BlkLen = NxtLine - To_Buf;
|
BlkLen = (int)(NxtLine - To_Buf);
|
||||||
|
|
||||||
if (fwrite(To_Buf, 1, BlkLen, Stream) != (size_t)BlkLen) {
|
if (fwrite(To_Buf, 1, BlkLen, Stream) != (size_t)BlkLen) {
|
||||||
sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno));
|
sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno));
|
||||||
@@ -1636,7 +1637,7 @@ void BLKFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
|
|
||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BLK CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
htrc("BLK CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
|
||||||
To_File, Tdbp->GetMode(), wrc, rc);
|
To_File, Tdbp->GetMode(), wrc, rc);
|
||||||
|
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ int VCTFAM::Cardinality(PGLOBAL g)
|
|||||||
else
|
else
|
||||||
sprintf(g->Message, MSG(NOT_FIXED_LEN), To_File, len, clen);
|
sprintf(g->Message, MSG(NOT_FIXED_LEN), To_File, len, clen);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" Computed max_K=%d Filen=%d Clen=%d\n", card, len, clen);
|
htrc(" Computed max_K=%d Filen=%d Clen=%d\n", card, len, clen);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -469,14 +469,14 @@ bool VCTFAM::OpenTableFile(PGLOBAL g)
|
|||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
|
|
||||||
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
|
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return (mode == MODE_READ && errno == ENOENT)
|
return (mode == MODE_READ && errno == ENOENT)
|
||||||
? PushWarning(g, Tdbp) : true;
|
? PushWarning(g, Tdbp) : true;
|
||||||
} // endif Stream
|
} // endif Stream
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("File %s is open in mode %s\n", filename, opmode);
|
htrc("File %s is open in mode %s\n", filename, opmode);
|
||||||
|
|
||||||
To_Fb = dbuserp->Openlist; // Keep track of File block
|
To_Fb = dbuserp->Openlist; // Keep track of File block
|
||||||
@@ -581,7 +581,7 @@ bool VCTFAM::InitInsert(PGLOBAL g)
|
|||||||
cp->ReadBlock(g);
|
cp->ReadBlock(g);
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
rc = true;
|
rc = true;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
@@ -652,7 +652,7 @@ int VCTFAM::ReadBuffer(PGLOBAL g)
|
|||||||
OldBlk = CurBlk; // Last block actually read
|
OldBlk = CurBlk; // Last block actually read
|
||||||
} // endif oldblk
|
} // endif oldblk
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" Read: CurNum=%d CurBlk=%d rc=%d\n", CurNum, CurBlk, RC_OK);
|
htrc(" Read: CurNum=%d CurBlk=%d rc=%d\n", CurNum, CurBlk, RC_OK);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -663,7 +663,7 @@ int VCTFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int VCTFAM::WriteBuffer(PGLOBAL g)
|
int VCTFAM::WriteBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("VCT WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d\n",
|
htrc("VCT WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d\n",
|
||||||
Tdbp->GetTdb_No(), Tdbp->GetMode(), CurNum, CurBlk);
|
Tdbp->GetTdb_No(), Tdbp->GetMode(), CurNum, CurBlk);
|
||||||
|
|
||||||
@@ -756,7 +756,7 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
{
|
{
|
||||||
bool eof = false;
|
bool eof = false;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("VCT DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
htrc("VCT DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
||||||
irc, UseTemp, Fpos, Tpos, Spos);
|
irc, UseTemp, Fpos, Tpos, Spos);
|
||||||
|
|
||||||
@@ -766,7 +766,7 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = (Block - 1) * Nrec + Last;
|
Fpos = (Block - 1) * Nrec + Last;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Fpos placed at file end=%d\n", Fpos);
|
htrc("Fpos placed at file end=%d\n", Fpos);
|
||||||
|
|
||||||
eof = UseTemp && !MaxBlk;
|
eof = UseTemp && !MaxBlk;
|
||||||
@@ -807,7 +807,7 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
#endif
|
#endif
|
||||||
Spos++; // New start position is on next line
|
Spos++; // New start position is on next line
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -856,7 +856,7 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
|
|
||||||
close(h);
|
close(h);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("done, h=%d irc=%d\n", h, irc);
|
htrc("done, h=%d irc=%d\n", h, irc);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -899,7 +899,7 @@ bool VCTFAM::OpenTempFile(PGLOBAL g)
|
|||||||
opmode = "wb";
|
opmode = "wb";
|
||||||
|
|
||||||
if (!(T_Stream = PlugOpenFile(g, tempname, opmode))) {
|
if (!(T_Stream = PlugOpenFile(g, tempname, opmode))) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
rc = true;
|
rc = true;
|
||||||
@@ -947,7 +947,7 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
|
|
||||||
len = fread(To_Buf, Clens[i], req, Stream);
|
len = fread(To_Buf, Clens[i], req, Stream);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after read req=%d len=%d\n", req, len);
|
htrc("after read req=%d len=%d\n", req, len);
|
||||||
|
|
||||||
if (len != req) {
|
if (len != req) {
|
||||||
@@ -976,7 +976,7 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
|
|
||||||
} // endif UseTemp
|
} // endif UseTemp
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after write pos=%d\n", ftell(Stream));
|
htrc("after write pos=%d\n", ftell(Stream));
|
||||||
|
|
||||||
} // endfor i
|
} // endfor i
|
||||||
@@ -1007,7 +1007,7 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
|
|
||||||
} // endif UseTemp
|
} // endif UseTemp
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
} // endfor n
|
} // endfor n
|
||||||
@@ -1144,7 +1144,7 @@ void VCTFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
if (!(UseTemp && T_Stream))
|
if (!(UseTemp && T_Stream))
|
||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("VCT CloseTableFile: closing %s wrc=%d rc=%d\n",
|
htrc("VCT CloseTableFile: closing %s wrc=%d rc=%d\n",
|
||||||
To_File, wrc, rc);
|
To_File, wrc, rc);
|
||||||
|
|
||||||
@@ -1217,7 +1217,7 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
else // Blocked vector format
|
else // Blocked vector format
|
||||||
len = Nrec * (colp->Deplac + Lrecl * CurBlk);
|
len = Nrec * (colp->Deplac + Lrecl * CurBlk);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("len=%d Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d maxblk=%d\n",
|
htrc("len=%d Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d maxblk=%d\n",
|
||||||
len, Nrec, colp->Deplac, Lrecl, CurBlk, MaxBlk);
|
len, Nrec, colp->Deplac, Lrecl, CurBlk, MaxBlk);
|
||||||
|
|
||||||
@@ -1236,13 +1236,13 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
sprintf(g->Message, MSG(READ_ERROR),
|
sprintf(g->Message, MSG(READ_ERROR),
|
||||||
To_File, strerror(errno));
|
To_File, strerror(errno));
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" Read error: %s\n", g->Message);
|
htrc(" Read error: %s\n", g->Message);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
num_read++;
|
num_read++;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -1268,7 +1268,7 @@ bool VCTFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
else // Old VCT format
|
else // Old VCT format
|
||||||
len = Nrec * (colp->Deplac + Lrecl * colp->ColBlk);
|
len = Nrec * (colp->Deplac + Lrecl * colp->ColBlk);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("modif=%d len=%d Nrec=%d Deplac=%d Lrecl=%d colblk=%d\n",
|
htrc("modif=%d len=%d Nrec=%d Deplac=%d Lrecl=%d colblk=%d\n",
|
||||||
Modif, len, Nrec, colp->Deplac, Lrecl, colp->ColBlk);
|
Modif, len, Nrec, colp->Deplac, Lrecl, colp->ColBlk);
|
||||||
|
|
||||||
@@ -1287,7 +1287,7 @@ bool VCTFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
sprintf(g->Message, MSG(WRITE_STRERROR),
|
sprintf(g->Message, MSG(WRITE_STRERROR),
|
||||||
(UseTemp) ? To_Fbt->Fname : To_File, strerror(errno));
|
(UseTemp) ? To_Fbt->Fname : To_File, strerror(errno));
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Write error: %s\n", strerror(errno));
|
htrc("Write error: %s\n", strerror(errno));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1358,7 +1358,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
|
|||||||
&& fp->Count && fp->Mode == mode)
|
&& fp->Count && fp->Mode == mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Mapping VCM file, fp=%p cnt=%d\n", fp, fp->Count);
|
htrc("Mapping VCM file, fp=%p cnt=%d\n", fp, fp->Count);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -1416,7 +1416,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
|
|||||||
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
||||||
"map", (int) rc, filename);
|
"map", (int) rc, filename);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return (mode == MODE_READ && rc == ENOENT)
|
return (mode == MODE_READ && rc == ENOENT)
|
||||||
@@ -1467,7 +1467,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
To_Fb = fp; // Useful when closing
|
To_Fb = fp; // Useful when closing
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
|
htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
|
||||||
fp, fp->Count, Memory, len);
|
fp, fp->Count, Memory, len);
|
||||||
|
|
||||||
@@ -1551,7 +1551,7 @@ bool VCMFAM::InitInsert(PGLOBAL g)
|
|||||||
cp->ReadBlock(g);
|
cp->ReadBlock(g);
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
rc = true;
|
rc = true;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
@@ -1567,7 +1567,7 @@ bool VCMFAM::InitInsert(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int VCMFAM::WriteBuffer(PGLOBAL g)
|
int VCMFAM::WriteBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("VCM WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d\n",
|
htrc("VCM WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d\n",
|
||||||
Tdbp->GetTdb_No(), Tdbp->GetMode(), CurNum, CurBlk);
|
Tdbp->GetTdb_No(), Tdbp->GetMode(), CurNum, CurBlk);
|
||||||
|
|
||||||
@@ -1608,7 +1608,7 @@ int VCMFAM::WriteBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
|
int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("VCM DeleteDB: irc=%d tobuf=%p Tpos=%p Spos=%p\n",
|
htrc("VCM DeleteDB: irc=%d tobuf=%p Tpos=%p Spos=%p\n",
|
||||||
irc, To_Buf, Tpos, Spos);
|
irc, To_Buf, Tpos, Spos);
|
||||||
|
|
||||||
@@ -1618,7 +1618,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = (Block - 1) * Nrec + Last;
|
Fpos = (Block - 1) * Nrec + Last;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Fpos placed at file top=%p\n", Fpos);
|
htrc("Fpos placed at file top=%p\n", Fpos);
|
||||||
|
|
||||||
} else // Fpos is the Deleted line position
|
} else // Fpos is the Deleted line position
|
||||||
@@ -1636,7 +1636,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
if (irc == RC_OK) {
|
if (irc == RC_OK) {
|
||||||
Spos = Fpos + 1; // New start position
|
Spos = Fpos + 1; // New start position
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
|
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1680,7 +1680,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
|
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
|
||||||
|
|
||||||
if (!SetEndOfFile(fp->Handle)) {
|
if (!SetEndOfFile(fp->Handle)) {
|
||||||
@@ -1755,7 +1755,7 @@ bool VCMFAM::MoveIntermediateLines(PGLOBAL, bool *)
|
|||||||
Tpos += n;
|
Tpos += n;
|
||||||
} // endif MaxBlk
|
} // endif MaxBlk
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("move %d bytes\n", n);
|
htrc("move %d bytes\n", n);
|
||||||
|
|
||||||
} // endif n
|
} // endif n
|
||||||
@@ -1812,14 +1812,14 @@ bool VCMFAM::ReadBlock(PGLOBAL, PVCTCOL colp)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
mempos = Memcol[i] + n * CurBlk;
|
mempos = Memcol[i] + n * CurBlk;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("mempos=%p i=%d Nrec=%d Clen=%d CurBlk=%d\n",
|
htrc("mempos=%p i=%d Nrec=%d Clen=%d CurBlk=%d\n",
|
||||||
mempos, i, Nrec, colp->Clen, CurBlk);
|
mempos, i, Nrec, colp->Clen, CurBlk);
|
||||||
|
|
||||||
if (colp->GetStatus(BUF_MAPPED))
|
if (colp->GetStatus(BUF_MAPPED))
|
||||||
colp->Blk->SetValPointer(mempos);
|
colp->Blk->SetValPointer(mempos);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
num_read++;
|
num_read++;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -1843,7 +1843,7 @@ bool VCMFAM::WriteBlock(PGLOBAL, PVCTCOL colp __attribute__((unused)))
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
mempos = Memcol[i] + n * CurBlk;
|
mempos = Memcol[i] + n * CurBlk;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("modif=%d mempos=%p i=%d Nrec=%d Clen=%d colblk=%d\n",
|
htrc("modif=%d mempos=%p i=%d Nrec=%d Clen=%d colblk=%d\n",
|
||||||
Modif, mempos, i, Nrec, colp->Clen, colp->ColBlk);
|
Modif, mempos, i, Nrec, colp->Clen, colp->ColBlk);
|
||||||
|
|
||||||
@@ -2008,14 +2008,14 @@ bool VECFAM::OpenColumnFile(PGLOBAL g, PCSZ opmode, int i)
|
|||||||
sprintf(filename, Colfn, i+1);
|
sprintf(filename, Colfn, i+1);
|
||||||
|
|
||||||
if (!(Streams[i] = PlugOpenFile(g, filename, opmode))) {
|
if (!(Streams[i] = PlugOpenFile(g, filename, opmode))) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return (Tdbp->GetMode() == MODE_READ && errno == ENOENT)
|
return (Tdbp->GetMode() == MODE_READ && errno == ENOENT)
|
||||||
? PushWarning(g, Tdbp) : true;
|
? PushWarning(g, Tdbp) : true;
|
||||||
} // endif Streams
|
} // endif Streams
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("File %s is open in mode %s\n", filename, opmode);
|
htrc("File %s is open in mode %s\n", filename, opmode);
|
||||||
|
|
||||||
To_Fbs[i] = dup->Openlist; // Keep track of File blocks
|
To_Fbs[i] = dup->Openlist; // Keep track of File blocks
|
||||||
@@ -2163,7 +2163,7 @@ void VECFAM::ResetBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int VECFAM::WriteBuffer(PGLOBAL g)
|
int VECFAM::WriteBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("VCT WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d\n",
|
htrc("VCT WriteBuffer: R%d Mode=%d CurNum=%d CurBlk=%d\n",
|
||||||
Tdbp->GetTdb_No(), Tdbp->GetMode(), CurNum, CurBlk);
|
Tdbp->GetTdb_No(), Tdbp->GetMode(), CurNum, CurBlk);
|
||||||
|
|
||||||
@@ -2205,7 +2205,7 @@ int VECFAM::WriteBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int VECFAM::DeleteRecords(PGLOBAL g, int irc)
|
int VECFAM::DeleteRecords(PGLOBAL g, int irc)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("VEC DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
htrc("VEC DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
||||||
irc, UseTemp, Fpos, Tpos, Spos);
|
irc, UseTemp, Fpos, Tpos, Spos);
|
||||||
|
|
||||||
@@ -2215,7 +2215,7 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = Cardinality(g);
|
Fpos = Cardinality(g);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Fpos placed at file end=%d\n", Fpos);
|
htrc("Fpos placed at file end=%d\n", Fpos);
|
||||||
|
|
||||||
} else // Fpos is the Deleted line position
|
} else // Fpos is the Deleted line position
|
||||||
@@ -2251,7 +2251,7 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
#endif
|
#endif
|
||||||
Spos++; // New start position is on next line
|
Spos++; // New start position is on next line
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -2294,7 +2294,7 @@ int VECFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
|
|
||||||
close(h);
|
close(h);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("done, h=%d irc=%d\n", h, irc);
|
htrc("done, h=%d irc=%d\n", h, irc);
|
||||||
|
|
||||||
} // endfor i
|
} // endfor i
|
||||||
@@ -2332,7 +2332,7 @@ bool VECFAM::OpenTempFile(PGLOBAL g)
|
|||||||
sprintf(tempname, Tempat, i+1);
|
sprintf(tempname, Tempat, i+1);
|
||||||
|
|
||||||
if (!(T_Streams[i] = PlugOpenFile(g, tempname, "wb"))) {
|
if (!(T_Streams[i] = PlugOpenFile(g, tempname, "wb"))) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2391,7 +2391,7 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *)
|
|||||||
|
|
||||||
len = fread(To_Buf, Clens[i], req, Streams[i]);
|
len = fread(To_Buf, Clens[i], req, Streams[i]);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after read req=%d len=%d\n", req, len);
|
htrc("after read req=%d len=%d\n", req, len);
|
||||||
|
|
||||||
if (len != req) {
|
if (len != req) {
|
||||||
@@ -2410,7 +2410,7 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *)
|
|||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after write pos=%d\n", ftell(Streams[i]));
|
htrc("after write pos=%d\n", ftell(Streams[i]));
|
||||||
|
|
||||||
} // endfor i
|
} // endfor i
|
||||||
@@ -2418,7 +2418,7 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *)
|
|||||||
Tpos += (int)req;
|
Tpos += (int)req;
|
||||||
Spos += (int)req;
|
Spos += (int)req;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
b = true;
|
b = true;
|
||||||
@@ -2541,7 +2541,7 @@ void VECFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
To_Fbs[i] = NULL;
|
To_Fbs[i] = NULL;
|
||||||
} // endif Streams
|
} // endif Streams
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("VCT CloseTableFile: closing %s wrc=%d rc=%d\n", To_File, wrc, rc);
|
htrc("VCT CloseTableFile: closing %s wrc=%d rc=%d\n", To_File, wrc, rc);
|
||||||
|
|
||||||
} // end of CloseTableFile
|
} // end of CloseTableFile
|
||||||
@@ -2560,7 +2560,7 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
len = Nrec * colp->Clen * CurBlk;
|
len = Nrec * colp->Clen * CurBlk;
|
||||||
i = colp->Index - 1;
|
i = colp->Index - 1;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("len=%d i=%d Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d\n",
|
htrc("len=%d i=%d Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d\n",
|
||||||
len, i, Nrec, colp->Deplac, Lrecl, CurBlk);
|
len, i, Nrec, colp->Deplac, Lrecl, CurBlk);
|
||||||
|
|
||||||
@@ -2586,13 +2586,13 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
sprintf(g->Message, MSG(READ_ERROR),
|
sprintf(g->Message, MSG(READ_ERROR),
|
||||||
fn, strerror(errno));
|
fn, strerror(errno));
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" Read error: %s\n", g->Message);
|
htrc(" Read error: %s\n", g->Message);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
num_read++;
|
num_read++;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -2615,7 +2615,7 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
len = Nrec * colp->Clen * colp->ColBlk;
|
len = Nrec * colp->Clen * colp->ColBlk;
|
||||||
i = colp->Index - 1;
|
i = colp->Index - 1;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("modif=%d len=%d i=%d Nrec=%d Deplac=%d Lrecl=%d colblk=%d\n",
|
htrc("modif=%d len=%d i=%d Nrec=%d Deplac=%d Lrecl=%d colblk=%d\n",
|
||||||
Modif, len, i, Nrec, colp->Deplac, Lrecl, colp->ColBlk);
|
Modif, len, i, Nrec, colp->Deplac, Lrecl, colp->ColBlk);
|
||||||
|
|
||||||
@@ -2638,7 +2638,7 @@ bool VECFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
sprintf(fn, (UseTemp) ? Tempat : Colfn, colp->Index);
|
sprintf(fn, (UseTemp) ? Tempat : Colfn, colp->Index);
|
||||||
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno));
|
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno));
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Write error: %s\n", strerror(errno));
|
htrc("Write error: %s\n", strerror(errno));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2782,7 +2782,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
|
|||||||
&& fp->Count && fp->Mode == mode)
|
&& fp->Count && fp->Mode == mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Mapping file, fp=%p\n", fp);
|
htrc("Mapping file, fp=%p\n", fp);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -2807,7 +2807,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
|
|||||||
if (!(*g->Message))
|
if (!(*g->Message))
|
||||||
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
||||||
"map", (int) rc, filename);
|
"map", (int) rc, filename);
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
return (mode == MODE_READ && rc == ENOENT)
|
return (mode == MODE_READ && rc == ENOENT)
|
||||||
@@ -2858,7 +2858,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
|
|||||||
|
|
||||||
To_Fbs[i] = fp; // Useful when closing
|
To_Fbs[i] = fp; // Useful when closing
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("fp=%p count=%d MapView=%p len=%d\n",
|
htrc("fp=%p count=%d MapView=%p len=%d\n",
|
||||||
fp, fp->Count, Memcol[i], len);
|
fp, fp->Count, Memcol[i], len);
|
||||||
|
|
||||||
@@ -2903,7 +2903,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
int i;
|
int i;
|
||||||
int m, n;
|
int m, n;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("VMP DeleteDB: irc=%d tobuf=%p Tpos=%p Spos=%p\n",
|
htrc("VMP DeleteDB: irc=%d tobuf=%p Tpos=%p Spos=%p\n",
|
||||||
irc, To_Buf, Tpos, Spos);
|
irc, To_Buf, Tpos, Spos);
|
||||||
|
|
||||||
@@ -2913,7 +2913,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = (Block - 1) * Nrec + Last;
|
Fpos = (Block - 1) * Nrec + Last;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Fpos placed at file top=%p\n", Fpos);
|
htrc("Fpos placed at file top=%p\n", Fpos);
|
||||||
|
|
||||||
} else // Fpos is the Deleted line position
|
} else // Fpos is the Deleted line position
|
||||||
@@ -2936,7 +2936,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
|
|
||||||
Tpos += n;
|
Tpos += n;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("move %d bytes\n", n);
|
htrc("move %d bytes\n", n);
|
||||||
|
|
||||||
} // endif n
|
} // endif n
|
||||||
@@ -2944,7 +2944,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
if (irc == RC_OK) {
|
if (irc == RC_OK) {
|
||||||
Spos = Fpos + 1; // New start position
|
Spos = Fpos + 1; // New start position
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
|
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -2981,7 +2981,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
|
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
|
||||||
|
|
||||||
if (!SetEndOfFile(fp->Handle)) {
|
if (!SetEndOfFile(fp->Handle)) {
|
||||||
@@ -3088,7 +3088,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
DWORD nbr, drc, len = (DWORD)req;
|
DWORD nbr, drc, len = (DWORD)req;
|
||||||
bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
|
bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after read req=%d brc=%d nbr=%d\n", req, brc, nbr);
|
htrc("after read req=%d brc=%d nbr=%d\n", req, brc, nbr);
|
||||||
|
|
||||||
if (!brc || nbr != len) {
|
if (!brc || nbr != len) {
|
||||||
@@ -3105,7 +3105,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
|
|
||||||
sprintf(g->Message, MSG(READ_ERROR), To_File, buf);
|
sprintf(g->Message, MSG(READ_ERROR), To_File, buf);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BIGREAD: %s\n", g->Message);
|
htrc("BIGREAD: %s\n", g->Message);
|
||||||
|
|
||||||
rc = true;
|
rc = true;
|
||||||
@@ -3119,7 +3119,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
|
|
||||||
sprintf(g->Message, MSG(READ_ERROR), fn, strerror(errno));
|
sprintf(g->Message, MSG(READ_ERROR), fn, strerror(errno));
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BIGREAD: nbr=%d len=%d errno=%d %s\n",
|
htrc("BIGREAD: nbr=%d len=%d errno=%d %s\n",
|
||||||
nbr, len, errno, g->Message);
|
nbr, len, errno, g->Message);
|
||||||
|
|
||||||
@@ -3141,7 +3141,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
DWORD nbw, drc, len = (DWORD)req;
|
DWORD nbw, drc, len = (DWORD)req;
|
||||||
bool brc = WriteFile(h, inbuf, len, &nbw, NULL);
|
bool brc = WriteFile(h, inbuf, len, &nbw, NULL);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
||||||
|
|
||||||
if (!brc || nbw != len) {
|
if (!brc || nbw != len) {
|
||||||
@@ -3159,7 +3159,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
|
|
||||||
sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf);
|
sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
||||||
nbw, len, drc, g->Message);
|
nbw, len, drc, g->Message);
|
||||||
|
|
||||||
@@ -3174,7 +3174,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
|
|
||||||
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno));
|
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno));
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
|
||||||
nbw, len, errno, g->Message);
|
nbw, len, errno, g->Message);
|
||||||
|
|
||||||
@@ -3224,7 +3224,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
|
|||||||
if (h == INVALID_HANDLE_VALUE || !_filelength(h)) {
|
if (h == INVALID_HANDLE_VALUE || !_filelength(h)) {
|
||||||
#endif // !__WIN__
|
#endif // !__WIN__
|
||||||
// Consider this is a void table
|
// Consider this is a void table
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Void table h=%d\n", h);
|
htrc("Void table h=%d\n", h);
|
||||||
|
|
||||||
Last = Nrec;
|
Last = Nrec;
|
||||||
@@ -3248,7 +3248,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
|
|||||||
Block = (vh.NumRec > 0) ? (vh.NumRec + Nrec - 1) / Nrec : 0;
|
Block = (vh.NumRec > 0) ? (vh.NumRec + Nrec - 1) / Nrec : 0;
|
||||||
Last = (vh.NumRec + Nrec - 1) % Nrec + 1;
|
Last = (vh.NumRec + Nrec - 1) % Nrec + 1;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Block=%d Last=%d\n", Block, Last);
|
htrc("Block=%d Last=%d\n", Block, Last);
|
||||||
|
|
||||||
} // endif's
|
} // endif's
|
||||||
@@ -3348,7 +3348,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, PCSZ fn)
|
|||||||
|
|
||||||
of.QuadPart = (BIGINT)n + (BIGINT)MaxBlk * (BIGINT)Blksize - (BIGINT)1;
|
of.QuadPart = (BIGINT)n + (BIGINT)MaxBlk * (BIGINT)Blksize - (BIGINT)1;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("MEF: of=%lld n=%d maxblk=%d blksize=%d\n",
|
htrc("MEF: of=%lld n=%d maxblk=%d blksize=%d\n",
|
||||||
of.QuadPart, n, MaxBlk, Blksize);
|
of.QuadPart, n, MaxBlk, Blksize);
|
||||||
|
|
||||||
@@ -3394,7 +3394,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, PCSZ fn)
|
|||||||
|
|
||||||
pos = (BIGINT)n + (BIGINT)MaxBlk * (BIGINT)Blksize - (BIGINT)1;
|
pos = (BIGINT)n + (BIGINT)MaxBlk * (BIGINT)Blksize - (BIGINT)1;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("MEF: pos=%lld n=%d maxblk=%d blksize=%d\n",
|
htrc("MEF: pos=%lld n=%d maxblk=%d blksize=%d\n",
|
||||||
pos, n, MaxBlk, Blksize);
|
pos, n, MaxBlk, Blksize);
|
||||||
|
|
||||||
@@ -3439,7 +3439,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("OpenTableFile: filename=%s mode=%d Last=%d\n",
|
htrc("OpenTableFile: filename=%s mode=%d Last=%d\n",
|
||||||
filename, mode, Last);
|
filename, mode, Last);
|
||||||
|
|
||||||
@@ -3516,7 +3516,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
|
|||||||
strcat(g->Message, filename);
|
strcat(g->Message, filename);
|
||||||
} // endif Hfile
|
} // endif Hfile
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" rc=%d access=%p share=%p creation=%d handle=%p fn=%s\n",
|
htrc(" rc=%d access=%p share=%p creation=%d handle=%p fn=%s\n",
|
||||||
rc, access, share, creation, Hfile, filename);
|
rc, access, share, creation, Hfile, filename);
|
||||||
|
|
||||||
@@ -3605,7 +3605,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
|
|||||||
strcat(g->Message, strerror(errno));
|
strcat(g->Message, strerror(errno));
|
||||||
} // endif Hfile
|
} // endif Hfile
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" rc=%d oflag=%p mode=%p handle=%d fn=%s\n",
|
htrc(" rc=%d oflag=%p mode=%p handle=%d fn=%s\n",
|
||||||
rc, oflag, mode, Hfile, filename);
|
rc, oflag, mode, Hfile, filename);
|
||||||
#endif // UNIX
|
#endif // UNIX
|
||||||
@@ -3626,7 +3626,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
|
|||||||
To_Fb->Mode = mode;
|
To_Fb->Mode = mode;
|
||||||
To_Fb->Handle = Hfile;
|
To_Fb->Handle = Hfile;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("File %s is open in mode %d\n", filename, mode);
|
htrc("File %s is open in mode %d\n", filename, mode);
|
||||||
|
|
||||||
if (del)
|
if (del)
|
||||||
@@ -3729,7 +3729,7 @@ bool BGVFAM::AllocateBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int BGVFAM::WriteBuffer(PGLOBAL g)
|
int BGVFAM::WriteBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BGV WriteDB: R%d Mode=%d CurNum=%d CurBlk=%d\n",
|
htrc("BGV WriteDB: R%d Mode=%d CurNum=%d CurBlk=%d\n",
|
||||||
Tdbp->GetTdb_No(), Tdbp->GetMode(), CurNum, CurBlk);
|
Tdbp->GetTdb_No(), Tdbp->GetMode(), CurNum, CurBlk);
|
||||||
|
|
||||||
@@ -3829,7 +3829,7 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/* 2 - directly move the not deleted lines inside the original */
|
/* 2 - directly move the not deleted lines inside the original */
|
||||||
/* file, and at the end erase all trailing records. */
|
/* file, and at the end erase all trailing records. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BGV DeleteDB: irc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
htrc("BGV DeleteDB: irc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
|
||||||
irc, UseTemp, Fpos, Tpos, Spos);
|
irc, UseTemp, Fpos, Tpos, Spos);
|
||||||
|
|
||||||
@@ -3839,7 +3839,7 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = (Block - 1) * Nrec + Last;
|
Fpos = (Block - 1) * Nrec + Last;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Fpos placed at file end=%d\n", Fpos);
|
htrc("Fpos placed at file end=%d\n", Fpos);
|
||||||
|
|
||||||
eof = UseTemp && !MaxBlk;
|
eof = UseTemp && !MaxBlk;
|
||||||
@@ -3878,7 +3878,7 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
#endif
|
#endif
|
||||||
Spos++; // New start position is on next line
|
Spos++; // New start position is on next line
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -4065,7 +4065,7 @@ bool BGVFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
|
|
||||||
} // endif Usetemp...
|
} // endif Usetemp...
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
|
||||||
|
|
||||||
} // endfor n
|
} // endfor n
|
||||||
@@ -4201,7 +4201,7 @@ void BGVFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
if (Hfile != INVALID_HANDLE_VALUE)
|
if (Hfile != INVALID_HANDLE_VALUE)
|
||||||
rc = PlugCloseFile(g, To_Fb);
|
rc = PlugCloseFile(g, To_Fb);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("BGV CloseTableFile: closing %s wrc=%d rc=%d\n",
|
htrc("BGV CloseTableFile: closing %s wrc=%d rc=%d\n",
|
||||||
To_File, wrc, rc);
|
To_File, wrc, rc);
|
||||||
|
|
||||||
@@ -4247,7 +4247,7 @@ bool BGVFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
pos = (BIGINT)Nrec * ((BIGINT)colp->Deplac
|
pos = (BIGINT)Nrec * ((BIGINT)colp->Deplac
|
||||||
+ (BIGINT)Lrecl * (BIGINT)CurBlk);
|
+ (BIGINT)Lrecl * (BIGINT)CurBlk);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("RB: offset=%lld Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d MaxBlk=%d\n",
|
htrc("RB: offset=%lld Nrec=%d Deplac=%d Lrecl=%d CurBlk=%d MaxBlk=%d\n",
|
||||||
pos, Nrec, colp->Deplac, Lrecl, CurBlk, MaxBlk);
|
pos, Nrec, colp->Deplac, Lrecl, CurBlk, MaxBlk);
|
||||||
|
|
||||||
@@ -4257,7 +4257,7 @@ bool BGVFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
if (BigRead(g, Hfile, colp->Blk->GetValPointer(), colp->Clen * Nrec))
|
if (BigRead(g, Hfile, colp->Blk->GetValPointer(), colp->Clen * Nrec))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
num_read++;
|
num_read++;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -4284,7 +4284,7 @@ bool BGVFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
pos = (BIGINT)Nrec * ((BIGINT)colp->Deplac
|
pos = (BIGINT)Nrec * ((BIGINT)colp->Deplac
|
||||||
+ (BIGINT)Lrecl * (BIGINT)colp->ColBlk);
|
+ (BIGINT)Lrecl * (BIGINT)colp->ColBlk);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("WB: offset=%lld Nrec=%d Deplac=%d Lrecl=%d ColBlk=%d\n",
|
htrc("WB: offset=%lld Nrec=%d Deplac=%d Lrecl=%d ColBlk=%d\n",
|
||||||
pos, Nrec, colp->Deplac, Lrecl, colp->ColBlk);
|
pos, Nrec, colp->Deplac, Lrecl, colp->ColBlk);
|
||||||
|
|
||||||
|
|||||||
@@ -699,7 +699,7 @@ bool UNZIPUTL::openEntry(PGLOBAL g)
|
|||||||
entryopen = true;
|
entryopen = true;
|
||||||
} // endif rc
|
} // endif rc
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Openning entry%s %s\n", fn, (entryopen) ? "oked" : "failed");
|
htrc("Openning entry%s %s\n", fn, (entryopen) ? "oked" : "failed");
|
||||||
|
|
||||||
return !entryopen;
|
return !entryopen;
|
||||||
@@ -748,10 +748,10 @@ UNZFAM::UNZFAM(PUNZFAM txfp) : MAPFAM(txfp)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int UNZFAM::GetFileLength(PGLOBAL g)
|
int UNZFAM::GetFileLength(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int len = (zutp && zutp->entryopen) ? Top - Memory
|
int len = (zutp && zutp->entryopen) ? (int)(Top - Memory)
|
||||||
: TXTFAM::GetFileLength(g) * 3;
|
: TXTFAM::GetFileLength(g) * 3;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Zipped file length=%d\n", len);
|
htrc("Zipped file length=%d\n", len);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
@@ -1088,7 +1088,7 @@ int ZIPFAM::WriteBuffer(PGLOBAL g)
|
|||||||
|
|
||||||
// Prepare to write the new line
|
// Prepare to write the new line
|
||||||
strcat(strcpy(To_Buf, Tdbp->GetLine()), (Bin) ? CrLf : "\n");
|
strcat(strcpy(To_Buf, Tdbp->GetLine()), (Bin) ? CrLf : "\n");
|
||||||
len = strchr(To_Buf, '\n') - To_Buf + 1;
|
len = (int)(strchr(To_Buf, '\n') - To_Buf + 1);
|
||||||
return zutp->writeEntry(g, To_Buf, len);
|
return zutp->writeEntry(g, To_Buf, len);
|
||||||
} // end of WriteBuffer
|
} // end of WriteBuffer
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ BYTE OpBmp(PGLOBAL g, OPVAL opc)
|
|||||||
case OP_EXIST: bt = 0x00; break;
|
case OP_EXIST: bt = 0x00; break;
|
||||||
default:
|
default:
|
||||||
sprintf(g->Message, MSG(BAD_FILTER_OP), opc);
|
sprintf(g->Message, MSG(BAD_FILTER_OP), opc);
|
||||||
throw (int)TYPE_ARRAY;
|
throw (int)TYPE_FILTER;
|
||||||
} // endswitch opc
|
} // endswitch opc
|
||||||
|
|
||||||
return bt;
|
return bt;
|
||||||
@@ -301,7 +301,7 @@ PFIL FILTER::Link(PGLOBAL g, PFIL fil2)
|
|||||||
{
|
{
|
||||||
PFIL fil1;
|
PFIL fil1;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Linking filter %p with op=%d... to filter %p with op=%d\n",
|
htrc("Linking filter %p with op=%d... to filter %p with op=%d\n",
|
||||||
this, Opc, fil2, (fil2) ? fil2->Opc : 0);
|
this, Opc, fil2, (fil2) ? fil2->Opc : 0);
|
||||||
|
|
||||||
@@ -355,7 +355,7 @@ int FILTER::CheckColumn(PGLOBAL g, PSQL sqlp, PXOB &p, int &ag)
|
|||||||
char errmsg[MAX_STR] = "";
|
char errmsg[MAX_STR] = "";
|
||||||
int agg, k, n = 0;
|
int agg, k, n = 0;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("FILTER CheckColumn: sqlp=%p ag=%d\n", sqlp, ag);
|
htrc("FILTER CheckColumn: sqlp=%p ag=%d\n", sqlp, ag);
|
||||||
|
|
||||||
switch (Opc) {
|
switch (Opc) {
|
||||||
@@ -540,7 +540,7 @@ PFIL FILTER::SortJoin(PGLOBAL g)
|
|||||||
bool FILTER::FindJoinFilter(POPJOIN opj, PFIL fprec, bool teq, bool tek,
|
bool FILTER::FindJoinFilter(POPJOIN opj, PFIL fprec, bool teq, bool tek,
|
||||||
bool tk2, bool tc2, bool tix, bool thx)
|
bool tk2, bool tc2, bool tix, bool thx)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("FindJoinFilter: opj=%p fprec=%p tests=(%d,%d,%d,%d)\n",
|
htrc("FindJoinFilter: opj=%p fprec=%p tests=(%d,%d,%d,%d)\n",
|
||||||
opj, fprec, teq, tek, tk2, tc2);
|
opj, fprec, teq, tek, tk2, tc2);
|
||||||
|
|
||||||
@@ -867,7 +867,7 @@ bool FILTER::CheckLocal(PTDB tdbp)
|
|||||||
{
|
{
|
||||||
bool local = TRUE;
|
bool local = TRUE;
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
if (tdbp)
|
if (tdbp)
|
||||||
htrc("CheckLocal: filp=%p R%d\n", this, tdbp->GetTdb_No());
|
htrc("CheckLocal: filp=%p R%d\n", this, tdbp->GetTdb_No());
|
||||||
else
|
else
|
||||||
@@ -877,7 +877,7 @@ bool FILTER::CheckLocal(PTDB tdbp)
|
|||||||
for (int i = 0; local && i < 2; i++)
|
for (int i = 0; local && i < 2; i++)
|
||||||
local = Arg(i)->CheckLocal(tdbp);
|
local = Arg(i)->CheckLocal(tdbp);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("FCL: returning %d\n", local);
|
htrc("FCL: returning %d\n", local);
|
||||||
|
|
||||||
return (local);
|
return (local);
|
||||||
@@ -983,7 +983,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
|
|||||||
{
|
{
|
||||||
int i, comtype = TYPE_ERROR;
|
int i, comtype = TYPE_ERROR;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("converting(?) %s %p opc=%d\n",
|
htrc("converting(?) %s %p opc=%d\n",
|
||||||
(having) ? "having" : "filter", this, Opc);
|
(having) ? "having" : "filter", this, Opc);
|
||||||
|
|
||||||
@@ -1014,7 +1014,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
} // endswitch
|
} // endswitch
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Filter(%d): Arg type=%d\n", i, GetArgType(i));
|
htrc("Filter(%d): Arg type=%d\n", i, GetArgType(i));
|
||||||
|
|
||||||
// Set default values
|
// Set default values
|
||||||
@@ -1059,7 +1059,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" comtype=%d, B_T(%d)=%d Val(%d)=%p\n",
|
htrc(" comtype=%d, B_T(%d)=%d Val(%d)=%p\n",
|
||||||
comtype, i, Test[i].B_T, i, Val(i));
|
comtype, i, Test[i].B_T, i, Val(i));
|
||||||
|
|
||||||
@@ -1067,7 +1067,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
|
|||||||
|
|
||||||
// Set or allocate the filter argument values and buffers
|
// Set or allocate the filter argument values and buffers
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" conv type %d ? i=%d B_T=%d comtype=%d\n",
|
htrc(" conv type %d ? i=%d B_T=%d comtype=%d\n",
|
||||||
GetArgType(i), i, Test[i].B_T, comtype);
|
GetArgType(i), i, Test[i].B_T, comtype);
|
||||||
|
|
||||||
@@ -1144,7 +1144,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
|
|||||||
|
|
||||||
TEST: // Test for possible Eval optimization
|
TEST: // Test for possible Eval optimization
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Filp %p op=%d argtypes=(%d,%d)\n",
|
htrc("Filp %p op=%d argtypes=(%d,%d)\n",
|
||||||
this, Opc, GetArgType(0), GetArgType(1));
|
this, Opc, GetArgType(0), GetArgType(1));
|
||||||
|
|
||||||
@@ -1233,7 +1233,7 @@ bool FILTER::Eval(PGLOBAL g)
|
|||||||
else if (Test[i].Conv)
|
else if (Test[i].Conv)
|
||||||
Val(i)->SetValue_pval(Arg(i)->GetValue());
|
Val(i)->SetValue_pval(Arg(i)->GetValue());
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" Filter: op=%d type=%d %d B_T=%d %d val=%p %p\n",
|
htrc(" Filter: op=%d type=%d %d B_T=%d %d val=%p %p\n",
|
||||||
Opc, GetArgType(0), GetArgType(1), Test[0].B_T, Test[1].B_T,
|
Opc, GetArgType(0), GetArgType(1), Test[0].B_T, Test[1].B_T,
|
||||||
Val(0), Val(1));
|
Val(0), Val(1));
|
||||||
@@ -1273,7 +1273,7 @@ bool FILTER::Eval(PGLOBAL g)
|
|||||||
goto FilterError;
|
goto FilterError;
|
||||||
} // endswitch Type
|
} // endswitch Type
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc(" IN filtering: ap=%p\n", ap);
|
htrc(" IN filtering: ap=%p\n", ap);
|
||||||
|
|
||||||
if (ap)
|
if (ap)
|
||||||
@@ -1363,7 +1363,7 @@ bool FILTER::Eval(PGLOBAL g)
|
|||||||
goto FilterError;
|
goto FilterError;
|
||||||
} // endswitch Opc
|
} // endswitch Opc
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Eval: filter %p Opc=%d result=%d\n",
|
htrc("Eval: filter %p Opc=%d result=%d\n",
|
||||||
this, Opc, Value->GetIntValue());
|
this, Opc, Value->GetIntValue());
|
||||||
|
|
||||||
@@ -1775,7 +1775,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
|
|||||||
{
|
{
|
||||||
PFIL filp = NULL;
|
PFIL filp = NULL;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("PrepareFilter: fp=%p having=%d\n", fp, having);
|
htrc("PrepareFilter: fp=%p having=%d\n", fp, having);
|
||||||
|
|
||||||
while (fp) {
|
while (fp) {
|
||||||
@@ -1790,14 +1790,14 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
|
|||||||
break; // Remove eventual ending separator(s)
|
break; // Remove eventual ending separator(s)
|
||||||
|
|
||||||
// if (fp->Convert(g, having))
|
// if (fp->Convert(g, having))
|
||||||
// (int)throw TYPE_ARRAY;
|
// throw (int)TYPE_FILTER;
|
||||||
|
|
||||||
filp = fp;
|
filp = fp;
|
||||||
fp = fp->Next;
|
fp = fp->Next;
|
||||||
filp->Next = NULL;
|
filp->Next = NULL;
|
||||||
} // endwhile
|
} // endwhile
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc(" returning filp=%p\n", filp);
|
htrc(" returning filp=%p\n", filp);
|
||||||
|
|
||||||
return filp;
|
return filp;
|
||||||
@@ -1823,7 +1823,7 @@ DllExport bool ApplyFilter(PGLOBAL g, PFIL filp)
|
|||||||
if (filp->Eval(g))
|
if (filp->Eval(g))
|
||||||
throw (int)TYPE_FILTER;
|
throw (int)TYPE_FILTER;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("PlugFilter filp=%p result=%d\n",
|
htrc("PlugFilter filp=%p result=%d\n",
|
||||||
filp, filp->GetResult());
|
filp, filp->GetResult());
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ static void yy_fatal_error YY_PROTO(( const char msg[] ));
|
|||||||
*/
|
*/
|
||||||
#define YY_DO_BEFORE_ACTION \
|
#define YY_DO_BEFORE_ACTION \
|
||||||
yytext_ptr = yy_bp; \
|
yytext_ptr = yy_bp; \
|
||||||
yyleng = yy_cp - yy_bp; \
|
yyleng = (int)(yy_cp - yy_bp); \
|
||||||
yy_hold_char = *yy_cp; \
|
yy_hold_char = *yy_cp; \
|
||||||
*yy_cp = '\0'; \
|
*yy_cp = '\0'; \
|
||||||
yy_c_buf_p = yy_cp;
|
yy_c_buf_p = yy_cp;
|
||||||
@@ -695,7 +695,7 @@ case YY_STATE_EOF(dqt):
|
|||||||
case YY_END_OF_BUFFER:
|
case YY_END_OF_BUFFER:
|
||||||
{
|
{
|
||||||
/* Amount of text matched not including the EOB char. */
|
/* Amount of text matched not including the EOB char. */
|
||||||
int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1;
|
int yy_amount_of_matched_text = (int)(yy_cp - yytext_ptr - 1);
|
||||||
|
|
||||||
/* Undo the effects of YY_DO_BEFORE_ACTION. */
|
/* Undo the effects of YY_DO_BEFORE_ACTION. */
|
||||||
*yy_cp = yy_hold_char;
|
*yy_cp = yy_hold_char;
|
||||||
@@ -862,7 +862,7 @@ static int yy_get_next_buffer()
|
|||||||
/* Try to read more data. */
|
/* Try to read more data. */
|
||||||
|
|
||||||
/* First move last chars to start of buffer. */
|
/* First move last chars to start of buffer. */
|
||||||
number_to_move = yy_c_buf_p - yytext_ptr;
|
number_to_move = (int)(yy_c_buf_p - yytext_ptr);
|
||||||
|
|
||||||
for ( i = 0; i < number_to_move; ++i )
|
for ( i = 0; i < number_to_move; ++i )
|
||||||
*(dest++) = *(source++);
|
*(dest++) = *(source++);
|
||||||
@@ -888,7 +888,7 @@ static int yy_get_next_buffer()
|
|||||||
/* just a shorter name for the current buffer */
|
/* just a shorter name for the current buffer */
|
||||||
YY_BUFFER_STATE b = yy_current_buffer;
|
YY_BUFFER_STATE b = yy_current_buffer;
|
||||||
|
|
||||||
int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf;
|
int yy_c_buf_p_offset = (int)(yy_c_buf_p - b->yy_ch_buf);
|
||||||
|
|
||||||
b->yy_buf_size *= 2;
|
b->yy_buf_size *= 2;
|
||||||
b->yy_ch_buf = (char *)
|
b->yy_ch_buf = (char *)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Define access to the thread based trace value. */
|
/* Define access to the thread based trace value. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
#define trace GetTraceValue()
|
#define trace(T) (bool)(GetTraceValue() & (uint)T)
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Miscellaneous Constants */
|
/* Miscellaneous Constants */
|
||||||
@@ -220,14 +220,19 @@ DllExport BOOL PlugIsAbsolutePath(LPCSTR path);
|
|||||||
DllExport bool AllocSarea(PGLOBAL, uint);
|
DllExport bool AllocSarea(PGLOBAL, uint);
|
||||||
DllExport void FreeSarea(PGLOBAL);
|
DllExport void FreeSarea(PGLOBAL);
|
||||||
DllExport BOOL PlugSubSet(PGLOBAL, void *, uint);
|
DllExport BOOL PlugSubSet(PGLOBAL, void *, uint);
|
||||||
DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t);
|
|
||||||
DllExport char *PlugDup(PGLOBAL g, const char *str);
|
DllExport char *PlugDup(PGLOBAL g, const char *str);
|
||||||
DllExport void *MakePtr(void *, OFFSET);
|
DllExport void *MakePtr(void *, OFFSET);
|
||||||
DllExport void htrc(char const *fmt, ...);
|
DllExport void htrc(char const *fmt, ...);
|
||||||
DllExport int GetTraceValue(void);
|
//DllExport int GetTraceValue(void);
|
||||||
|
DllExport uint GetTraceValue(void);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* Non exported routine declarations. */
|
||||||
|
/***********************************************************************/
|
||||||
|
void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
|
||||||
|
|
||||||
/*-------------------------- End of Global.H --------------------------*/
|
/*-------------------------- End of Global.H --------------------------*/
|
||||||
|
|||||||
@@ -98,8 +98,8 @@
|
|||||||
rnd_next signals that it has reached the end of its data. Calls to
|
rnd_next signals that it has reached the end of its data. Calls to
|
||||||
ha_connect::extra() are hints as to what will be occuring to the request.
|
ha_connect::extra() are hints as to what will be occuring to the request.
|
||||||
|
|
||||||
Author Olivier Bertrand
|
Author Olivier Bertrand
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||||
#pragma implementation // gcc: Class implementation
|
#pragma implementation // gcc: Class implementation
|
||||||
@@ -174,9 +174,9 @@
|
|||||||
#define JSONMAX 10 // JSON Default max grp size
|
#define JSONMAX 10 // JSON Default max grp size
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
char version[]= "Version 1.06.0005 October 14, 2017";
|
char version[]= "Version 1.06.0007 March 11, 2018";
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
char compver[]= "Version 1.06.0005 " __DATE__ " " __TIME__;
|
char compver[]= "Version 1.06.0007 " __DATE__ " " __TIME__;
|
||||||
char slash= '\\';
|
char slash= '\\';
|
||||||
#else // !__WIN__
|
#else // !__WIN__
|
||||||
char slash= '/';
|
char slash= '/';
|
||||||
@@ -266,16 +266,38 @@ static char *strz(PGLOBAL g, LEX_STRING &ls)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* CONNECT session variables definitions. */
|
/* CONNECT session variables definitions. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
// Tracing: 0 no, 1 yes, >1 more tracing
|
// Tracing: 0 no, 1 yes, 2 more, 4 index... 511 all
|
||||||
static MYSQL_THDVAR_INT(xtrace,
|
const char *xtrace_names[] =
|
||||||
PLUGIN_VAR_RQCMDARG, "Console trace value.",
|
{
|
||||||
NULL, NULL, 0, 0, INT_MAX, 1);
|
"YES", "MORE", "INDEX", "MEMORY", "SUBALLOC",
|
||||||
|
"QUERY", "STMT", "HANDLER", "BLOCK", "MONGO", NullS
|
||||||
|
};
|
||||||
|
|
||||||
|
TYPELIB xtrace_typelib =
|
||||||
|
{
|
||||||
|
array_elements(xtrace_names) - 1, "xtrace_typelib",
|
||||||
|
xtrace_names, NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_SET(
|
||||||
|
xtrace, // name
|
||||||
|
PLUGIN_VAR_RQCMDARG, // opt
|
||||||
|
"Trace values.", // comment
|
||||||
|
NULL, // check
|
||||||
|
NULL, // update function
|
||||||
|
0, // def (NO)
|
||||||
|
&xtrace_typelib); // typelib
|
||||||
|
|
||||||
// Getting exact info values
|
// Getting exact info values
|
||||||
static MYSQL_THDVAR_BOOL(exact_info, PLUGIN_VAR_RQCMDARG,
|
static MYSQL_THDVAR_BOOL(exact_info, PLUGIN_VAR_RQCMDARG,
|
||||||
"Getting exact info values",
|
"Getting exact info values",
|
||||||
NULL, NULL, 0);
|
NULL, NULL, 0);
|
||||||
|
|
||||||
|
// Enabling cond_push
|
||||||
|
static MYSQL_THDVAR_BOOL(cond_push, PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Enabling cond_push",
|
||||||
|
NULL, NULL, 1); // YES by default
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Temporary file usage:
|
Temporary file usage:
|
||||||
no: Not using temporary file
|
no: Not using temporary file
|
||||||
@@ -314,17 +336,18 @@ static MYSQL_THDVAR_UINT(work_size,
|
|||||||
static MYSQL_THDVAR_INT(conv_size,
|
static MYSQL_THDVAR_INT(conv_size,
|
||||||
PLUGIN_VAR_RQCMDARG, // opt
|
PLUGIN_VAR_RQCMDARG, // opt
|
||||||
"Size used when converting TEXT columns.",
|
"Size used when converting TEXT columns.",
|
||||||
NULL, NULL, SZCONV, 0, 65500, 1);
|
NULL, NULL, SZCONV, 0, 65500, 8192);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Type conversion:
|
Type conversion:
|
||||||
no: Unsupported types -> TYPE_ERROR
|
no: Unsupported types -> TYPE_ERROR
|
||||||
yes: TEXT -> VARCHAR
|
yes: TEXT -> VARCHAR
|
||||||
|
force: Do it also for ODBC BINARY and BLOBs
|
||||||
skip: skip unsupported type columns in Discovery
|
skip: skip unsupported type columns in Discovery
|
||||||
*/
|
*/
|
||||||
const char *xconv_names[]=
|
const char *xconv_names[]=
|
||||||
{
|
{
|
||||||
"NO", "YES", "SKIP", NullS
|
"NO", "YES", "FORCE", "SKIP", NullS
|
||||||
};
|
};
|
||||||
|
|
||||||
TYPELIB xconv_typelib=
|
TYPELIB xconv_typelib=
|
||||||
@@ -339,7 +362,7 @@ static MYSQL_THDVAR_ENUM(
|
|||||||
"Unsupported types conversion.", // comment
|
"Unsupported types conversion.", // comment
|
||||||
NULL, // check
|
NULL, // check
|
||||||
NULL, // update function
|
NULL, // update function
|
||||||
0, // def (no)
|
1, // def (yes)
|
||||||
&xconv_typelib); // typelib
|
&xconv_typelib); // typelib
|
||||||
|
|
||||||
// Null representation for JSON values
|
// Null representation for JSON values
|
||||||
@@ -364,12 +387,17 @@ static MYSQL_THDVAR_STR(java_wrapper,
|
|||||||
NULL, NULL, "wrappers/JdbcInterface");
|
NULL, NULL, "wrappers/JdbcInterface");
|
||||||
#endif // JAVA_SUPPORT
|
#endif // JAVA_SUPPORT
|
||||||
|
|
||||||
#if 0 // This is apparently not acceptable for a plugin
|
// This is apparently not acceptable for a plugin so it is undocumented
|
||||||
|
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
|
||||||
// Enabling MONGO table type
|
// Enabling MONGO table type
|
||||||
|
#if defined(MONGO_SUPPORT) || (MYSQL_VERSION_ID > 100200)
|
||||||
static MYSQL_THDVAR_BOOL(enable_mongo, PLUGIN_VAR_RQCMDARG,
|
static MYSQL_THDVAR_BOOL(enable_mongo, PLUGIN_VAR_RQCMDARG,
|
||||||
"Enabling the MongoDB access",
|
"Enabling the MongoDB access", NULL, NULL, 1);
|
||||||
NULL, NULL, MONGO_ENABLED);
|
#else // !version 2,3
|
||||||
#endif // 0
|
static MYSQL_THDVAR_BOOL(enable_mongo, PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Enabling the MongoDB access", NULL, NULL, 0);
|
||||||
|
#endif // !version 2,3
|
||||||
|
#endif // JAVA_SUPPORT || CMGO_SUPPORT
|
||||||
|
|
||||||
#if defined(XMSG) || defined(NEWMSG)
|
#if defined(XMSG) || defined(NEWMSG)
|
||||||
const char *language_names[]=
|
const char *language_names[]=
|
||||||
@@ -401,9 +429,10 @@ handlerton *connect_hton= NULL;
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Function to export session variable values to other source files. */
|
/* Function to export session variable values to other source files. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
extern "C" int GetTraceValue(void)
|
uint GetTraceValue(void)
|
||||||
{return connect_hton ? THDVAR(current_thd, xtrace) : 0;}
|
{return (uint)(connect_hton ? THDVAR(current_thd, xtrace) : 0);}
|
||||||
bool ExactInfo(void) {return THDVAR(current_thd, exact_info);}
|
bool ExactInfo(void) {return THDVAR(current_thd, exact_info);}
|
||||||
|
bool CondPushEnabled(void) {return THDVAR(current_thd, cond_push);}
|
||||||
USETEMP UseTemp(void) {return (USETEMP)THDVAR(current_thd, use_tempfile);}
|
USETEMP UseTemp(void) {return (USETEMP)THDVAR(current_thd, use_tempfile);}
|
||||||
int GetConvSize(void) {return THDVAR(current_thd, conv_size);}
|
int GetConvSize(void) {return THDVAR(current_thd, conv_size);}
|
||||||
TYPCONV GetTypeConv(void) {return (TYPCONV)THDVAR(current_thd, type_conv);}
|
TYPCONV GetTypeConv(void) {return (TYPCONV)THDVAR(current_thd, type_conv);}
|
||||||
@@ -419,22 +448,20 @@ void SetWorkSize(uint)
|
|||||||
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
|
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
|
||||||
"Work size too big, try setting a smaller value");
|
"Work size too big, try setting a smaller value");
|
||||||
} // end of SetWorkSize
|
} // end of SetWorkSize
|
||||||
#if defined(XMSG) || defined(NEWMSG)
|
|
||||||
extern "C" const char *msglang(void)
|
|
||||||
{
|
|
||||||
return language_names[THDVAR(current_thd, msg_lang)];
|
|
||||||
} // end of msglang
|
|
||||||
#else // !XMSG && !NEWMSG
|
|
||||||
|
|
||||||
#if defined(JAVA_SUPPORT)
|
#if defined(JAVA_SUPPORT)
|
||||||
char *GetJavaWrapper(void)
|
char *GetJavaWrapper(void)
|
||||||
{return connect_hton ? THDVAR(current_thd, java_wrapper) : (char*)"wrappers/JdbcInterface";}
|
{return connect_hton ? THDVAR(current_thd, java_wrapper) : (char*)"wrappers/JdbcInterface";}
|
||||||
#endif // JAVA_SUPPORT
|
#endif // JAVA_SUPPORT
|
||||||
|
|
||||||
#if defined(JAVA_SUPPORT)
|
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
|
||||||
//bool MongoEnabled(void) { return THDVAR(current_thd, enable_mongo); }
|
bool MongoEnabled(void) {return THDVAR(current_thd, enable_mongo);}
|
||||||
#endif // JAVA_SUPPORT
|
#endif // JAVA_SUPPORT || CMGO_SUPPORT
|
||||||
|
|
||||||
|
#if defined(XMSG) || defined(NEWMSG)
|
||||||
|
extern "C" const char *msglang(void)
|
||||||
|
{return language_names[THDVAR(current_thd, msg_lang)];}
|
||||||
|
#else // !XMSG && !NEWMSG
|
||||||
extern "C" const char *msglang(void)
|
extern "C" const char *msglang(void)
|
||||||
{
|
{
|
||||||
#if defined(FRENCH)
|
#if defined(FRENCH)
|
||||||
@@ -726,7 +753,7 @@ static int connect_init_func(void *p)
|
|||||||
connect_hton->tablefile_extensions= ha_connect_exts;
|
connect_hton->tablefile_extensions= ha_connect_exts;
|
||||||
connect_hton->discover_table_structure= connect_assisted_discovery;
|
connect_hton->discover_table_structure= connect_assisted_discovery;
|
||||||
|
|
||||||
if (trace)
|
if (trace(128))
|
||||||
sql_print_information("connect_init: hton=%p", p);
|
sql_print_information("connect_init: hton=%p", p);
|
||||||
|
|
||||||
DTVAL::SetTimeShift(); // Initialize time zone shift once for all
|
DTVAL::SetTimeShift(); // Initialize time zone shift once for all
|
||||||
@@ -818,7 +845,7 @@ static handler* connect_create_handler(handlerton *hton,
|
|||||||
{
|
{
|
||||||
handler *h= new (mem_root) ha_connect(hton, table);
|
handler *h= new (mem_root) ha_connect(hton, table);
|
||||||
|
|
||||||
if (trace)
|
if (trace(128))
|
||||||
htrc("New CONNECT %p, table: %.*s\n", h,
|
htrc("New CONNECT %p, table: %.*s\n", h,
|
||||||
table ? table->table_name.length : 6,
|
table ? table->table_name.length : 6,
|
||||||
table ? table->table_name.str : "<null>");
|
table ? table->table_name.str : "<null>");
|
||||||
@@ -874,7 +901,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
|
|||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
ha_connect::~ha_connect(void)
|
ha_connect::~ha_connect(void)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(128))
|
||||||
htrc("Delete CONNECT %p, table: %.*s, xp=%p count=%d\n", this,
|
htrc("Delete CONNECT %p, table: %.*s, xp=%p count=%d\n", this,
|
||||||
table ? table->s->table_name.length : 6,
|
table ? table->s->table_name.length : 6,
|
||||||
table ? table->s->table_name.str : "<null>",
|
table ? table->s->table_name.str : "<null>",
|
||||||
@@ -1086,55 +1113,55 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def)
|
|||||||
if (!oplist)
|
if (!oplist)
|
||||||
return (char*)def;
|
return (char*)def;
|
||||||
|
|
||||||
char key[16], val[256];
|
char key[16], val[256];
|
||||||
char *pv, *pn, *pk= (char*)oplist;
|
char *pv, *pn, *pk = (char*)oplist;
|
||||||
PCSZ opval= def;
|
PCSZ opval = def;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
while (*pk == ' ')
|
while (*pk == ' ')
|
||||||
pk++;
|
pk++;
|
||||||
|
|
||||||
for (; pk; pk= pn) {
|
for (; pk; pk = pn) {
|
||||||
pn= strchr(pk, ',');
|
pn = strchr(pk, ',');
|
||||||
pv= strchr(pk, '=');
|
pv = strchr(pk, '=');
|
||||||
|
|
||||||
if (pv && (!pn || pv < pn)) {
|
if (pv && (!pn || pv < pn)) {
|
||||||
n = MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1);
|
n = MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1);
|
||||||
memcpy(key, pk, n);
|
memcpy(key, pk, n);
|
||||||
|
|
||||||
while (n && key[n - 1] == ' ')
|
while (n && key[n - 1] == ' ')
|
||||||
n--;
|
n--;
|
||||||
|
|
||||||
key[n]= 0;
|
key[n] = 0;
|
||||||
|
|
||||||
while(*(++pv) == ' ') ;
|
while (*(++pv) == ' ');
|
||||||
|
|
||||||
n= MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
|
n = MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
|
||||||
memcpy(val, pv, n);
|
memcpy(val, pv, n);
|
||||||
|
|
||||||
while (n && val[n - 1] == ' ')
|
while (n && val[n - 1] == ' ')
|
||||||
n--;
|
n--;
|
||||||
|
|
||||||
val[n]= 0;
|
val[n] = 0;
|
||||||
} else {
|
} else {
|
||||||
n= MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1);
|
n = MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1);
|
||||||
memcpy(key, pk, n);
|
memcpy(key, pk, n);
|
||||||
|
|
||||||
while (n && key[n - 1] == ' ')
|
while (n && key[n - 1] == ' ')
|
||||||
n--;
|
n--;
|
||||||
|
|
||||||
key[n]= 0;
|
key[n] = 0;
|
||||||
val[0]= 0;
|
val[0] = 0;
|
||||||
} // endif pv
|
} // endif pv
|
||||||
|
|
||||||
if (!stricmp(opname, key)) {
|
if (!stricmp(opname, key)) {
|
||||||
opval= PlugDup(g, val);
|
opval = PlugDup(g, val);
|
||||||
break;
|
break;
|
||||||
} else if (!pn)
|
} else if (!pn)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
while (*(++pn) == ' ') ;
|
while (*(++pn) == ' ');
|
||||||
} // endfor pk
|
} // endfor pk
|
||||||
|
|
||||||
return opval;
|
return opval;
|
||||||
} // end of GetListOption
|
} // end of GetListOption
|
||||||
@@ -1658,7 +1685,7 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s)
|
|||||||
s= table->s;
|
s= table->s;
|
||||||
|
|
||||||
for (int n= 0; (unsigned)n < s->keynames.count; n++) {
|
for (int n= 0; (unsigned)n < s->keynames.count; n++) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Getting created index %d info\n", n + 1);
|
htrc("Getting created index %d info\n", n + 1);
|
||||||
|
|
||||||
// Find the index to describe
|
// Find the index to describe
|
||||||
@@ -2006,7 +2033,7 @@ bool ha_connect::CheckColumnList(PGLOBAL g)
|
|||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
brc = true;
|
brc = true;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
@@ -2063,7 +2090,7 @@ int ha_connect::MakeRecord(char *buf)
|
|||||||
PCOL colp= NULL;
|
PCOL colp= NULL;
|
||||||
DBUG_ENTER("ha_connect::MakeRecord");
|
DBUG_ENTER("ha_connect::MakeRecord");
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Maps: read=%08X write=%08X vcol=%08X defr=%08X defw=%08X\n",
|
htrc("Maps: read=%08X write=%08X vcol=%08X defr=%08X defw=%08X\n",
|
||||||
*table->read_set->bitmap, *table->write_set->bitmap,
|
*table->read_set->bitmap, *table->write_set->bitmap,
|
||||||
(table->vcol_set) ? *table->vcol_set->bitmap : 0,
|
(table->vcol_set) ? *table->vcol_set->bitmap : 0,
|
||||||
@@ -2587,14 +2614,14 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
|
|||||||
if (!cond)
|
if (!cond)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Cond type=%d\n", cond->type());
|
htrc("Cond type=%d\n", cond->type());
|
||||||
|
|
||||||
if (cond->type() == COND::COND_ITEM) {
|
if (cond->type() == COND::COND_ITEM) {
|
||||||
PFIL fp;
|
PFIL fp;
|
||||||
Item_cond *cond_item= (Item_cond *)cond;
|
Item_cond *cond_item= (Item_cond *)cond;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Cond: Ftype=%d name=%s\n", cond_item->functype(),
|
htrc("Cond: Ftype=%d name=%s\n", cond_item->functype(),
|
||||||
cond_item->func_name());
|
cond_item->func_name());
|
||||||
|
|
||||||
@@ -2628,7 +2655,7 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
|
|||||||
Item_func *condf= (Item_func *)cond;
|
Item_func *condf= (Item_func *)cond;
|
||||||
Item* *args= condf->arguments();
|
Item* *args= condf->arguments();
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Func type=%d argnum=%d\n", condf->functype(),
|
htrc("Func type=%d argnum=%d\n", condf->functype(),
|
||||||
condf->argument_count());
|
condf->argument_count());
|
||||||
|
|
||||||
@@ -2657,11 +2684,11 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i= 0; i < condf->argument_count(); i++) {
|
for (i= 0; i < condf->argument_count(); i++) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Argtype(%d)=%d\n", i, args[i]->type());
|
htrc("Argtype(%d)=%d\n", i, args[i]->type());
|
||||||
|
|
||||||
if (i >= 2 && !ismul) {
|
if (i >= 2 && !ismul) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Unexpected arg for vop=%d\n", vop);
|
htrc("Unexpected arg for vop=%d\n", vop);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -2691,7 +2718,7 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
|
|||||||
break;
|
break;
|
||||||
} // endswitch type
|
} // endswitch type
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc("Field index=%d\n", pField->field->field_index);
|
htrc("Field index=%d\n", pField->field->field_index);
|
||||||
htrc("Field name=%s\n", pField->field->field_name);
|
htrc("Field name=%s\n", pField->field->field_name);
|
||||||
} // endif trace
|
} // endif trace
|
||||||
@@ -2738,7 +2765,7 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
|
|||||||
return NULL;
|
return NULL;
|
||||||
} // endswitch type
|
} // endswitch type
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Value type=%hd\n", pp->Type);
|
htrc("Value type=%hd\n", pp->Type);
|
||||||
|
|
||||||
// Append the value to the argument list
|
// Append the value to the argument list
|
||||||
@@ -2756,7 +2783,7 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
|
|||||||
|
|
||||||
filp= MakeFilter(g, colp, pop, pfirst, neg);
|
filp= MakeFilter(g, colp, pop, pfirst, neg);
|
||||||
} else {
|
} else {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Unsupported condition\n");
|
htrc("Unsupported condition\n");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -2782,7 +2809,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
|
|||||||
if (!cond)
|
if (!cond)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Cond type=%d\n", cond->type());
|
htrc("Cond type=%d\n", cond->type());
|
||||||
|
|
||||||
if (cond->type() == COND::COND_ITEM) {
|
if (cond->type() == COND::COND_ITEM) {
|
||||||
@@ -2795,7 +2822,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
|
|||||||
else
|
else
|
||||||
pb0= pb1= pb2= ph0= ph1= ph2= NULL;
|
pb0= pb1= pb2= ph0= ph1= ph2= NULL;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Cond: Ftype=%d name=%s\n", cond_item->functype(),
|
htrc("Cond: Ftype=%d name=%s\n", cond_item->functype(),
|
||||||
cond_item->func_name());
|
cond_item->func_name());
|
||||||
|
|
||||||
@@ -2881,7 +2908,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
|
|||||||
|
|
||||||
filp->Bd = filp->Hv = false;
|
filp->Bd = filp->Hv = false;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Func type=%d argnum=%d\n", condf->functype(),
|
htrc("Func type=%d argnum=%d\n", condf->functype(),
|
||||||
condf->argument_count());
|
condf->argument_count());
|
||||||
|
|
||||||
@@ -2918,11 +2945,11 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i= 0; i < condf->argument_count(); i++) {
|
for (i= 0; i < condf->argument_count(); i++) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Argtype(%d)=%d\n", i, args[i]->type());
|
htrc("Argtype(%d)=%d\n", i, args[i]->type());
|
||||||
|
|
||||||
if (i >= 2 && !ismul) {
|
if (i >= 2 && !ismul) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Unexpected arg for vop=%d\n", vop);
|
htrc("Unexpected arg for vop=%d\n", vop);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -2965,7 +2992,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
|
|||||||
|
|
||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc("Field index=%d\n", pField->field->field_index);
|
htrc("Field index=%d\n", pField->field->field_index);
|
||||||
htrc("Field name=%s\n", pField->field->field_name);
|
htrc("Field name=%s\n", pField->field->field_name);
|
||||||
htrc("Field type=%d\n", pField->field->type());
|
htrc("Field type=%d\n", pField->field->type());
|
||||||
@@ -3003,7 +3030,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
|
|||||||
if ((res= pval->val_str(&tmp)) == NULL)
|
if ((res= pval->val_str(&tmp)) == NULL)
|
||||||
return NULL; // To be clarified
|
return NULL; // To be clarified
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Value=%.*s\n", res->length(), res->ptr());
|
htrc("Value=%.*s\n", res->length(), res->ptr());
|
||||||
|
|
||||||
// IN and BETWEEN clauses should be col VOP list
|
// IN and BETWEEN clauses should be col VOP list
|
||||||
@@ -3144,7 +3171,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
|
|||||||
filp->Bd = true;
|
filp->Bd = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Unsupported condition\n");
|
htrc("Unsupported condition\n");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3177,7 +3204,7 @@ const COND *ha_connect::cond_push(const COND *cond)
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("ha_connect::cond_push");
|
DBUG_ENTER("ha_connect::cond_push");
|
||||||
|
|
||||||
if (tdbp) {
|
if (tdbp && CondPushEnabled()) {
|
||||||
PGLOBAL& g= xp->g;
|
PGLOBAL& g= xp->g;
|
||||||
AMT tty= tdbp->GetAmType();
|
AMT tty= tdbp->GetAmType();
|
||||||
bool x= (tty == TYPE_AM_MYX || tty == TYPE_AM_XDBC);
|
bool x= (tty == TYPE_AM_MYX || tty == TYPE_AM_XDBC);
|
||||||
@@ -3211,7 +3238,7 @@ const COND *ha_connect::cond_push(const COND *cond)
|
|||||||
if (filp->Having && strlen(filp->Having) > 255)
|
if (filp->Having && strlen(filp->Having) > 255)
|
||||||
goto fin; // Memory collapse
|
goto fin; // Memory collapse
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("cond_push: %s\n", filp->Body);
|
htrc("cond_push: %s\n", filp->Body);
|
||||||
|
|
||||||
tdbp->SetCond(cond);
|
tdbp->SetCond(cond);
|
||||||
@@ -3237,7 +3264,7 @@ const COND *ha_connect::cond_push(const COND *cond)
|
|||||||
} // endif tty
|
} // endif tty
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
strcpy(g->Message, msg);
|
strcpy(g->Message, msg);
|
||||||
@@ -3290,7 +3317,7 @@ bool ha_connect::get_error_message(int error, String* buf)
|
|||||||
&my_charset_latin1,
|
&my_charset_latin1,
|
||||||
&dummy_errors);
|
&dummy_errors);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GEM(%d): len=%u %s\n", error, len, g->Message);
|
htrc("GEM(%d): len=%u %s\n", error, len, g->Message);
|
||||||
|
|
||||||
msg[len]= '\0';
|
msg[len]= '\0';
|
||||||
@@ -3342,7 +3369,7 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
|
|||||||
int rc= 0;
|
int rc= 0;
|
||||||
DBUG_ENTER("ha_connect::open");
|
DBUG_ENTER("ha_connect::open");
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("open: name=%s mode=%d test=%u\n", name, mode, test_if_locked);
|
htrc("open: name=%s mode=%d test=%u\n", name, mode, test_if_locked);
|
||||||
|
|
||||||
if (!(share= get_share()))
|
if (!(share= get_share()))
|
||||||
@@ -3417,7 +3444,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
|
|||||||
rc = HA_ERR_INTERNAL_ERROR;
|
rc = HA_ERR_INTERNAL_ERROR;
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
rc = HA_ERR_INTERNAL_ERROR;
|
rc = HA_ERR_INTERNAL_ERROR;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
@@ -3565,7 +3592,7 @@ int ha_connect::update_row(const uchar *old_data, uchar *new_data)
|
|||||||
PGLOBAL& g= xp->g;
|
PGLOBAL& g= xp->g;
|
||||||
DBUG_ENTER("ha_connect::update_row");
|
DBUG_ENTER("ha_connect::update_row");
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("update_row: old=%s new=%s\n", old_data, new_data);
|
htrc("update_row: old=%s new=%s\n", old_data, new_data);
|
||||||
|
|
||||||
// Check values for possible change in indexed column
|
// Check values for possible change in indexed column
|
||||||
@@ -3626,7 +3653,7 @@ int ha_connect::index_init(uint idx, bool sorted)
|
|||||||
PGLOBAL& g= xp->g;
|
PGLOBAL& g= xp->g;
|
||||||
DBUG_ENTER("index_init");
|
DBUG_ENTER("index_init");
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("index_init: this=%p idx=%u sorted=%d\n", this, idx, sorted);
|
htrc("index_init: this=%p idx=%u sorted=%d\n", this, idx, sorted);
|
||||||
|
|
||||||
if (GetIndexType(GetRealType()) == 2) {
|
if (GetIndexType(GetRealType()) == 2) {
|
||||||
@@ -3679,7 +3706,7 @@ int ha_connect::index_init(uint idx, bool sorted)
|
|||||||
rc= 0;
|
rc= 0;
|
||||||
} // endif indexing
|
} // endif indexing
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("index_init: rc=%d indexing=%d active_index=%d\n",
|
htrc("index_init: rc=%d indexing=%d active_index=%d\n",
|
||||||
rc, indexing, active_index);
|
rc, indexing, active_index);
|
||||||
|
|
||||||
@@ -3726,7 +3753,7 @@ int ha_connect::ReadIndexed(uchar *buf, OPVAL op, const key_range *kr)
|
|||||||
break;
|
break;
|
||||||
} // endswitch RC
|
} // endswitch RC
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("ReadIndexed: op=%d rc=%d\n", op, rc);
|
htrc("ReadIndexed: op=%d rc=%d\n", op, rc);
|
||||||
|
|
||||||
table->status= (rc == RC_OK) ? 0 : STATUS_NOT_FOUND;
|
table->status= (rc == RC_OK) ? 0 : STATUS_NOT_FOUND;
|
||||||
@@ -3769,7 +3796,7 @@ int ha_connect::index_read(uchar * buf, const uchar * key, uint key_len,
|
|||||||
default: DBUG_RETURN(-1); break;
|
default: DBUG_RETURN(-1); break;
|
||||||
} // endswitch find_flag
|
} // endswitch find_flag
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("%p index_read: op=%d\n", this, op);
|
htrc("%p index_read: op=%d\n", this, op);
|
||||||
|
|
||||||
if (indexing > 0) {
|
if (indexing > 0) {
|
||||||
@@ -3933,7 +3960,7 @@ int ha_connect::rnd_init(bool scan)
|
|||||||
alter= 1;
|
alter= 1;
|
||||||
} // endif xmod
|
} // endif xmod
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("rnd_init: this=%p scan=%d xmod=%d alter=%d\n",
|
htrc("rnd_init: this=%p scan=%d xmod=%d alter=%d\n",
|
||||||
this, scan, xmod, alter);
|
this, scan, xmod, alter);
|
||||||
|
|
||||||
@@ -4039,7 +4066,7 @@ int ha_connect::rnd_next(uchar *buf)
|
|||||||
break;
|
break;
|
||||||
} // endswitch RC
|
} // endswitch RC
|
||||||
|
|
||||||
if (trace > 1 && (rc || !(xp->nrd++ % 16384))) {
|
if (trace(2) && (rc || !(xp->nrd++ % 16384))) {
|
||||||
ulonglong tb2= my_interval_timer();
|
ulonglong tb2= my_interval_timer();
|
||||||
double elapsed= (double) (tb2 - xp->tb1) / 1000000000ULL;
|
double elapsed= (double) (tb2 - xp->tb1) / 1000000000ULL;
|
||||||
DBUG_PRINT("rnd_next", ("rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n",
|
DBUG_PRINT("rnd_next", ("rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n",
|
||||||
@@ -4083,7 +4110,7 @@ void ha_connect::position(const uchar *)
|
|||||||
DBUG_ENTER("ha_connect::position");
|
DBUG_ENTER("ha_connect::position");
|
||||||
my_store_ptr(ref, ref_length, (my_off_t)tdbp->GetRecpos());
|
my_store_ptr(ref, ref_length, (my_off_t)tdbp->GetRecpos());
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("position: pos=%d\n", tdbp->GetRecpos());
|
htrc("position: pos=%d\n", tdbp->GetRecpos());
|
||||||
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@@ -4113,7 +4140,7 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos)
|
|||||||
DBUG_ENTER("ha_connect::rnd_pos");
|
DBUG_ENTER("ha_connect::rnd_pos");
|
||||||
|
|
||||||
if (!tdbp->SetRecpos(xp->g, (int)my_get_ptr(pos, ref_length))) {
|
if (!tdbp->SetRecpos(xp->g, (int)my_get_ptr(pos, ref_length))) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("rnd_pos: %d\n", tdbp->GetRecpos());
|
htrc("rnd_pos: %d\n", tdbp->GetRecpos());
|
||||||
|
|
||||||
tdbp->SetFilter(NULL);
|
tdbp->SetFilter(NULL);
|
||||||
@@ -4179,7 +4206,7 @@ int ha_connect::info(uint flag)
|
|||||||
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
||||||
} // endif g
|
} // endif g
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%p In info: flag=%u valid_info=%d\n", this, flag, valid_info);
|
htrc("%p In info: flag=%u valid_info=%d\n", this, flag, valid_info);
|
||||||
|
|
||||||
// tdbp must be available to get updated info
|
// tdbp must be available to get updated info
|
||||||
@@ -4372,54 +4399,59 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
|
|||||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
|
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
|
||||||
return true;
|
return true;
|
||||||
} // endif path
|
} // endif path
|
||||||
}
|
|
||||||
|
} // endif !quick
|
||||||
|
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check FILE_ACL
|
// Fall through
|
||||||
// fall through
|
|
||||||
case TAB_ODBC:
|
|
||||||
case TAB_JDBC:
|
|
||||||
case TAB_MYSQL:
|
case TAB_MYSQL:
|
||||||
case TAB_MONGO:
|
|
||||||
case TAB_DIR:
|
case TAB_DIR:
|
||||||
case TAB_MAC:
|
|
||||||
case TAB_WMI:
|
|
||||||
case TAB_ZIP:
|
case TAB_ZIP:
|
||||||
case TAB_OEM:
|
case TAB_OEM:
|
||||||
#ifdef NO_EMBEDDED_ACCESS_CHECKS
|
#ifdef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
/*
|
|
||||||
If table or table->mdl_ticket is NULL - it's a DLL, e.g. CREATE TABLE.
|
|
||||||
if the table has an MDL_EXCLUSIVE lock - it's a DDL too, e.g. the
|
|
||||||
insert step of CREATE ... SELECT.
|
|
||||||
|
|
||||||
Otherwise it's a DML, the table was normally opened, locked,
|
/*
|
||||||
privilege were already checked, and table->grant.privilege is set.
|
Check FILE_ACL
|
||||||
With SQL SECURITY DEFINER, table->grant.privilege has definer's privileges.
|
If table or table->mdl_ticket is NULL - it's a DLL, e.g. CREATE TABLE.
|
||||||
|
if the table has an MDL_EXCLUSIVE lock - it's a DDL too, e.g. the
|
||||||
|
insert step of CREATE ... SELECT.
|
||||||
|
|
||||||
|
Otherwise it's a DML, the table was normally opened, locked,
|
||||||
|
privilege were already checked, and table->grant.privilege is set.
|
||||||
|
With SQL SECURITY DEFINER, table->grant.privilege has definer's privileges.
|
||||||
|
|
||||||
|
Unless we're in prelocking mode, in this case table->grant.privilege
|
||||||
|
is only checked in start_stmt(), not in external_lock().
|
||||||
|
*/
|
||||||
|
if (!table || !table->mdl_ticket || table->mdl_ticket->get_type() == MDL_EXCLUSIVE)
|
||||||
|
return check_access(thd, FILE_ACL, db, NULL, NULL, 0, 0);
|
||||||
|
|
||||||
Unless we're in prelocking mode, in this case table->grant.privilege
|
if ((!quick && thd->lex->requires_prelocking()) || table->grant.privilege & FILE_ACL)
|
||||||
is only checked in start_stmt(), not in external_lock().
|
return false;
|
||||||
*/
|
|
||||||
if (!table || !table->mdl_ticket || table->mdl_ticket->get_type() == MDL_EXCLUSIVE)
|
|
||||||
return check_access(thd, FILE_ACL, db, NULL, NULL, 0, 0);
|
|
||||||
if ((!quick && thd->lex->requires_prelocking()) || table->grant.privilege & FILE_ACL)
|
|
||||||
return false;
|
|
||||||
status_var_increment(thd->status_var.access_denied_errors);
|
|
||||||
my_error(access_denied_error_code(thd->password), MYF(0),
|
|
||||||
thd->security_ctx->priv_user, thd->security_ctx->priv_host,
|
|
||||||
(thd->password ? ER(ER_YES) : ER(ER_NO)));
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// This is temporary until a solution is found
|
status_var_increment(thd->status_var.access_denied_errors);
|
||||||
|
my_error(access_denied_error_code(thd->password), MYF(0),
|
||||||
|
thd->security_ctx->priv_user, thd->security_ctx->priv_host,
|
||||||
|
(thd->password ? ER(ER_YES) : ER(ER_NO)));
|
||||||
|
return true;
|
||||||
|
case TAB_ODBC:
|
||||||
|
case TAB_JDBC:
|
||||||
|
case TAB_MONGO:
|
||||||
|
case TAB_MAC:
|
||||||
|
case TAB_WMI:
|
||||||
|
return false;
|
||||||
case TAB_TBL:
|
case TAB_TBL:
|
||||||
case TAB_XCL:
|
case TAB_XCL:
|
||||||
case TAB_PRX:
|
case TAB_PRX:
|
||||||
case TAB_OCCUR:
|
case TAB_OCCUR:
|
||||||
case TAB_PIVOT:
|
case TAB_PIVOT:
|
||||||
case TAB_VIR:
|
case TAB_VIR:
|
||||||
return false;
|
// This is temporary until a solution is found
|
||||||
|
return false;
|
||||||
} // endswitch type
|
} // endswitch type
|
||||||
|
|
||||||
my_printf_error(ER_UNKNOWN_ERROR, "check_privileges failed", MYF(0));
|
my_printf_error(ER_UNKNOWN_ERROR, "check_privileges failed", MYF(0));
|
||||||
@@ -4457,7 +4489,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
|
|||||||
#if defined(DEVELOPMENT)
|
#if defined(DEVELOPMENT)
|
||||||
if (true) {
|
if (true) {
|
||||||
#else
|
#else
|
||||||
if (trace) {
|
if (trace(65)) {
|
||||||
#endif
|
#endif
|
||||||
LEX_STRING *query_string= thd_query_string(thd);
|
LEX_STRING *query_string= thd_query_string(thd);
|
||||||
htrc("%p check_mode: cmdtype=%d\n", this, thd_sql_command(thd));
|
htrc("%p check_mode: cmdtype=%d\n", this, thd_sql_command(thd));
|
||||||
@@ -4578,7 +4610,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
|
|||||||
|
|
||||||
} // endif's newmode
|
} // endif's newmode
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("New mode=%d\n", newmode);
|
htrc("New mode=%d\n", newmode);
|
||||||
|
|
||||||
return newmode;
|
return newmode;
|
||||||
@@ -4656,7 +4688,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
|
|
||||||
DBUG_ASSERT(thd == current_thd);
|
DBUG_ASSERT(thd == current_thd);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("external_lock: this=%p thd=%p xp=%p g=%p lock_type=%d\n",
|
htrc("external_lock: this=%p thd=%p xp=%p g=%p lock_type=%d\n",
|
||||||
this, thd, xp, g, lock_type);
|
this, thd, xp, g, lock_type);
|
||||||
|
|
||||||
@@ -4849,7 +4881,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
if (cras)
|
if (cras)
|
||||||
g->Createas= 1; // To tell created table to ignore FLAG
|
g->Createas= 1; // To tell created table to ignore FLAG
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
#if 0
|
#if 0
|
||||||
htrc("xcheck=%d cras=%d\n", xcheck, cras);
|
htrc("xcheck=%d cras=%d\n", xcheck, cras);
|
||||||
|
|
||||||
@@ -4882,7 +4914,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
// Delay open until used fields are known
|
// Delay open until used fields are known
|
||||||
} // endif tdbp
|
} // endif tdbp
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("external_lock: rc=%d\n", rc);
|
htrc("external_lock: rc=%d\n", rc);
|
||||||
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
@@ -5018,7 +5050,7 @@ int ha_connect::delete_or_rename_table(const char *name, const char *to)
|
|||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
int sqlcom= thd_sql_command(thd);
|
int sqlcom= thd_sql_command(thd);
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
if (to)
|
if (to)
|
||||||
htrc("rename_table: this=%p thd=%p sqlcom=%d from=%s to=%s\n",
|
htrc("rename_table: this=%p thd=%p sqlcom=%d from=%s to=%s\n",
|
||||||
this, thd, sqlcom, name, to);
|
this, thd, sqlcom, name, to);
|
||||||
@@ -5129,7 +5161,7 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key,
|
|||||||
if (index_init(inx, false))
|
if (index_init(inx, false))
|
||||||
DBUG_RETURN(HA_POS_ERROR);
|
DBUG_RETURN(HA_POS_ERROR);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("records_in_range: inx=%d indexing=%d\n", inx, indexing);
|
htrc("records_in_range: inx=%d indexing=%d\n", inx, indexing);
|
||||||
|
|
||||||
if (indexing > 0) {
|
if (indexing > 0) {
|
||||||
@@ -5158,7 +5190,7 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key,
|
|||||||
else
|
else
|
||||||
rows= HA_POS_ERROR;
|
rows= HA_POS_ERROR;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("records_in_range: rows=%llu\n", rows);
|
htrc("records_in_range: rows=%llu\n", rows);
|
||||||
|
|
||||||
DBUG_RETURN(rows);
|
DBUG_RETURN(rows);
|
||||||
@@ -5380,7 +5412,7 @@ static int init_table_share(THD* thd,
|
|||||||
|
|
||||||
} // endif charset
|
} // endif charset
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("s_init: %.*s\n", sql->length(), sql->ptr());
|
htrc("s_init: %.*s\n", sql->length(), sql->ptr());
|
||||||
|
|
||||||
return table_s->init_from_sql_statement_string(thd, true,
|
return table_s->init_from_sql_statement_string(thd, true,
|
||||||
@@ -5413,7 +5445,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
#endif // __WIN__
|
#endif // __WIN__
|
||||||
//int hdr, mxe;
|
//int hdr, mxe;
|
||||||
int port = 0, mxr = 0, rc = 0, mul = 0, lrecl = 0;
|
int port = 0, mxr = 0, rc = 0, mul = 0, lrecl = 0;
|
||||||
PCSZ tabtyp = NULL;
|
//PCSZ tabtyp = NULL;
|
||||||
#if defined(ODBC_SUPPORT)
|
#if defined(ODBC_SUPPORT)
|
||||||
POPARM sop= NULL;
|
POPARM sop= NULL;
|
||||||
PCSZ ucnc= NULL;
|
PCSZ ucnc= NULL;
|
||||||
@@ -5477,7 +5509,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
#endif // __WIN__
|
#endif // __WIN__
|
||||||
port= atoi(GetListOption(g, "port", topt->oplist, "0"));
|
port= atoi(GetListOption(g, "port", topt->oplist, "0"));
|
||||||
#if defined(ODBC_SUPPORT)
|
#if defined(ODBC_SUPPORT)
|
||||||
tabtyp = GetListOption(g, "Tabtype", topt->oplist, NULL);
|
// tabtyp = GetListOption(g, "Tabtype", topt->oplist, NULL);
|
||||||
mxr= atoi(GetListOption(g,"maxres", topt->oplist, "0"));
|
mxr= atoi(GetListOption(g,"maxres", topt->oplist, "0"));
|
||||||
cto= atoi(GetListOption(g,"ConnectTimeout", topt->oplist, "-1"));
|
cto= atoi(GetListOption(g,"ConnectTimeout", topt->oplist, "-1"));
|
||||||
qto= atoi(GetListOption(g,"QueryTimeout", topt->oplist, "-1"));
|
qto= atoi(GetListOption(g,"QueryTimeout", topt->oplist, "-1"));
|
||||||
@@ -5611,7 +5643,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
#endif // JAVA_SUPPORT
|
#endif // JAVA_SUPPORT
|
||||||
case TAB_DBF:
|
case TAB_DBF:
|
||||||
dbf = true;
|
dbf = true;
|
||||||
// Passthru
|
// fall through
|
||||||
case TAB_CSV:
|
case TAB_CSV:
|
||||||
if (!fn && fnc != FNC_NO)
|
if (!fn && fnc != FNC_NO)
|
||||||
sprintf(g->Message, "Missing %s file name", topt->type);
|
sprintf(g->Message, "Missing %s file name", topt->type);
|
||||||
@@ -5790,7 +5822,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case FNC_TABLE:
|
case FNC_TABLE:
|
||||||
qrp = JDBCTables(g, shm, tab, tabtyp, mxr, true, sjp);
|
// qrp = JDBCTables(g, shm, tab, tabtyp, mxr, true, sjp);
|
||||||
|
qrp = JDBCTables(g, shm, tab, NULL, mxr, true, sjp);
|
||||||
break;
|
break;
|
||||||
#if 0
|
#if 0
|
||||||
case FNC_DSN:
|
case FNC_DSN:
|
||||||
@@ -5845,12 +5878,12 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
case TAB_JSON:
|
case TAB_JSON:
|
||||||
qrp = JSONColumns(g, db, dsn, topt, fnc == FNC_COL);
|
qrp = JSONColumns(g, db, dsn, topt, fnc == FNC_COL);
|
||||||
break;
|
break;
|
||||||
#if defined(MONGO_SUPPORT)
|
#if defined(JAVA_SUPPORT)
|
||||||
case TAB_MONGO:
|
case TAB_MONGO:
|
||||||
url = strz(g, create_info->connect_string);
|
url = strz(g, create_info->connect_string);
|
||||||
qrp = MGOColumns(g, db, url, topt, fnc == FNC_COL);
|
qrp = MGOColumns(g, db, url, topt, fnc == FNC_COL);
|
||||||
break;
|
break;
|
||||||
#endif // MONGO_SUPPORT
|
#endif // JAVA_SUPPORT
|
||||||
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
|
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
|
||||||
case TAB_XML:
|
case TAB_XML:
|
||||||
qrp = XMLColumns(g, (char*)db, tab, topt, fnc == FNC_COL);
|
qrp = XMLColumns(g, (char*)db, tab, topt, fnc == FNC_COL);
|
||||||
@@ -6093,7 +6126,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
} // endif ok
|
} // endif ok
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
rc = HA_ERR_INTERNAL_ERROR;
|
rc = HA_ERR_INTERNAL_ERROR;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
@@ -6189,7 +6222,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
|
|
||||||
table= table_arg; // Used by called functions
|
table= table_arg; // Used by called functions
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("create: this=%p thd=%p xp=%p g=%p sqlcom=%d name=%s\n",
|
htrc("create: this=%p thd=%p xp=%p g=%p sqlcom=%d name=%s\n",
|
||||||
this, thd, xp, g, sqlcom, GetTableName());
|
this, thd, xp, g, sqlcom, GetTableName());
|
||||||
|
|
||||||
@@ -6572,7 +6605,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
|
|
||||||
} // endif sqlcom
|
} // endif sqlcom
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("xchk=%p createas=%d\n", g->Xchk, g->Createas);
|
htrc("xchk=%p createas=%d\n", g->Xchk, g->Createas);
|
||||||
|
|
||||||
if (options->zipped) {
|
if (options->zipped) {
|
||||||
@@ -6943,7 +6976,7 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table,
|
|||||||
xcp->newsep= xcp->SetName(g, GetStringOption("optname"));
|
xcp->newsep= xcp->SetName(g, GetStringOption("optname"));
|
||||||
tshp= NULL;
|
tshp= NULL;
|
||||||
|
|
||||||
if (trace && g->Xchk)
|
if (trace(1) && g->Xchk)
|
||||||
htrc(
|
htrc(
|
||||||
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n",
|
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n",
|
||||||
xcp->oldsep, xcp->newsep,
|
xcp->oldsep, xcp->newsep,
|
||||||
@@ -7207,10 +7240,11 @@ static struct st_mysql_sys_var* connect_system_variables[]= {
|
|||||||
MYSQL_SYSVAR(class_path),
|
MYSQL_SYSVAR(class_path),
|
||||||
MYSQL_SYSVAR(java_wrapper),
|
MYSQL_SYSVAR(java_wrapper),
|
||||||
#endif // JAVA_SUPPORT
|
#endif // JAVA_SUPPORT
|
||||||
#if defined(JAVA_SUPPORT)
|
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
|
||||||
//MYSQL_SYSVAR(enable_mongo),
|
MYSQL_SYSVAR(enable_mongo),
|
||||||
#endif // JAVA_SUPPORT
|
#endif // JAVA_SUPPORT || CMGO_SUPPORT
|
||||||
NULL
|
MYSQL_SYSVAR(cond_push),
|
||||||
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
maria_declare_plugin(connect)
|
maria_declare_plugin(connect)
|
||||||
@@ -7223,10 +7257,10 @@ maria_declare_plugin(connect)
|
|||||||
PLUGIN_LICENSE_GPL,
|
PLUGIN_LICENSE_GPL,
|
||||||
connect_init_func, /* Plugin Init */
|
connect_init_func, /* Plugin Init */
|
||||||
connect_done_func, /* Plugin Deinit */
|
connect_done_func, /* Plugin Deinit */
|
||||||
0x0106, /* version number (1.05) */
|
0x0107, /* version number (1.05) */
|
||||||
NULL, /* status variables */
|
NULL, /* status variables */
|
||||||
connect_system_variables, /* system variables */
|
connect_system_variables, /* system variables */
|
||||||
"1.06.0005", /* string version */
|
"1.06.0007", /* string version */
|
||||||
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
|
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
|
||||||
}
|
}
|
||||||
maria_declare_plugin_end;
|
maria_declare_plugin_end;
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
|
|||||||
next_key = §ion->key;
|
next_key = §ion->key;
|
||||||
prev_key = NULL;
|
prev_key = NULL;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("New section: '%s'\n",section->name);
|
htrc("New section: '%s'\n",section->name);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -336,7 +336,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
|
|||||||
next_key = &key->next;
|
next_key = &key->next;
|
||||||
prev_key = key;
|
prev_key = key;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("New key: name='%s', value='%s'\n",
|
htrc("New key: name='%s', value='%s'\n",
|
||||||
key->name,key->value?key->value:"(none)");
|
key->name,key->value?key->value:"(none)");
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ static BOOL PROFILE_FlushFile(void)
|
|||||||
FILE *file = NULL;
|
FILE *file = NULL;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("PROFILE_FlushFile: CurProfile=%p\n", CurProfile);
|
htrc("PROFILE_FlushFile: CurProfile=%p\n", CurProfile);
|
||||||
|
|
||||||
if (!CurProfile) {
|
if (!CurProfile) {
|
||||||
@@ -398,7 +398,7 @@ static BOOL PROFILE_FlushFile(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
} // endif !file
|
} // endif !file
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Saving '%s'\n", CurProfile->filename);
|
htrc("Saving '%s'\n", CurProfile->filename);
|
||||||
|
|
||||||
PROFILE_Save(file, CurProfile->section);
|
PROFILE_Save(file, CurProfile->section);
|
||||||
@@ -447,7 +447,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
|
|||||||
struct stat buf;
|
struct stat buf;
|
||||||
PROFILE *tempProfile;
|
PROFILE *tempProfile;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("PROFILE_Open: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
|
htrc("PROFILE_Open: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
|
||||||
|
|
||||||
/* First time around */
|
/* First time around */
|
||||||
@@ -468,7 +468,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
|
|||||||
|
|
||||||
/* Check for a match */
|
/* Check for a match */
|
||||||
for (i = 0; i < N_CACHED_PROFILES; i++) {
|
for (i = 0; i < N_CACHED_PROFILES; i++) {
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
|
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
|
||||||
|
|
||||||
if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) {
|
if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) {
|
||||||
@@ -483,11 +483,11 @@ static BOOL PROFILE_Open(LPCSTR filename)
|
|||||||
} // endif i
|
} // endif i
|
||||||
|
|
||||||
if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime) {
|
if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime) {
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("(%s): already opened (mru=%d)\n", filename, i);
|
htrc("(%s): already opened (mru=%d)\n", filename, i);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("(%s): already opened, needs refreshing (mru=%d)\n", filename, i);
|
htrc("(%s): already opened, needs refreshing (mru=%d)\n", filename, i);
|
||||||
|
|
||||||
} // endif stat
|
} // endif stat
|
||||||
@@ -535,11 +535,11 @@ static BOOL PROFILE_Open(LPCSTR filename)
|
|||||||
// strcpy(p, filename);
|
// strcpy(p, filename);
|
||||||
// _strlwr(p);
|
// _strlwr(p);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Opening %s\n", filename);
|
htrc("Opening %s\n", filename);
|
||||||
|
|
||||||
if ((file = fopen(filename, "r"))) {
|
if ((file = fopen(filename, "r"))) {
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("(%s): found it\n", filename);
|
htrc("(%s): found it\n", filename);
|
||||||
|
|
||||||
// CurProfile->unix_name = malloc(strlen(buffer)+1);
|
// CurProfile->unix_name = malloc(strlen(buffer)+1);
|
||||||
@@ -574,12 +574,12 @@ void PROFILE_Close(LPCSTR filename)
|
|||||||
struct stat buf;
|
struct stat buf;
|
||||||
PROFILE *tempProfile;
|
PROFILE *tempProfile;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("PROFILE_Close: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
|
htrc("PROFILE_Close: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
|
||||||
|
|
||||||
/* Check for a match */
|
/* Check for a match */
|
||||||
for (i = 0; i < N_CACHED_PROFILES; i++) {
|
for (i = 0; i < N_CACHED_PROFILES; i++) {
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
|
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
|
||||||
|
|
||||||
if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) {
|
if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) {
|
||||||
@@ -591,7 +591,7 @@ void PROFILE_Close(LPCSTR filename)
|
|||||||
CurProfile=tempProfile;
|
CurProfile=tempProfile;
|
||||||
} // endif i
|
} // endif i
|
||||||
|
|
||||||
if (trace > 1) {
|
if (trace(2)) {
|
||||||
if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime)
|
if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime)
|
||||||
htrc("(%s): already opened (mru=%d)\n", filename, i);
|
htrc("(%s): already opened (mru=%d)\n", filename, i);
|
||||||
else
|
else
|
||||||
@@ -620,7 +620,7 @@ void PROFILE_End(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (trace)
|
if (trace(3))
|
||||||
htrc("PROFILE_End: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
|
htrc("PROFILE_End: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
|
||||||
|
|
||||||
if (!CurProfile) // Sergey Vojtovich
|
if (!CurProfile) // Sergey Vojtovich
|
||||||
@@ -628,7 +628,7 @@ void PROFILE_End(void)
|
|||||||
|
|
||||||
/* Close all opened files and free the cache structure */
|
/* Close all opened files and free the cache structure */
|
||||||
for (i = 0; i < N_CACHED_PROFILES; i++) {
|
for (i = 0; i < N_CACHED_PROFILES; i++) {
|
||||||
if (trace)
|
if (trace(3))
|
||||||
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
|
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
|
||||||
|
|
||||||
// CurProfile = MRUProfile[i]; Sergey Vojtovich
|
// CurProfile = MRUProfile[i]; Sergey Vojtovich
|
||||||
@@ -894,7 +894,7 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len)
|
|||||||
uint f,l;
|
uint f,l;
|
||||||
PROFILESECTION *section;
|
PROFILESECTION *section;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("GetSectionNames: buffer=%p len=%u\n", buffer, len);
|
htrc("GetSectionNames: buffer=%p len=%u\n", buffer, len);
|
||||||
|
|
||||||
if (!buffer || !len)
|
if (!buffer || !len)
|
||||||
@@ -909,17 +909,17 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len)
|
|||||||
buf = buffer;
|
buf = buffer;
|
||||||
section = CurProfile->section;
|
section = CurProfile->section;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("GetSectionNames: section=%p\n", section);
|
htrc("GetSectionNames: section=%p\n", section);
|
||||||
|
|
||||||
while (section != NULL) {
|
while (section != NULL) {
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("section=%s\n", section->name);
|
htrc("section=%s\n", section->name);
|
||||||
|
|
||||||
if (section->name[0]) {
|
if (section->name[0]) {
|
||||||
l = strlen(section->name) + 1;
|
l = strlen(section->name) + 1;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("l=%u f=%u\n", l, f);
|
htrc("l=%u f=%u\n", l, f);
|
||||||
|
|
||||||
if (l > f) {
|
if (l > f) {
|
||||||
@@ -982,7 +982,7 @@ static int PROFILE_GetString(LPCSTR section, LPCSTR key_name,
|
|||||||
key = PROFILE_Find(&CurProfile->section, section, key_name, FALSE, FALSE);
|
key = PROFILE_Find(&CurProfile->section, section, key_name, FALSE, FALSE);
|
||||||
PROFILE_CopyEntry(buffer, (key && key->value) ? key->value : def_val, len, FALSE);
|
PROFILE_CopyEntry(buffer, (key && key->value) ? key->value : def_val, len, FALSE);
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("('%s','%s','%s'): returning '%s'\n",
|
htrc("('%s','%s','%s'): returning '%s'\n",
|
||||||
section, key_name, def_val, buffer );
|
section, key_name, def_val, buffer );
|
||||||
|
|
||||||
@@ -1010,7 +1010,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
|
|||||||
LPCSTR value, BOOL create_always)
|
LPCSTR value, BOOL create_always)
|
||||||
{
|
{
|
||||||
if (!key_name) { /* Delete a whole section */
|
if (!key_name) { /* Delete a whole section */
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Deleting('%s')\n", section_name);
|
htrc("Deleting('%s')\n", section_name);
|
||||||
|
|
||||||
CurProfile->changed |= PROFILE_DeleteSection(&CurProfile->section,
|
CurProfile->changed |= PROFILE_DeleteSection(&CurProfile->section,
|
||||||
@@ -1018,7 +1018,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
|
|||||||
return TRUE; /* Even if PROFILE_DeleteSection() has failed,
|
return TRUE; /* Even if PROFILE_DeleteSection() has failed,
|
||||||
this is not an error on application's level.*/
|
this is not an error on application's level.*/
|
||||||
} else if (!value) { /* Delete a key */
|
} else if (!value) { /* Delete a key */
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Deleting('%s','%s')\n", section_name, key_name);
|
htrc("Deleting('%s','%s')\n", section_name, key_name);
|
||||||
|
|
||||||
CurProfile->changed |= PROFILE_DeleteKey(&CurProfile->section,
|
CurProfile->changed |= PROFILE_DeleteKey(&CurProfile->section,
|
||||||
@@ -1027,7 +1027,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
|
|||||||
} else { /* Set the key value */
|
} else { /* Set the key value */
|
||||||
PROFILEKEY *key = PROFILE_Find(&CurProfile->section, section_name,
|
PROFILEKEY *key = PROFILE_Find(&CurProfile->section, section_name,
|
||||||
key_name, TRUE, create_always);
|
key_name, TRUE, create_always);
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("Setting('%s','%s','%s')\n", section_name, key_name, value);
|
htrc("Setting('%s','%s','%s')\n", section_name, key_name, value);
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
@@ -1040,17 +1040,17 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
|
|||||||
value++;
|
value++;
|
||||||
|
|
||||||
if (!strcmp(key->value, value)) {
|
if (!strcmp(key->value, value)) {
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" no change needed\n" );
|
htrc(" no change needed\n" );
|
||||||
|
|
||||||
return TRUE; /* No change needed */
|
return TRUE; /* No change needed */
|
||||||
} // endif value
|
} // endif value
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc(" replacing '%s'\n", key->value);
|
htrc(" replacing '%s'\n", key->value);
|
||||||
|
|
||||||
free(key->value);
|
free(key->value);
|
||||||
} else if (trace > 1)
|
} else if (trace(2))
|
||||||
htrc(" creating key\n" );
|
htrc(" creating key\n" );
|
||||||
|
|
||||||
key->value = (char*)malloc(strlen(value) + 1);
|
key->value = (char*)malloc(strlen(value) + 1);
|
||||||
@@ -1345,7 +1345,7 @@ GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
|
|||||||
{
|
{
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace(2))
|
||||||
htrc("GPPSN: filename=%s\n", filename);
|
htrc("GPPSN: filename=%s\n", filename);
|
||||||
|
|
||||||
EnterCriticalSection(&PROFILE_CritSect);
|
EnterCriticalSection(&PROFILE_CritSect);
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ bool JAVAConn::GetJVM(PGLOBAL g)
|
|||||||
bool JAVAConn::Open(PGLOBAL g)
|
bool JAVAConn::Open(PGLOBAL g)
|
||||||
{
|
{
|
||||||
bool brc = true, err = false;
|
bool brc = true, err = false;
|
||||||
jboolean jt = (trace > 0);
|
jboolean jt = (trace(1));
|
||||||
|
|
||||||
// Link or check whether jvm library was linked
|
// Link or check whether jvm library was linked
|
||||||
if (GetJVM(g))
|
if (GetJVM(g))
|
||||||
@@ -430,7 +430,7 @@ bool JAVAConn::Open(PGLOBAL g)
|
|||||||
jpop->Append(cp);
|
jpop->Append(cp);
|
||||||
} // endif cp
|
} // endif cp
|
||||||
|
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc("ClassPath=%s\n", ClassPath);
|
htrc("ClassPath=%s\n", ClassPath);
|
||||||
htrc("CLASSPATH=%s\n", cp);
|
htrc("CLASSPATH=%s\n", cp);
|
||||||
htrc("%s\n", jpop->GetStr());
|
htrc("%s\n", jpop->GetStr());
|
||||||
@@ -486,7 +486,7 @@ bool JAVAConn::Open(PGLOBAL g)
|
|||||||
break;
|
break;
|
||||||
} // endswitch rc
|
} // endswitch rc
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
if (brc)
|
if (brc)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/************ Jdbconn C++ Functions Source Code File (.CPP) ************/
|
/************ Jdbconn C++ Functions Source Code File (.CPP) ************/
|
||||||
/* Name: JDBCONN.CPP Version 1.1 */
|
/* Name: JDBCONN.CPP Version 1.2 */
|
||||||
/* */
|
/* */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */
|
/* (C) Copyright to the author Olivier BERTRAND 2016-2018 */
|
||||||
/* */
|
/* */
|
||||||
/* This file contains the JDBC connection classes functions. */
|
/* This file contains the JDBC connection classes functions. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -116,10 +116,26 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v)
|
|||||||
return TYPE_ERROR;
|
return TYPE_ERROR;
|
||||||
else
|
else
|
||||||
len = MY_MIN(abs(len), GetConvSize());
|
len = MY_MIN(abs(len), GetConvSize());
|
||||||
|
|
||||||
// Pass through
|
// Pass through
|
||||||
case 12: // VARCHAR
|
case 12: // VARCHAR
|
||||||
|
if (tn && !stricmp(tn, "TEXT"))
|
||||||
|
// Postgresql returns 12 for TEXT
|
||||||
|
if (GetTypeConv() == TPC_NO)
|
||||||
|
return TYPE_ERROR;
|
||||||
|
|
||||||
|
// Postgresql can return this
|
||||||
|
if (len == 0x7FFFFFFF)
|
||||||
|
len = GetConvSize();
|
||||||
|
|
||||||
|
// Pass through
|
||||||
case -9: // NVARCHAR (unicode)
|
case -9: // NVARCHAR (unicode)
|
||||||
|
// Postgresql can return this when size is unknown
|
||||||
|
if (len == 0x7FFFFFFF)
|
||||||
|
len = GetConvSize();
|
||||||
|
|
||||||
v = 'V';
|
v = 'V';
|
||||||
|
// Pass through
|
||||||
case 1: // CHAR
|
case 1: // CHAR
|
||||||
case -15: // NCHAR (unicode)
|
case -15: // NCHAR (unicode)
|
||||||
case -8: // ROWID
|
case -8: // ROWID
|
||||||
@@ -154,13 +170,13 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v)
|
|||||||
case 91: // DATE, YEAR
|
case 91: // DATE, YEAR
|
||||||
type = TYPE_DATE;
|
type = TYPE_DATE;
|
||||||
|
|
||||||
if (!tn || toupper(tn[0]) != 'Y') {
|
if (!tn || toupper(tn[0]) != 'Y') {
|
||||||
len = 10;
|
len = 10;
|
||||||
v = 'D';
|
v = 'D';
|
||||||
} else {
|
} else {
|
||||||
len = 4;
|
len = 4;
|
||||||
v = 'Y';
|
v = 'Y';
|
||||||
} // endif len
|
} // endif len
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 92: // TIME
|
case 92: // TIME
|
||||||
@@ -192,6 +208,104 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v)
|
|||||||
return type;
|
return type;
|
||||||
} // end of TranslateJDBCType
|
} // end of TranslateJDBCType
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* A helper class to split an optionally qualified table name into */
|
||||||
|
/* components. */
|
||||||
|
/* These formats are understood: */
|
||||||
|
/* "CatalogName.SchemaName.TableName" */
|
||||||
|
/* "SchemaName.TableName" */
|
||||||
|
/* "TableName" */
|
||||||
|
/***********************************************************************/
|
||||||
|
class SQLQualifiedName {
|
||||||
|
static const uint max_parts = 3; // Catalog.Schema.Table
|
||||||
|
MYSQL_LEX_STRING m_part[max_parts];
|
||||||
|
char m_buf[512];
|
||||||
|
|
||||||
|
void lex_string_set(MYSQL_LEX_STRING *S, char *str, size_t length)
|
||||||
|
{
|
||||||
|
S->str = str;
|
||||||
|
S->length = length;
|
||||||
|
} // end of lex_string_set
|
||||||
|
|
||||||
|
void lex_string_shorten_down(MYSQL_LEX_STRING *S, size_t offs)
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(offs <= S->length);
|
||||||
|
S->str += offs;
|
||||||
|
S->length -= offs;
|
||||||
|
} // end of lex_string_shorten_down
|
||||||
|
|
||||||
|
/*********************************************************************/
|
||||||
|
/* Find the rightmost '.' delimiter and return the length */
|
||||||
|
/* of the qualifier, including the rightmost '.' delimier. */
|
||||||
|
/* For example, for the string {"a.b.c",5} it will return 4, */
|
||||||
|
/* which is the length of the qualifier "a.b." */
|
||||||
|
/*********************************************************************/
|
||||||
|
size_t lex_string_find_qualifier(MYSQL_LEX_STRING *S)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for (i = S->length; i > 0; i--)
|
||||||
|
{
|
||||||
|
if (S->str[i - 1] == '.')
|
||||||
|
{
|
||||||
|
S->str[i - 1] = '\0';
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
} // end of lex_string_find_qualifier
|
||||||
|
|
||||||
|
public:
|
||||||
|
/*********************************************************************/
|
||||||
|
/* Initialize to the given optionally qualified name. */
|
||||||
|
/* NULL pointer in "name" is supported. */
|
||||||
|
/* name qualifier has precedence over schema. */
|
||||||
|
/*********************************************************************/
|
||||||
|
SQLQualifiedName(JCATPARM *cap)
|
||||||
|
{
|
||||||
|
const char *name = (const char *)cap->Tab;
|
||||||
|
char *db = (char *)cap->DB;
|
||||||
|
size_t len, i;
|
||||||
|
|
||||||
|
// Initialize the parts
|
||||||
|
for (i = 0; i < max_parts; i++)
|
||||||
|
lex_string_set(&m_part[i], NULL, 0);
|
||||||
|
|
||||||
|
if (name) {
|
||||||
|
// Initialize the first (rightmost) part
|
||||||
|
lex_string_set(&m_part[0], m_buf,
|
||||||
|
strmake(m_buf, name, sizeof(m_buf) - 1) - m_buf);
|
||||||
|
|
||||||
|
// Initialize the other parts, if exist.
|
||||||
|
for (i = 1; i < max_parts; i++) {
|
||||||
|
if (!(len = lex_string_find_qualifier(&m_part[i - 1])))
|
||||||
|
break;
|
||||||
|
|
||||||
|
lex_string_set(&m_part[i], m_part[i - 1].str, len - 1);
|
||||||
|
lex_string_shorten_down(&m_part[i - 1], len);
|
||||||
|
} // endfor i
|
||||||
|
|
||||||
|
} // endif name
|
||||||
|
|
||||||
|
// If it was not specified, set schema as the passed db name
|
||||||
|
if (db && !m_part[1].length)
|
||||||
|
lex_string_set(&m_part[1], db, strlen(db));
|
||||||
|
|
||||||
|
} // end of SQLQualifiedName
|
||||||
|
|
||||||
|
char *ptr(uint i)
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(i < max_parts);
|
||||||
|
return (char *)(m_part[i].length ? m_part[i].str : NULL);
|
||||||
|
} // end of ptr
|
||||||
|
|
||||||
|
size_t length(uint i)
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(i < max_parts);
|
||||||
|
return m_part[i].length;
|
||||||
|
} // end of length
|
||||||
|
|
||||||
|
}; // end of class SQLQualifiedName
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Allocate the structure used to refer to the result set. */
|
/* Allocate the structure used to refer to the result set. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -270,7 +384,7 @@ PQRYRES JDBCColumns(PGLOBAL g, PCSZ db, PCSZ table, PCSZ colpat,
|
|||||||
length[11] = 255;
|
length[11] = 255;
|
||||||
} // endif jcp
|
} // endif jcp
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("JDBCColumns: max=%d len=%d,%d,%d,%d\n",
|
htrc("JDBCColumns: max=%d len=%d,%d,%d,%d\n",
|
||||||
maxres, length[0], length[1], length[2], length[3]);
|
maxres, length[0], length[1], length[2], length[3]);
|
||||||
|
|
||||||
@@ -287,7 +401,7 @@ PQRYRES JDBCColumns(PGLOBAL g, PCSZ db, PCSZ table, PCSZ colpat,
|
|||||||
if (info || !qrp) // Info table
|
if (info || !qrp) // Info table
|
||||||
return qrp;
|
return qrp;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Getting col results ncol=%d\n", qrp->Nbcol);
|
htrc("Getting col results ncol=%d\n", qrp->Nbcol);
|
||||||
|
|
||||||
if (!(cap = AllocCatInfo(g, JCAT_COL, db, table, qrp)))
|
if (!(cap = AllocCatInfo(g, JCAT_COL, db, table, qrp)))
|
||||||
@@ -303,7 +417,7 @@ PQRYRES JDBCColumns(PGLOBAL g, PCSZ db, PCSZ table, PCSZ colpat,
|
|||||||
qrp->Nblin = n;
|
qrp->Nblin = n;
|
||||||
// ResetNullValues(cap);
|
// ResetNullValues(cap);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Columns: NBCOL=%d NBLIN=%d\n", qrp->Nbcol, qrp->Nblin);
|
htrc("Columns: NBCOL=%d NBLIN=%d\n", qrp->Nbcol, qrp->Nblin);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -394,7 +508,7 @@ PQRYRES JDBCTables(PGLOBAL g, PCSZ db, PCSZ tabpat, PCSZ tabtyp,
|
|||||||
length[4] = 255;
|
length[4] = 255;
|
||||||
} // endif info
|
} // endif info
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("JDBCTables: max=%d len=%d,%d\n", maxres, length[0], length[1]);
|
htrc("JDBCTables: max=%d len=%d,%d\n", maxres, length[0], length[1]);
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
@@ -417,7 +531,7 @@ PQRYRES JDBCTables(PGLOBAL g, PCSZ db, PCSZ tabpat, PCSZ tabtyp,
|
|||||||
|
|
||||||
cap->Pat = tabtyp;
|
cap->Pat = tabtyp;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Getting table results ncol=%d\n", cap->Qrp->Nbcol);
|
htrc("Getting table results ncol=%d\n", cap->Qrp->Nbcol);
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
@@ -427,7 +541,7 @@ PQRYRES JDBCTables(PGLOBAL g, PCSZ db, PCSZ tabpat, PCSZ tabtyp,
|
|||||||
qrp->Nblin = n;
|
qrp->Nblin = n;
|
||||||
// ResetNullValues(cap);
|
// ResetNullValues(cap);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Tables: NBCOL=%d NBLIN=%d\n", qrp->Nbcol, qrp->Nblin);
|
htrc("Tables: NBCOL=%d NBLIN=%d\n", qrp->Nbcol, qrp->Nblin);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -475,7 +589,7 @@ PQRYRES JDBCDrivers(PGLOBAL g, int maxres, bool info)
|
|||||||
} else
|
} else
|
||||||
maxres = 0;
|
maxres = 0;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("JDBCDrivers: max=%d len=%d\n", maxres, length[0]);
|
htrc("JDBCDrivers: max=%d len=%d\n", maxres, length[0]);
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
@@ -519,7 +633,7 @@ JDBConn::JDBConn(PGLOBAL g, PCSZ wrapper) : JAVAConn(g, wrapper)
|
|||||||
xqid = xuid = xid = grs = readid = fetchid = typid = errid = nullptr;
|
xqid = xuid = xid = grs = readid = fetchid = typid = errid = nullptr;
|
||||||
prepid = xpid = pcid = nullptr;
|
prepid = xpid = pcid = nullptr;
|
||||||
chrfldid = intfldid = dblfldid = fltfldid = bigfldid = nullptr;
|
chrfldid = intfldid = dblfldid = fltfldid = bigfldid = nullptr;
|
||||||
objfldid = datfldid = timfldid = tspfldid = nullptr;
|
objfldid = datfldid = timfldid = tspfldid = uidfldid = nullptr;
|
||||||
DiscFunc = "JdbcDisconnect";
|
DiscFunc = "JdbcDisconnect";
|
||||||
m_Ncol = 0;
|
m_Ncol = 0;
|
||||||
m_Aff = 0;
|
m_Aff = 0;
|
||||||
@@ -535,12 +649,84 @@ JDBConn::JDBConn(PGLOBAL g, PCSZ wrapper) : JAVAConn(g, wrapper)
|
|||||||
m_IDQuoteChar[1] = 0;
|
m_IDQuoteChar[1] = 0;
|
||||||
} // end of JDBConn
|
} // end of JDBConn
|
||||||
|
|
||||||
//JDBConn::~JDBConn()
|
/***********************************************************************/
|
||||||
// {
|
/* Search for UUID columns. */
|
||||||
//if (Connected())
|
/***********************************************************************/
|
||||||
// EndCom();
|
bool JDBConn::SetUUID(PGLOBAL g, PTDBJDBC tjp)
|
||||||
|
{
|
||||||
|
int ncol, ctyp;
|
||||||
|
bool brc = true;
|
||||||
|
PCSZ fnc = "GetColumns";
|
||||||
|
PCOL colp;
|
||||||
|
JCATPARM *cap;
|
||||||
|
//jint jtyp;
|
||||||
|
jboolean rc = false;
|
||||||
|
jobjectArray parms;
|
||||||
|
jmethodID catid = nullptr;
|
||||||
|
|
||||||
// } // end of ~JDBConn
|
if (gmID(g, catid, fnc, "([Ljava/lang/String;)I"))
|
||||||
|
return true;
|
||||||
|
else if (gmID(g, intfldid, "IntField", "(ILjava/lang/String;)I"))
|
||||||
|
return true;
|
||||||
|
else if (gmID(g, readid, "ReadNext", "()I"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
cap = AllocCatInfo(g, JCAT_COL, tjp->Schema, tjp->TableName, NULL);
|
||||||
|
SQLQualifiedName name(cap);
|
||||||
|
|
||||||
|
// Build the java string array
|
||||||
|
parms = env->NewObjectArray(4, env->FindClass("java/lang/String"), NULL);
|
||||||
|
env->SetObjectArrayElement(parms, 0, env->NewStringUTF(name.ptr(2)));
|
||||||
|
env->SetObjectArrayElement(parms, 1, env->NewStringUTF(name.ptr(1)));
|
||||||
|
env->SetObjectArrayElement(parms, 2, env->NewStringUTF(name.ptr(0)));
|
||||||
|
|
||||||
|
for (colp = tjp->GetColumns(); colp; colp = colp->GetNext()) {
|
||||||
|
env->SetObjectArrayElement(parms, 3, env->NewStringUTF(colp->GetName()));
|
||||||
|
ncol = env->CallIntMethod(job, catid, parms);
|
||||||
|
|
||||||
|
if (Check(ncol)) {
|
||||||
|
sprintf(g->Message, "%s: %s", fnc, Msg);
|
||||||
|
goto err;
|
||||||
|
} // endif Check
|
||||||
|
|
||||||
|
rc = env->CallBooleanMethod(job, readid);
|
||||||
|
|
||||||
|
if (Check(rc)) {
|
||||||
|
sprintf(g->Message, "ReadNext: %s", Msg);
|
||||||
|
goto err;
|
||||||
|
} else if (rc == 0) {
|
||||||
|
sprintf(g->Message, "table %s does not exist", tjp->TableName);
|
||||||
|
goto err;
|
||||||
|
} // endif rc
|
||||||
|
|
||||||
|
// Returns 666 is case of error
|
||||||
|
//jtyp = env->CallIntMethod(job, typid, 5, nullptr);
|
||||||
|
|
||||||
|
//if (Check((jtyp == 666) ? -1 : 1)) {
|
||||||
|
// sprintf(g->Message, "Getting jtyp: %s", Msg);
|
||||||
|
// goto err;
|
||||||
|
//} // endif ctyp
|
||||||
|
|
||||||
|
ctyp = (int)env->CallIntMethod(job, intfldid, 5, nullptr);
|
||||||
|
|
||||||
|
if (Check(ctyp)) {
|
||||||
|
sprintf(g->Message, "Getting ctyp: %s", Msg);
|
||||||
|
goto err;
|
||||||
|
} // endif ctyp
|
||||||
|
|
||||||
|
if (ctyp == 1111)
|
||||||
|
((PJDBCCOL)colp)->uuid = true;
|
||||||
|
|
||||||
|
} // endfor colp
|
||||||
|
|
||||||
|
// All is Ok
|
||||||
|
brc = false;
|
||||||
|
|
||||||
|
err:
|
||||||
|
// Not used anymore
|
||||||
|
env->DeleteLocalRef(parms);
|
||||||
|
return brc;
|
||||||
|
} // end of SetUUID
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Utility routine. */
|
/* Utility routine. */
|
||||||
@@ -586,7 +772,7 @@ bool JDBConn::Connect(PJPARM sop)
|
|||||||
int irc = RC_FX;
|
int irc = RC_FX;
|
||||||
bool err = false;
|
bool err = false;
|
||||||
jint rc;
|
jint rc;
|
||||||
jboolean jt = (trace > 0);
|
jboolean jt = (trace(1));
|
||||||
PGLOBAL& g = m_G;
|
PGLOBAL& g = m_G;
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -770,6 +956,7 @@ int JDBConn::Rewind(PCSZ sql)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
||||||
{
|
{
|
||||||
|
const char *field;
|
||||||
PGLOBAL& g = m_G;
|
PGLOBAL& g = m_G;
|
||||||
jint ctyp;
|
jint ctyp;
|
||||||
jstring cn, jn = nullptr;
|
jstring cn, jn = nullptr;
|
||||||
@@ -793,6 +980,11 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
|||||||
if (!gmID(g, objfldid, "ObjectField", "(ILjava/lang/String;)Ljava/lang/Object;")) {
|
if (!gmID(g, objfldid, "ObjectField", "(ILjava/lang/String;)Ljava/lang/Object;")) {
|
||||||
jb = env->CallObjectMethod(job, objfldid, (jint)rank, jn);
|
jb = env->CallObjectMethod(job, objfldid, (jint)rank, jn);
|
||||||
|
|
||||||
|
if (Check(0)) {
|
||||||
|
sprintf(g->Message, "Getting jp: %s", Msg);
|
||||||
|
throw (int)TYPE_AM_JDBC;
|
||||||
|
} // endif Check
|
||||||
|
|
||||||
if (jb == nullptr) {
|
if (jb == nullptr) {
|
||||||
val->Reset();
|
val->Reset();
|
||||||
val->SetNull(true);
|
val->SetNull(true);
|
||||||
@@ -818,7 +1010,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
|||||||
cn = nullptr;
|
cn = nullptr;
|
||||||
|
|
||||||
if (cn) {
|
if (cn) {
|
||||||
const char *field = env->GetStringUTFChars(cn, (jboolean)false);
|
field = env->GetStringUTFChars(cn, (jboolean)false);
|
||||||
val->SetValue_psz((PSZ)field);
|
val->SetValue_psz((PSZ)field);
|
||||||
} else
|
} else
|
||||||
val->Reset();
|
val->Reset();
|
||||||
@@ -885,6 +1077,19 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
|||||||
break;
|
break;
|
||||||
case java.sql.Types.BOOLEAN:
|
case java.sql.Types.BOOLEAN:
|
||||||
System.out.print(jdi.BooleanField(i)); */
|
System.out.print(jdi.BooleanField(i)); */
|
||||||
|
case 1111: // UUID
|
||||||
|
if (!gmID(g, uidfldid, "UuidField", "(ILjava/lang/String;)Ljava/lang/String;"))
|
||||||
|
cn = (jstring)env->CallObjectMethod(job, uidfldid, (jint)rank, jn);
|
||||||
|
else
|
||||||
|
cn = nullptr;
|
||||||
|
|
||||||
|
if (cn) {
|
||||||
|
const char *field = env->GetStringUTFChars(cn, (jboolean)false);
|
||||||
|
val->SetValue_psz((PSZ)field);
|
||||||
|
} else
|
||||||
|
val->Reset();
|
||||||
|
|
||||||
|
break;
|
||||||
case 0: // NULL
|
case 0: // NULL
|
||||||
val->SetNull(true);
|
val->SetNull(true);
|
||||||
// passthru
|
// passthru
|
||||||
@@ -1055,7 +1260,14 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||||||
if (gmID(g, setid, "SetNullParm", "(II)I"))
|
if (gmID(g, setid, "SetNullParm", "(II)I"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
jrc = env->CallIntMethod(job, setid, i, (jint)GetJDBCType(val->GetType()));
|
jrc = env->CallIntMethod(job, setid, i,
|
||||||
|
(colp->uuid ? 1111 : (jint)GetJDBCType(val->GetType())));
|
||||||
|
} else if (colp->uuid) {
|
||||||
|
if (gmID(g, setid, "SetUuidParm", "(ILjava/lang/String;)V"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
jst = env->NewStringUTF(val->GetCharValue());
|
||||||
|
env->CallVoidMethod(job, setid, i, jst);
|
||||||
} else switch (val->GetType()) {
|
} else switch (val->GetType()) {
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
if (gmID(g, setid, "SetStringParm", "(ILjava/lang/String;)V"))
|
if (gmID(g, setid, "SetStringParm", "(ILjava/lang/String;)V"))
|
||||||
@@ -1274,105 +1486,6 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||||||
return qrp;
|
return qrp;
|
||||||
} // end of GetMetaData
|
} // end of GetMetaData
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* A helper class to split an optionally qualified table name into */
|
|
||||||
/* components. */
|
|
||||||
/* These formats are understood: */
|
|
||||||
/* "CatalogName.SchemaName.TableName" */
|
|
||||||
/* "SchemaName.TableName" */
|
|
||||||
/* "TableName" */
|
|
||||||
/***********************************************************************/
|
|
||||||
class SQLQualifiedName
|
|
||||||
{
|
|
||||||
static const uint max_parts= 3; // Catalog.Schema.Table
|
|
||||||
MYSQL_LEX_STRING m_part[max_parts];
|
|
||||||
char m_buf[512];
|
|
||||||
|
|
||||||
void lex_string_set(MYSQL_LEX_STRING *S, char *str, size_t length)
|
|
||||||
{
|
|
||||||
S->str= str;
|
|
||||||
S->length= length;
|
|
||||||
} // end of lex_string_set
|
|
||||||
|
|
||||||
void lex_string_shorten_down(MYSQL_LEX_STRING *S, size_t offs)
|
|
||||||
{
|
|
||||||
DBUG_ASSERT(offs <= S->length);
|
|
||||||
S->str+= offs;
|
|
||||||
S->length-= offs;
|
|
||||||
} // end of lex_string_shorten_down
|
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
/* Find the rightmost '.' delimiter and return the length */
|
|
||||||
/* of the qualifier, including the rightmost '.' delimier. */
|
|
||||||
/* For example, for the string {"a.b.c",5} it will return 4, */
|
|
||||||
/* which is the length of the qualifier "a.b." */
|
|
||||||
/*********************************************************************/
|
|
||||||
size_t lex_string_find_qualifier(MYSQL_LEX_STRING *S)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
for (i= S->length; i > 0; i--)
|
|
||||||
{
|
|
||||||
if (S->str[i - 1] == '.')
|
|
||||||
{
|
|
||||||
S->str[i - 1]= '\0';
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
} // end of lex_string_find_qualifier
|
|
||||||
|
|
||||||
public:
|
|
||||||
/*********************************************************************/
|
|
||||||
/* Initialize to the given optionally qualified name. */
|
|
||||||
/* NULL pointer in "name" is supported. */
|
|
||||||
/* name qualifier has precedence over schema. */
|
|
||||||
/*********************************************************************/
|
|
||||||
SQLQualifiedName(JCATPARM *cap)
|
|
||||||
{
|
|
||||||
const char *name = (const char *)cap->Tab;
|
|
||||||
char *db = (char *)cap->DB;
|
|
||||||
size_t len, i;
|
|
||||||
|
|
||||||
// Initialize the parts
|
|
||||||
for (i = 0; i < max_parts; i++)
|
|
||||||
lex_string_set(&m_part[i], NULL, 0);
|
|
||||||
|
|
||||||
if (name) {
|
|
||||||
// Initialize the first (rightmost) part
|
|
||||||
lex_string_set(&m_part[0], m_buf,
|
|
||||||
strmake(m_buf, name, sizeof(m_buf) - 1) - m_buf);
|
|
||||||
|
|
||||||
// Initialize the other parts, if exist.
|
|
||||||
for (i= 1; i < max_parts; i++) {
|
|
||||||
if (!(len= lex_string_find_qualifier(&m_part[i - 1])))
|
|
||||||
break;
|
|
||||||
|
|
||||||
lex_string_set(&m_part[i], m_part[i - 1].str, len - 1);
|
|
||||||
lex_string_shorten_down(&m_part[i - 1], len);
|
|
||||||
} // endfor i
|
|
||||||
|
|
||||||
} // endif name
|
|
||||||
|
|
||||||
// If it was not specified, set schema as the passed db name
|
|
||||||
if (db && !m_part[1].length)
|
|
||||||
lex_string_set(&m_part[1], db, strlen(db));
|
|
||||||
|
|
||||||
} // end of SQLQualifiedName
|
|
||||||
|
|
||||||
char *ptr(uint i)
|
|
||||||
{
|
|
||||||
DBUG_ASSERT(i < max_parts);
|
|
||||||
return (char *)(m_part[i].length ? m_part[i].str : NULL);
|
|
||||||
} // end of ptr
|
|
||||||
|
|
||||||
size_t length(uint i)
|
|
||||||
{
|
|
||||||
DBUG_ASSERT(i < max_parts);
|
|
||||||
return m_part[i].length;
|
|
||||||
} // end of length
|
|
||||||
|
|
||||||
}; // end of class SQLQualifiedName
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Allocate recset and call SQLTables, SQLColumns or SQLPrimaryKeys. */
|
/* Allocate recset and call SQLTables, SQLColumns or SQLPrimaryKeys. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -1443,7 +1556,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||||||
// Not used anymore
|
// Not used anymore
|
||||||
env->DeleteLocalRef(parms);
|
env->DeleteLocalRef(parms);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Method %s returned %d columns\n", fnc, ncol);
|
htrc("Method %s returned %d columns\n", fnc, ncol);
|
||||||
|
|
||||||
// n because we no more ignore the first column
|
// n because we no more ignore the first column
|
||||||
@@ -1488,7 +1601,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||||||
sprintf(g->Message, "Fetch: %s", Msg);
|
sprintf(g->Message, "Fetch: %s", Msg);
|
||||||
return -1;
|
return -1;
|
||||||
} if (rc == 0) {
|
} if (rc == 0) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("End of fetches i=%d\n", i);
|
htrc("End of fetches i=%d\n", i);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public:
|
|||||||
// Attributes
|
// Attributes
|
||||||
public:
|
public:
|
||||||
char *GetQuoteChar(void) { return m_IDQuoteChar; }
|
char *GetQuoteChar(void) { return m_IDQuoteChar; }
|
||||||
|
bool SetUUID(PGLOBAL g, PTDBJDBC tjp);
|
||||||
virtual int GetMaxValue(int infotype);
|
virtual int GetMaxValue(int infotype);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -58,13 +59,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
#if 0
|
|
||||||
JavaVM *jvm; // Pointer to the JVM (Java Virtual Machine)
|
|
||||||
JNIEnv *env; // Pointer to native interface
|
|
||||||
jclass jdi; // Pointer to the java wrapper class
|
|
||||||
jobject job; // The java wrapper class object
|
|
||||||
jmethodID errid; // The GetErrmsg method ID
|
|
||||||
#endif // 0
|
|
||||||
jmethodID xqid; // The ExecuteQuery method ID
|
jmethodID xqid; // The ExecuteQuery method ID
|
||||||
jmethodID xuid; // The ExecuteUpdate method ID
|
jmethodID xuid; // The ExecuteUpdate method ID
|
||||||
jmethodID xid; // The Execute method ID
|
jmethodID xid; // The Execute method ID
|
||||||
@@ -84,8 +78,7 @@ protected:
|
|||||||
jmethodID timfldid; // The TimeField method ID
|
jmethodID timfldid; // The TimeField method ID
|
||||||
jmethodID tspfldid; // The TimestampField method ID
|
jmethodID tspfldid; // The TimestampField method ID
|
||||||
jmethodID bigfldid; // The BigintField method ID
|
jmethodID bigfldid; // The BigintField method ID
|
||||||
// PCSZ Msg;
|
jmethodID uidfldid; // The UuidField method ID
|
||||||
// PCSZ m_Wrap;
|
|
||||||
char m_IDQuoteChar[2];
|
char m_IDQuoteChar[2];
|
||||||
PCSZ m_Pwd;
|
PCSZ m_Pwd;
|
||||||
int m_Ncol;
|
int m_Ncol;
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ int JMGFAM::ReadBuffer(PGLOBAL g)
|
|||||||
PSZ str = Jcp->GetDocument();
|
PSZ str = Jcp->GetDocument();
|
||||||
|
|
||||||
if (str) {
|
if (str) {
|
||||||
if (trace == 1)
|
if (trace(1))
|
||||||
htrc("%s\n", str);
|
htrc("%s\n", str);
|
||||||
|
|
||||||
strncpy(Tdbp->GetLine(), str, Lrecl);
|
strncpy(Tdbp->GetLine(), str, Lrecl);
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
|
|||||||
all = true;
|
all = true;
|
||||||
|
|
||||||
if (pipe && Options) {
|
if (pipe && Options) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Pipeline: %s\n", Options);
|
htrc("Pipeline: %s\n", Options);
|
||||||
|
|
||||||
p = strrchr(Options, ']');
|
p = strrchr(Options, ']');
|
||||||
@@ -312,13 +312,13 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
|
|||||||
*(char*)p = ']'; // Restore Colist for discovery
|
*(char*)p = ']'; // Restore Colist for discovery
|
||||||
p = s->GetStr();
|
p = s->GetStr();
|
||||||
|
|
||||||
if (trace)
|
if (trace(33))
|
||||||
htrc("New Pipeline: %s\n", p);
|
htrc("New Pipeline: %s\n", p);
|
||||||
|
|
||||||
return AggregateCollection(p);
|
return AggregateCollection(p);
|
||||||
} else {
|
} else {
|
||||||
if (filter || filp) {
|
if (filter || filp) {
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
if (filter)
|
if (filter)
|
||||||
htrc("Filter: %s\n", filter);
|
htrc("Filter: %s\n", filter);
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
|
|||||||
tdbp->SetFilter(NULL); // Not needed anymore
|
tdbp->SetFilter(NULL); // Not needed anymore
|
||||||
} // endif To_Filter
|
} // endif To_Filter
|
||||||
|
|
||||||
if (trace)
|
if (trace(33))
|
||||||
htrc("selector: %s\n", s->GetStr());
|
htrc("selector: %s\n", s->GetStr());
|
||||||
|
|
||||||
s->Resize(s->GetLength() + 1);
|
s->Resize(s->GetLength() + 1);
|
||||||
@@ -355,7 +355,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
|
|||||||
|
|
||||||
if (!all) {
|
if (!all) {
|
||||||
if (Options && *Options) {
|
if (Options && *Options) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("options=%s\n", Options);
|
htrc("options=%s\n", Options);
|
||||||
|
|
||||||
op = Options;
|
op = Options;
|
||||||
@@ -751,7 +751,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp)
|
|||||||
|
|
||||||
jlong ar = env->CallLongMethod(job, updateid, upd);
|
jlong ar = env->CallLongMethod(job, updateid, upd);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("DocUpdate: ar = %ld\n", ar);
|
htrc("DocUpdate: ar = %ld\n", ar);
|
||||||
|
|
||||||
if (Check((int)ar)) {
|
if (Check((int)ar)) {
|
||||||
@@ -770,7 +770,7 @@ int JMgoConn::DocDelete(PGLOBAL g, bool all)
|
|||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
jlong ar = env->CallLongMethod(job, deleteid, all);
|
jlong ar = env->CallLongMethod(job, deleteid, all);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("DocDelete: ar = %ld\n", ar);
|
htrc("DocDelete: ar = %ld\n", ar);
|
||||||
|
|
||||||
if (Check((int)ar)) {
|
if (Check((int)ar)) {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
|
|||||||
PJSON jsp = NULL;
|
PJSON jsp = NULL;
|
||||||
STRG src;
|
STRG src;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("ParseJson: s=%.10s len=%d\n", s, len);
|
htrc("ParseJson: s=%.10s len=%d\n", s, len);
|
||||||
|
|
||||||
if (!s || !len) {
|
if (!s || !len) {
|
||||||
@@ -165,7 +165,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
|
|||||||
}; // endswitch s[i]
|
}; // endswitch s[i]
|
||||||
|
|
||||||
if (!jsp)
|
if (!jsp)
|
||||||
sprintf(g->Message, "Invalid Json string '%.*s'", 50, s);
|
sprintf(g->Message, "Invalid Json string '%.*s'", MY_MIN(len, 50), s);
|
||||||
else if (ptyp && pretty == 3) {
|
else if (ptyp && pretty == 3) {
|
||||||
*ptyp = 3; // Not recognized pretty
|
*ptyp = 3; // Not recognized pretty
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
|
|||||||
} // endif ptyp
|
} // endif ptyp
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
jsp = NULL;
|
jsp = NULL;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
@@ -652,7 +652,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty)
|
|||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
} catch (int n) {
|
} catch (int n) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Exception %d: %s\n", n, g->Message);
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
} catch (const char *msg) {
|
} catch (const char *msg) {
|
||||||
@@ -1015,6 +1015,20 @@ PJAR JOBJECT::GetKeyList(PGLOBAL g)
|
|||||||
return jarp;
|
return jarp;
|
||||||
} // end of GetKeyList
|
} // end of GetKeyList
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* Return all values as an array. */
|
||||||
|
/***********************************************************************/
|
||||||
|
PJAR JOBJECT::GetValList(PGLOBAL g)
|
||||||
|
{
|
||||||
|
PJAR jarp = new(g) JARRAY();
|
||||||
|
|
||||||
|
for (PJPR jpp = First; jpp; jpp = jpp->Next)
|
||||||
|
jarp->AddValue(g, jpp->GetVal());
|
||||||
|
|
||||||
|
jarp->InitArray(g);
|
||||||
|
return jarp;
|
||||||
|
} // end of GetValList
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Get the value corresponding to the given key. */
|
/* Get the value corresponding to the given key. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -1224,6 +1238,7 @@ PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x)
|
|||||||
Last->Next = jvp;
|
Last->Next = jvp;
|
||||||
|
|
||||||
Last = jvp;
|
Last = jvp;
|
||||||
|
Last->Next = NULL;
|
||||||
} // endif x
|
} // endif x
|
||||||
|
|
||||||
return jvp;
|
return jvp;
|
||||||
@@ -1318,6 +1333,24 @@ bool JARRAY::IsNull(void)
|
|||||||
|
|
||||||
/* -------------------------- Class JVALUE- -------------------------- */
|
/* -------------------------- Class JVALUE- -------------------------- */
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* Constructor for a JSON. */
|
||||||
|
/***********************************************************************/
|
||||||
|
JVALUE::JVALUE(PJSON jsp) : JSON()
|
||||||
|
{
|
||||||
|
if (jsp->GetType() == TYPE_JVAL) {
|
||||||
|
Jsp = jsp->GetJsp();
|
||||||
|
Value = jsp->GetValue();
|
||||||
|
} else {
|
||||||
|
Jsp = jsp;
|
||||||
|
Value = NULL;
|
||||||
|
} // endif Type
|
||||||
|
|
||||||
|
Next = NULL;
|
||||||
|
Del = false;
|
||||||
|
Size = 1;
|
||||||
|
} // end of JVALUE constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Constructor for a Value with a given string or numeric value. */
|
/* Constructor for a Value with a given string or numeric value. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ enum JTYP {TYPE_NULL = TYPE_VOID,
|
|||||||
TYPE_BINT = TYPE_BIGINT,
|
TYPE_BINT = TYPE_BIGINT,
|
||||||
TYPE_DTM = TYPE_DATE,
|
TYPE_DTM = TYPE_DATE,
|
||||||
TYPE_INTG = TYPE_INT,
|
TYPE_INTG = TYPE_INT,
|
||||||
TYPE_JSON = 12,
|
TYPE_VAL = 12,
|
||||||
|
TYPE_JSON,
|
||||||
TYPE_JAR,
|
TYPE_JAR,
|
||||||
TYPE_JOB,
|
TYPE_JOB,
|
||||||
TYPE_JVAL};
|
TYPE_JVAL};
|
||||||
@@ -157,6 +158,7 @@ class JSON : public BLOCK {
|
|||||||
//virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;}
|
//virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;}
|
||||||
virtual PJPR AddPair(PGLOBAL g, PCSZ key) {X return NULL;}
|
virtual PJPR AddPair(PGLOBAL g, PCSZ key) {X return NULL;}
|
||||||
virtual PJAR GetKeyList(PGLOBAL g) {X return NULL;}
|
virtual PJAR GetKeyList(PGLOBAL g) {X return NULL;}
|
||||||
|
virtual PJAR GetValList(PGLOBAL g) {X return NULL;}
|
||||||
virtual PJVAL GetValue(const char *key) {X return NULL;}
|
virtual PJVAL GetValue(const char *key) {X return NULL;}
|
||||||
virtual PJOB GetObject(void) {return NULL;}
|
virtual PJOB GetObject(void) {return NULL;}
|
||||||
virtual PJAR GetArray(void) {return NULL;}
|
virtual PJAR GetArray(void) {return NULL;}
|
||||||
@@ -205,6 +207,7 @@ class JOBJECT : public JSON {
|
|||||||
virtual PJOB GetObject(void) {return this;}
|
virtual PJOB GetObject(void) {return this;}
|
||||||
virtual PJVAL GetValue(const char* key);
|
virtual PJVAL GetValue(const char* key);
|
||||||
virtual PJAR GetKeyList(PGLOBAL g);
|
virtual PJAR GetKeyList(PGLOBAL g);
|
||||||
|
virtual PJAR GetValList(PGLOBAL g);
|
||||||
virtual PSZ GetText(PGLOBAL g, PSZ text);
|
virtual PSZ GetText(PGLOBAL g, PSZ text);
|
||||||
virtual bool Merge(PGLOBAL g, PJSON jsp);
|
virtual bool Merge(PGLOBAL g, PJSON jsp);
|
||||||
virtual void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key);
|
virtual void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key);
|
||||||
@@ -258,8 +261,7 @@ class JVALUE : public JSON {
|
|||||||
friend bool SerializeValue(JOUT *, PJVAL);
|
friend bool SerializeValue(JOUT *, PJVAL);
|
||||||
public:
|
public:
|
||||||
JVALUE(void) : JSON() {Clear();}
|
JVALUE(void) : JSON() {Clear();}
|
||||||
JVALUE(PJSON jsp) : JSON()
|
JVALUE(PJSON jsp);
|
||||||
{Jsp = jsp; Value = NULL; Next = NULL; Del = false; Size = 1;}
|
|
||||||
JVALUE(PGLOBAL g, PVAL valp);
|
JVALUE(PGLOBAL g, PVAL valp);
|
||||||
JVALUE(PGLOBAL g, PCSZ strp);
|
JVALUE(PGLOBAL g, PCSZ strp);
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -89,6 +89,10 @@ extern "C" {
|
|||||||
DllExport char *json_object_list(UDF_EXEC_ARGS);
|
DllExport char *json_object_list(UDF_EXEC_ARGS);
|
||||||
DllExport void json_object_list_deinit(UDF_INIT*);
|
DllExport void json_object_list_deinit(UDF_INIT*);
|
||||||
|
|
||||||
|
DllExport my_bool json_object_values_init(UDF_INIT*, UDF_ARGS*, char*);
|
||||||
|
DllExport char *json_object_values(UDF_EXEC_ARGS);
|
||||||
|
DllExport void json_object_values_deinit(UDF_INIT*);
|
||||||
|
|
||||||
DllExport my_bool jsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*);
|
DllExport my_bool jsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*);
|
||||||
DllExport long long jsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*);
|
DllExport long long jsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*);
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ void xtrc(char const *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
|
;
|
||||||
//vfprintf(stderr, fmt, ap);
|
//vfprintf(stderr, fmt, ap);
|
||||||
vsprintf(s, fmt, ap);
|
vsprintf(s, fmt, ap);
|
||||||
if (s[strlen(s)-1] == '\n')
|
if (s[strlen(s)-1] == '\n')
|
||||||
@@ -210,7 +210,7 @@ static xmlStrdupFunc Strdup;
|
|||||||
|
|
||||||
void xmlMyFree(void *mem)
|
void xmlMyFree(void *mem)
|
||||||
{
|
{
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc("%.4d Freeing at %p %s\n", ++m, mem, s);
|
htrc("%.4d Freeing at %p %s\n", ++m, mem, s);
|
||||||
*s = 0;
|
*s = 0;
|
||||||
} // endif trace
|
} // endif trace
|
||||||
@@ -220,7 +220,7 @@ void xmlMyFree(void *mem)
|
|||||||
void *xmlMyMalloc(size_t size)
|
void *xmlMyMalloc(size_t size)
|
||||||
{
|
{
|
||||||
void *p = Malloc(size);
|
void *p = Malloc(size);
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc("%.4d Allocating %.5d at %p %s\n", ++m, size, p, s);
|
htrc("%.4d Allocating %.5d at %p %s\n", ++m, size, p, s);
|
||||||
*s = 0;
|
*s = 0;
|
||||||
} // endif trace
|
} // endif trace
|
||||||
@@ -230,7 +230,7 @@ void *xmlMyMalloc(size_t size)
|
|||||||
void *xmlMyMallocAtomic(size_t size)
|
void *xmlMyMallocAtomic(size_t size)
|
||||||
{
|
{
|
||||||
void *p = MallocA(size);
|
void *p = MallocA(size);
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc("%.4d Atom alloc %.5d at %p %s\n", ++m, size, p, s);
|
htrc("%.4d Atom alloc %.5d at %p %s\n", ++m, size, p, s);
|
||||||
*s = 0;
|
*s = 0;
|
||||||
} // endif trace
|
} // endif trace
|
||||||
@@ -240,7 +240,7 @@ void *xmlMyMallocAtomic(size_t size)
|
|||||||
void *xmlMyRealloc(void *mem, size_t size)
|
void *xmlMyRealloc(void *mem, size_t size)
|
||||||
{
|
{
|
||||||
void *p = Realloc(mem, size);
|
void *p = Realloc(mem, size);
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc("%.4d ReAlloc %.5d to %p from %p %s\n", ++m, size, p, mem, s);
|
htrc("%.4d ReAlloc %.5d to %p from %p %s\n", ++m, size, p, mem, s);
|
||||||
*s = 0;
|
*s = 0;
|
||||||
} // endif trace
|
} // endif trace
|
||||||
@@ -250,7 +250,7 @@ void *xmlMyRealloc(void *mem, size_t size)
|
|||||||
char *xmlMyStrdup(const char *str)
|
char *xmlMyStrdup(const char *str)
|
||||||
{
|
{
|
||||||
char *p = Strdup(str);
|
char *p = Strdup(str);
|
||||||
if (trace) {
|
if (trace(1)) {
|
||||||
htrc("%.4d Duplicating to %p from %p %s %s\n", ++m, p, str, str, s);
|
htrc("%.4d Duplicating to %p from %p %s %s\n", ++m, p, str, str, s);
|
||||||
*s = 0;
|
*s = 0;
|
||||||
} // endif trace
|
} // endif trace
|
||||||
@@ -339,7 +339,7 @@ void CloseXML2File(PGLOBAL g, PFBLOCK fp, bool all)
|
|||||||
{
|
{
|
||||||
PX2BLOCK xp = (PX2BLOCK)fp;
|
PX2BLOCK xp = (PX2BLOCK)fp;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("CloseXML2File: xp=%p count=%d\n", xp, (xp) ? xp->Count : 0);
|
htrc("CloseXML2File: xp=%p count=%d\n", xp, (xp) ? xp->Count : 0);
|
||||||
|
|
||||||
if (xp && xp->Count > 1 && !all) {
|
if (xp && xp->Count > 1 && !all) {
|
||||||
@@ -387,7 +387,7 @@ bool LIBXMLDOC::Initialize(PGLOBAL g, PCSZ entry, bool zipped)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool LIBXMLDOC::ParseFile(PGLOBAL g, char *fn)
|
bool LIBXMLDOC::ParseFile(PGLOBAL g, char *fn)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("ParseFile\n");
|
htrc("ParseFile\n");
|
||||||
|
|
||||||
if (zip) {
|
if (zip) {
|
||||||
@@ -436,7 +436,7 @@ PFBLOCK LIBXMLDOC::LinkXblock(PGLOBAL g, MODE m, int rc, char *fn)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool LIBXMLDOC::NewDoc(PGLOBAL g, PCSZ ver)
|
bool LIBXMLDOC::NewDoc(PGLOBAL g, PCSZ ver)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("NewDoc\n");
|
htrc("NewDoc\n");
|
||||||
|
|
||||||
return ((Docp = xmlNewDoc(BAD_CAST ver)) == NULL);
|
return ((Docp = xmlNewDoc(BAD_CAST ver)) == NULL);
|
||||||
@@ -447,7 +447,7 @@ bool LIBXMLDOC::NewDoc(PGLOBAL g, PCSZ ver)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
void LIBXMLDOC::AddComment(PGLOBAL g, char *txtp)
|
void LIBXMLDOC::AddComment(PGLOBAL g, char *txtp)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("AddComment: %s\n", txtp);
|
htrc("AddComment: %s\n", txtp);
|
||||||
|
|
||||||
xmlNodePtr cp = xmlNewDocComment(Docp, BAD_CAST txtp);
|
xmlNodePtr cp = xmlNewDocComment(Docp, BAD_CAST txtp);
|
||||||
@@ -459,7 +459,7 @@ void LIBXMLDOC::AddComment(PGLOBAL g, char *txtp)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXNODE LIBXMLDOC::GetRoot(PGLOBAL g)
|
PXNODE LIBXMLDOC::GetRoot(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetRoot\n");
|
htrc("GetRoot\n");
|
||||||
|
|
||||||
xmlNodePtr root = xmlDocGetRootElement(Docp);
|
xmlNodePtr root = xmlDocGetRootElement(Docp);
|
||||||
@@ -475,7 +475,7 @@ PXNODE LIBXMLDOC::GetRoot(PGLOBAL g)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXNODE LIBXMLDOC::NewRoot(PGLOBAL g, char *name)
|
PXNODE LIBXMLDOC::NewRoot(PGLOBAL g, char *name)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("NewRoot: %s\n", name);
|
htrc("NewRoot: %s\n", name);
|
||||||
|
|
||||||
xmlNodePtr root = xmlNewDocNode(Docp, NULL, BAD_CAST name, NULL);
|
xmlNodePtr root = xmlNewDocNode(Docp, NULL, BAD_CAST name, NULL);
|
||||||
@@ -493,7 +493,7 @@ PXNODE LIBXMLDOC::NewRoot(PGLOBAL g, char *name)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXNODE LIBXMLDOC::NewPnode(PGLOBAL g, char *name)
|
PXNODE LIBXMLDOC::NewPnode(PGLOBAL g, char *name)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("NewNode: %s\n", name);
|
htrc("NewNode: %s\n", name);
|
||||||
|
|
||||||
xmlNodePtr nop;
|
xmlNodePtr nop;
|
||||||
@@ -534,7 +534,7 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
FILE *of;
|
FILE *of;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("DumpDoc: %s\n", ofn);
|
htrc("DumpDoc: %s\n", ofn);
|
||||||
|
|
||||||
if (!(of= global_fopen(g, MSGID_CANNOT_OPEN, ofn, "w")))
|
if (!(of= global_fopen(g, MSGID_CANNOT_OPEN, ofn, "w")))
|
||||||
@@ -576,7 +576,7 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
|
void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("CloseDoc: xp=%p count=%d\n", xp, (xp) ? xp->Count : 0);
|
htrc("CloseDoc: xp=%p count=%d\n", xp, (xp) ? xp->Count : 0);
|
||||||
|
|
||||||
//if (xp && xp->Count == 1) {
|
//if (xp && xp->Count == 1) {
|
||||||
@@ -630,24 +630,24 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
|
|||||||
{
|
{
|
||||||
xmlNodeSetPtr nl;
|
xmlNodeSetPtr nl;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetNodeList: %s np=%p\n", xp, np);
|
htrc("GetNodeList: %s np=%p\n", xp, np);
|
||||||
|
|
||||||
if (!Ctxp) {
|
if (!Ctxp) {
|
||||||
// Init Xpath
|
// Init Xpath
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Calling xmlPathInit\n");
|
htrc("Calling xmlPathInit\n");
|
||||||
|
|
||||||
xmlXPathInit();
|
xmlXPathInit();
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Calling xmlXPathNewContext Docp=%p\n", Docp);
|
htrc("Calling xmlXPathNewContext Docp=%p\n", Docp);
|
||||||
|
|
||||||
// Create xpath evaluation context
|
// Create xpath evaluation context
|
||||||
if (!(Ctxp = xmlXPathNewContext(Docp))) {
|
if (!(Ctxp = xmlXPathNewContext(Docp))) {
|
||||||
strcpy(g->Message, MSG(XPATH_CNTX_ERR));
|
strcpy(g->Message, MSG(XPATH_CNTX_ERR));
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Context error: %s\n", g->Message);
|
htrc("Context error: %s\n", g->Message);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -655,7 +655,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
|
|||||||
|
|
||||||
// Register namespaces from list (if any)
|
// Register namespaces from list (if any)
|
||||||
for (PNS nsp = Namespaces; nsp; nsp = nsp->Next) {
|
for (PNS nsp = Namespaces; nsp; nsp = nsp->Next) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Calling xmlXPathRegisterNs Prefix=%s Uri=%s\n",
|
htrc("Calling xmlXPathRegisterNs Prefix=%s Uri=%s\n",
|
||||||
nsp->Prefix, nsp->Uri);
|
nsp->Prefix, nsp->Uri);
|
||||||
|
|
||||||
@@ -663,7 +663,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
|
|||||||
BAD_CAST nsp->Uri)) {
|
BAD_CAST nsp->Uri)) {
|
||||||
sprintf(g->Message, MSG(REGISTER_ERR), nsp->Prefix, nsp->Uri);
|
sprintf(g->Message, MSG(REGISTER_ERR), nsp->Prefix, nsp->Uri);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Ns error: %s\n", g->Message);
|
htrc("Ns error: %s\n", g->Message);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -674,7 +674,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
|
|||||||
} // endif Ctxp
|
} // endif Ctxp
|
||||||
|
|
||||||
if (Xop) {
|
if (Xop) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Calling xmlXPathFreeNodeSetList Xop=%p NOFREE=%d\n",
|
htrc("Calling xmlXPathFreeNodeSetList Xop=%p NOFREE=%d\n",
|
||||||
Xop, Nofreelist);
|
Xop, Nofreelist);
|
||||||
|
|
||||||
@@ -698,21 +698,21 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
|
|||||||
// Set the context to the calling node
|
// Set the context to the calling node
|
||||||
Ctxp->node = np;
|
Ctxp->node = np;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Calling xmlXPathEval %s Ctxp=%p\n", xp, Ctxp);
|
htrc("Calling xmlXPathEval %s Ctxp=%p\n", xp, Ctxp);
|
||||||
|
|
||||||
// Evaluate table xpath
|
// Evaluate table xpath
|
||||||
if (!(Xop = xmlXPathEval(BAD_CAST xp, Ctxp))) {
|
if (!(Xop = xmlXPathEval(BAD_CAST xp, Ctxp))) {
|
||||||
sprintf(g->Message, MSG(XPATH_EVAL_ERR), xp);
|
sprintf(g->Message, MSG(XPATH_EVAL_ERR), xp);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Path error: %s\n", g->Message);
|
htrc("Path error: %s\n", g->Message);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
} else
|
} else
|
||||||
nl = Xop->nodesetval;
|
nl = Xop->nodesetval;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetNodeList nl=%p n=%p\n", nl, (nl) ? nl->nodeNr : 0);
|
htrc("GetNodeList nl=%p n=%p\n", nl, (nl) ? nl->nodeNr : 0);
|
||||||
|
|
||||||
return nl;
|
return nl;
|
||||||
@@ -811,7 +811,7 @@ XML2NODE::XML2NODE(PXDOC dp, xmlNodePtr np) : XMLNODE(dp)
|
|||||||
|
|
||||||
int XML2NODE::GetType(void)
|
int XML2NODE::GetType(void)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetType type=%d\n", Nodep->type);
|
htrc("GetType type=%d\n", Nodep->type);
|
||||||
|
|
||||||
return Nodep->type;
|
return Nodep->type;
|
||||||
@@ -822,7 +822,7 @@ int XML2NODE::GetType(void)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXNODE XML2NODE::GetNext(PGLOBAL g)
|
PXNODE XML2NODE::GetNext(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetNext\n");
|
htrc("GetNext\n");
|
||||||
|
|
||||||
if (!Nodep->next)
|
if (!Nodep->next)
|
||||||
@@ -838,7 +838,7 @@ PXNODE XML2NODE::GetNext(PGLOBAL g)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXNODE XML2NODE::GetChild(PGLOBAL g)
|
PXNODE XML2NODE::GetChild(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetChild\n");
|
htrc("GetChild\n");
|
||||||
|
|
||||||
if (!Nodep->children)
|
if (!Nodep->children)
|
||||||
@@ -856,7 +856,7 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len)
|
|||||||
{
|
{
|
||||||
RCODE rc = RC_OK;
|
RCODE rc = RC_OK;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetContent\n");
|
htrc("GetContent\n");
|
||||||
|
|
||||||
if (Content)
|
if (Content)
|
||||||
@@ -888,7 +888,7 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len)
|
|||||||
|
|
||||||
*p2 = 0;
|
*p2 = 0;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetText buf='%s' len=%d\n", buf, len);
|
htrc("GetText buf='%s' len=%d\n", buf, len);
|
||||||
|
|
||||||
xmlFree(Content);
|
xmlFree(Content);
|
||||||
@@ -896,7 +896,7 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len)
|
|||||||
} else
|
} else
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetContent: %s\n", buf);
|
htrc("GetContent: %s\n", buf);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -907,12 +907,12 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool XML2NODE::SetContent(PGLOBAL g, char *txtp, int len)
|
bool XML2NODE::SetContent(PGLOBAL g, char *txtp, int len)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("SetContent: %s\n", txtp);
|
htrc("SetContent: %s\n", txtp);
|
||||||
|
|
||||||
xmlChar *buf = xmlEncodeEntitiesReentrant(Docp, BAD_CAST txtp);
|
xmlChar *buf = xmlEncodeEntitiesReentrant(Docp, BAD_CAST txtp);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("SetContent: %s -> %s\n", txtp, buf);
|
htrc("SetContent: %s -> %s\n", txtp, buf);
|
||||||
|
|
||||||
xmlNodeSetContent(Nodep, buf);
|
xmlNodeSetContent(Nodep, buf);
|
||||||
@@ -925,7 +925,7 @@ bool XML2NODE::SetContent(PGLOBAL g, char *txtp, int len)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXNODE XML2NODE::Clone(PGLOBAL g, PXNODE np)
|
PXNODE XML2NODE::Clone(PGLOBAL g, PXNODE np)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Clone: np=%p\n", np);
|
htrc("Clone: np=%p\n", np);
|
||||||
|
|
||||||
if (np) {
|
if (np) {
|
||||||
@@ -941,7 +941,7 @@ PXNODE XML2NODE::Clone(PGLOBAL g, PXNODE np)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXLIST XML2NODE::GetChildElements(PGLOBAL g, char *xp, PXLIST lp)
|
PXLIST XML2NODE::GetChildElements(PGLOBAL g, char *xp, PXLIST lp)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetChildElements: %s\n", xp);
|
htrc("GetChildElements: %s\n", xp);
|
||||||
|
|
||||||
return SelectNodes(g, (xp) ? xp : (char*)"*", lp);
|
return SelectNodes(g, (xp) ? xp : (char*)"*", lp);
|
||||||
@@ -952,7 +952,7 @@ PXLIST XML2NODE::GetChildElements(PGLOBAL g, char *xp, PXLIST lp)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXLIST XML2NODE::SelectNodes(PGLOBAL g, char *xp, PXLIST lp)
|
PXLIST XML2NODE::SelectNodes(PGLOBAL g, char *xp, PXLIST lp)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("SelectNodes: %s\n", xp);
|
htrc("SelectNodes: %s\n", xp);
|
||||||
|
|
||||||
xmlNodeSetPtr nl = ((PXDOC2)Doc)->GetNodeList(g, Nodep, xp);
|
xmlNodeSetPtr nl = ((PXDOC2)Doc)->GetNodeList(g, Nodep, xp);
|
||||||
@@ -970,7 +970,7 @@ PXLIST XML2NODE::SelectNodes(PGLOBAL g, char *xp, PXLIST lp)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXNODE XML2NODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
|
PXNODE XML2NODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("SelectSingleNode: %s\n", xp);
|
htrc("SelectSingleNode: %s\n", xp);
|
||||||
|
|
||||||
xmlNodeSetPtr nl = ((PXDOC2)Doc)->GetNodeList(g, Nodep, xp);
|
xmlNodeSetPtr nl = ((PXDOC2)Doc)->GetNodeList(g, Nodep, xp);
|
||||||
@@ -994,7 +994,7 @@ PXATTR XML2NODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap)
|
|||||||
{
|
{
|
||||||
xmlAttrPtr atp;
|
xmlAttrPtr atp;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetAttribute: %s\n", SVP(name));
|
htrc("GetAttribute: %s\n", SVP(name));
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
@@ -1023,7 +1023,7 @@ PXNODE XML2NODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np)
|
|||||||
{
|
{
|
||||||
char *p, *pn, *pf = NULL, *nmp = PlugDup(g, name);
|
char *p, *pn, *pf = NULL, *nmp = PlugDup(g, name);
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("AddChildNode: %s\n", name);
|
htrc("AddChildNode: %s\n", name);
|
||||||
|
|
||||||
// Is a prefix specified
|
// Is a prefix specified
|
||||||
@@ -1074,7 +1074,7 @@ PXNODE XML2NODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXATTR XML2NODE::AddProperty(PGLOBAL g, char *name, PXATTR ap)
|
PXATTR XML2NODE::AddProperty(PGLOBAL g, char *name, PXATTR ap)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("AddProperty: %s\n", name);
|
htrc("AddProperty: %s\n", name);
|
||||||
|
|
||||||
xmlAttrPtr atp = xmlNewProp(Nodep, BAD_CAST name, NULL);
|
xmlAttrPtr atp = xmlNewProp(Nodep, BAD_CAST name, NULL);
|
||||||
@@ -1097,7 +1097,7 @@ PXATTR XML2NODE::AddProperty(PGLOBAL g, char *name, PXATTR ap)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
void XML2NODE::AddText(PGLOBAL g, PCSZ txtp)
|
void XML2NODE::AddText(PGLOBAL g, PCSZ txtp)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("AddText: %s\n", txtp);
|
htrc("AddText: %s\n", txtp);
|
||||||
|
|
||||||
// This is to avoid a blank line when inserting a new line
|
// This is to avoid a blank line when inserting a new line
|
||||||
@@ -1119,7 +1119,7 @@ void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp)
|
|||||||
{
|
{
|
||||||
xmlErrorPtr xerr;
|
xmlErrorPtr xerr;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("DeleteChild: node=%p\n", dnp);
|
htrc("DeleteChild: node=%p\n", dnp);
|
||||||
|
|
||||||
xmlNodePtr np = ((PNODE2)dnp)->Nodep;
|
xmlNodePtr np = ((PNODE2)dnp)->Nodep;
|
||||||
@@ -1157,7 +1157,7 @@ void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("DeleteChild: errmsg=%s\n", xerr->message);
|
htrc("DeleteChild: errmsg=%s\n", xerr->message);
|
||||||
|
|
||||||
xmlResetError(xerr);
|
xmlResetError(xerr);
|
||||||
@@ -1187,7 +1187,7 @@ int XML2NODELIST::GetLength(void)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXNODE XML2NODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
|
PXNODE XML2NODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetItem: %d\n", n);
|
htrc("GetItem: %d\n", n);
|
||||||
|
|
||||||
if (!Listp || Listp->nodeNr <= n)
|
if (!Listp || Listp->nodeNr <= n)
|
||||||
@@ -1206,7 +1206,7 @@ PXNODE XML2NODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool XML2NODELIST::DropItem(PGLOBAL g, int n)
|
bool XML2NODELIST::DropItem(PGLOBAL g, int n)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("DropItem: n=%d\n", n);
|
htrc("DropItem: n=%d\n", n);
|
||||||
|
|
||||||
// We should do something here
|
// We should do something here
|
||||||
@@ -1234,7 +1234,7 @@ XML2ATTR::XML2ATTR(PXDOC dp, xmlAttrPtr ap, xmlNodePtr np)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXATTR XML2ATTR::GetNext(PGLOBAL g)
|
PXATTR XML2ATTR::GetNext(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Attr GetNext\n");
|
htrc("Attr GetNext\n");
|
||||||
|
|
||||||
if (!Atrp->next)
|
if (!Atrp->next)
|
||||||
@@ -1252,7 +1252,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len)
|
|||||||
RCODE rc = RC_OK;
|
RCODE rc = RC_OK;
|
||||||
xmlChar *txt;
|
xmlChar *txt;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetText\n");
|
htrc("GetText\n");
|
||||||
|
|
||||||
if ((txt = xmlGetProp(Atrp->parent, Atrp->name))) {
|
if ((txt = xmlGetProp(Atrp->parent, Atrp->name))) {
|
||||||
@@ -1269,7 +1269,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len)
|
|||||||
} else
|
} else
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("GetText: %s\n", buf);
|
htrc("GetText: %s\n", buf);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -1280,7 +1280,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool XML2ATTR::SetText(PGLOBAL g, char *txtp, int len)
|
bool XML2ATTR::SetText(PGLOBAL g, char *txtp, int len)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("SetText: %s %d\n", txtp, len);
|
htrc("SetText: %s %d\n", txtp, len);
|
||||||
|
|
||||||
xmlSetProp(Parent, Atrp->name, BAD_CAST txtp);
|
xmlSetProp(Parent, Atrp->name, BAD_CAST txtp);
|
||||||
|
|||||||
@@ -230,13 +230,13 @@ bool MACINFO::GetOneInfo(PGLOBAL g, int flag, void *v, int lv)
|
|||||||
case 11: // Description
|
case 11: // Description
|
||||||
if ((p = strstr(Curp->Description, " - Packet Scheduler Miniport"))) {
|
if ((p = strstr(Curp->Description, " - Packet Scheduler Miniport"))) {
|
||||||
strncpy(buf, Curp->Description, p - Curp->Description);
|
strncpy(buf, Curp->Description, p - Curp->Description);
|
||||||
i = p - Curp->Description;
|
i = (int)(p - Curp->Description);
|
||||||
strncpy(buf, Curp->Description, i);
|
strncpy(buf, Curp->Description, i);
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
p = buf;
|
p = buf;
|
||||||
} else if ((p = strstr(Curp->Description,
|
} else if ((p = strstr(Curp->Description,
|
||||||
" - Miniport d'ordonnancement de paquets"))) {
|
" - Miniport d'ordonnancement de paquets"))) {
|
||||||
i = p - Curp->Description;
|
i = (int)(p - Curp->Description);
|
||||||
strncpy(buf, Curp->Description, i);
|
strncpy(buf, Curp->Description, i);
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
p = buf;
|
p = buf;
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info)
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
skipit:
|
skipit:
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("MGOColumns: n=%d len=%d\n", n, length[0]);
|
htrc("MGOColumns: n=%d len=%d\n", n, length[0]);
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
@@ -276,7 +276,7 @@ int MGODISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt)
|
|||||||
tdp->Wrapname = (PSZ)GetStringTableOption(g, topt, "Wrapper",
|
tdp->Wrapname = (PSZ)GetStringTableOption(g, topt, "Wrapper",
|
||||||
(tdp->Version == 2) ? "Mongo2Interface" : "Mongo3Interface");
|
(tdp->Version == 2) ? "Mongo2Interface" : "Mongo3Interface");
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("Uri %s coll=%s db=%s colist=%s filter=%s lvl=%d\n",
|
htrc("Uri %s coll=%s db=%s colist=%s filter=%s lvl=%d\n",
|
||||||
tdp->Uri, tdp->Tabname, tdp->Tabschema, tdp->Colist, tdp->Filter, lvl);
|
tdp->Uri, tdp->Tabname, tdp->Tabschema, tdp->Colist, tdp->Filter, lvl);
|
||||||
|
|
||||||
|
|||||||
@@ -94,9 +94,9 @@
|
|||||||
#if defined(XML_SUPPORT)
|
#if defined(XML_SUPPORT)
|
||||||
#include "tabxml.h"
|
#include "tabxml.h"
|
||||||
#endif // XML_SUPPORT
|
#endif // XML_SUPPORT
|
||||||
#if defined(JAVA_SUPPORT)
|
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
|
||||||
#include "mongo.h"
|
#include "mongo.h"
|
||||||
#endif // JAVA_SUPPORT
|
#endif // JAVA_SUPPORT || CMGO_SUPPORT
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(ZIP_SUPPORT)
|
||||||
#include "tabzip.h"
|
#include "tabzip.h"
|
||||||
#endif // ZIP_SUPPORT
|
#endif // ZIP_SUPPORT
|
||||||
@@ -109,9 +109,10 @@
|
|||||||
extern "C" HINSTANCE s_hModule; // Saved module handle
|
extern "C" HINSTANCE s_hModule; // Saved module handle
|
||||||
#endif // !__WIN__
|
#endif // !__WIN__
|
||||||
|
|
||||||
#if defined(JAVA_SUPPORT)
|
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
|
||||||
//bool MongoEnabled(void);
|
bool MongoEnabled(void);
|
||||||
#endif // JAVA_SUPPORT
|
#endif // JAVA_SUPPORT || CMGO_SUPPORT
|
||||||
|
|
||||||
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
|
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -145,6 +146,9 @@ TABTYPE GetTypeID(const char *type)
|
|||||||
#if defined(JAVA_SUPPORT)
|
#if defined(JAVA_SUPPORT)
|
||||||
: (!stricmp(type, "JDBC")) ? TAB_JDBC
|
: (!stricmp(type, "JDBC")) ? TAB_JDBC
|
||||||
: (!stricmp(type, "MONGO")) ? TAB_MONGO
|
: (!stricmp(type, "MONGO")) ? TAB_MONGO
|
||||||
|
#endif
|
||||||
|
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
|
||||||
|
: (!stricmp(type, "MONGO") && MongoEnabled()) ? TAB_MONGO
|
||||||
#endif
|
#endif
|
||||||
: (!stricmp(type, "MYSQL")) ? TAB_MYSQL
|
: (!stricmp(type, "MYSQL")) ? TAB_MYSQL
|
||||||
: (!stricmp(type, "MYPRX")) ? TAB_MYSQL
|
: (!stricmp(type, "MYPRX")) ? TAB_MYSQL
|
||||||
@@ -488,7 +492,7 @@ void MYCAT::Reset(void)
|
|||||||
PRELDEF MYCAT::GetTableDesc(PGLOBAL g, PTABLE tablep,
|
PRELDEF MYCAT::GetTableDesc(PGLOBAL g, PTABLE tablep,
|
||||||
LPCSTR type, PRELDEF *)
|
LPCSTR type, PRELDEF *)
|
||||||
{
|
{
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("GetTableDesc: name=%s am=%s\n", tablep->GetName(), SVP(type));
|
printf("GetTableDesc: name=%s am=%s\n", tablep->GetName(), SVP(type));
|
||||||
|
|
||||||
// If not specified get the type of this table
|
// If not specified get the type of this table
|
||||||
@@ -509,7 +513,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
|
|||||||
LPCSTR schema = (PSZ)PlugDup(g, tablep->GetSchema());
|
LPCSTR schema = (PSZ)PlugDup(g, tablep->GetSchema());
|
||||||
PRELDEF tdp= NULL;
|
PRELDEF tdp= NULL;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("MakeTableDesc: name=%s schema=%s am=%s\n",
|
printf("MakeTableDesc: name=%s schema=%s am=%s\n",
|
||||||
name, SVP(schema), SVP(am));
|
name, SVP(schema), SVP(am));
|
||||||
|
|
||||||
@@ -562,8 +566,16 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
|
|||||||
break;
|
break;
|
||||||
#endif // MONGO_SUPPORT
|
#endif // MONGO_SUPPORT
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(ZIP_SUPPORT)
|
||||||
case TAB_ZIP: tdp= new(g) ZIPDEF; break;
|
case TAB_ZIP: tdp = new(g) ZIPDEF; break;
|
||||||
#endif // ZIP_SUPPORT
|
#endif // ZIP_SUPPORT
|
||||||
|
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
|
||||||
|
case TAB_MONGO:
|
||||||
|
if (MongoEnabled()) {
|
||||||
|
tdp = new(g) MGODEF;
|
||||||
|
break;
|
||||||
|
} // endif enabled
|
||||||
|
// fall through
|
||||||
|
#endif // JAVA_SUPPORT || CMGO_SUPPORT
|
||||||
default:
|
default:
|
||||||
sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name);
|
sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name);
|
||||||
} // endswitch
|
} // endswitch
|
||||||
@@ -584,14 +596,14 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
|
|||||||
PTDB tdbp= NULL;
|
PTDB tdbp= NULL;
|
||||||
// LPCSTR name= tablep->GetName();
|
// LPCSTR name= tablep->GetName();
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("GetTableDB: name=%s\n", tablep->GetName());
|
printf("GetTableDB: name=%s\n", tablep->GetName());
|
||||||
|
|
||||||
// Look for the description of the requested table
|
// Look for the description of the requested table
|
||||||
tdp= GetTableDesc(g, tablep, type);
|
tdp= GetTableDesc(g, tablep, type);
|
||||||
|
|
||||||
if (tdp) {
|
if (tdp) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("tdb=%p type=%s\n", tdp, tdp->GetType());
|
printf("tdb=%p type=%s\n", tdp, tdp->GetType());
|
||||||
|
|
||||||
if (tablep->GetSchema())
|
if (tablep->GetSchema())
|
||||||
@@ -601,7 +613,7 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
|
|||||||
} // endif tdp
|
} // endif tdp
|
||||||
|
|
||||||
if (tdbp) {
|
if (tdbp) {
|
||||||
if (trace)
|
if (trace(1))
|
||||||
printf("tdbp=%p name=%s amtype=%d\n", tdbp, tdbp->GetName(),
|
printf("tdbp=%p name=%s amtype=%d\n", tdbp, tdbp->GetName(),
|
||||||
tdbp->GetAmType());
|
tdbp->GetAmType());
|
||||||
tablep->SetTo_Tdb(tdbp);
|
tablep->SetTo_Tdb(tdbp);
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
|
|||||||
return NULL;
|
return NULL;
|
||||||
} // endif b
|
} // endif b
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("MyColumns: cmd='%s'\n", cmd.GetStr());
|
htrc("MyColumns: cmd='%s'\n", cmd.GetStr());
|
||||||
|
|
||||||
if ((n = myc.GetResultSize(g, cmd.GetStr())) < 0) {
|
if ((n = myc.GetResultSize(g, cmd.GetStr())) < 0) {
|
||||||
@@ -248,7 +248,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
p2 = strchr(p1, '\'');
|
p2 = strchr(p1, '\'');
|
||||||
len = MY_MAX(len, p2 - p1);
|
len = MY_MAX(len, (int)(p2 - p1));
|
||||||
if (*++p2 != ',') break;
|
if (*++p2 != ',') break;
|
||||||
p1 = p2 + 2;
|
p1 = p2 + 2;
|
||||||
} // endwhile
|
} // endwhile
|
||||||
@@ -482,7 +482,7 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db,
|
|||||||
return RC_FX;
|
return RC_FX;
|
||||||
} // endif m_DB
|
} // endif m_DB
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("MYSQLC Open: m_DB=%.4X size=%d\n", m_DB, (int)sizeof(*m_DB));
|
htrc("MYSQLC Open: m_DB=%.4X size=%d\n", m_DB, (int)sizeof(*m_DB));
|
||||||
|
|
||||||
// Removed to do like FEDERATED do
|
// Removed to do like FEDERATED do
|
||||||
@@ -744,7 +744,7 @@ int MYSQLC::ExecSQL(PGLOBAL g, const char *query, int *w)
|
|||||||
m_Fields = mysql_num_fields(m_Res);
|
m_Fields = mysql_num_fields(m_Res);
|
||||||
m_Rows = (!m_Use) ? (int)mysql_num_rows(m_Res) : 0;
|
m_Rows = (!m_Use) ? (int)mysql_num_rows(m_Res) : 0;
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("ExecSQL: m_Res=%.4X size=%d m_Fields=%d m_Rows=%d\n",
|
htrc("ExecSQL: m_Res=%.4X size=%d m_Fields=%d m_Rows=%d\n",
|
||||||
m_Res, sizeof(*m_Res), m_Fields, m_Rows);
|
m_Res, sizeof(*m_Res), m_Fields, m_Rows);
|
||||||
|
|
||||||
@@ -1068,7 +1068,7 @@ void MYSQLC::Close(void)
|
|||||||
{
|
{
|
||||||
FreeResult();
|
FreeResult();
|
||||||
|
|
||||||
if (trace)
|
if (trace(1))
|
||||||
htrc("MYSQLC Close: m_DB=%.4X\n", m_DB);
|
htrc("MYSQLC Close: m_DB=%.4X\n", m_DB);
|
||||||
|
|
||||||
mysql_close(m_DB);
|
mysql_close(m_DB);
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar';
|
||||||
CREATE TABLE t2 (
|
CREATE TABLE t2 (
|
||||||
command varchar(128) not null,
|
command varchar(128) not null,
|
||||||
number int(5) not null flag=1,
|
number int(5) not null flag=1,
|
||||||
message varchar(255) flag=2)
|
message varchar(255) flag=2)
|
||||||
ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:postgresql://localhost/mtr'
|
ENGINE=CONNECT TABLE_TYPE=JDBC
|
||||||
OPTION_LIST='User=mtr,Password=mtr,Schema=public,Execsrc=1';
|
CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
|
||||||
|
OPTION_LIST='Execsrc=1';
|
||||||
SELECT * FROM t2 WHERE command='drop table employee';
|
SELECT * FROM t2 WHERE command='drop table employee';
|
||||||
command number message
|
command number message
|
||||||
drop table employee 0 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas
|
drop table employee 0 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas
|
||||||
@@ -14,17 +16,18 @@ SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'E
|
|||||||
command number message
|
command number message
|
||||||
insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows
|
insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows
|
||||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
|
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
|
||||||
CONNECTION='jdbc:postgresql://localhost/mtr'
|
CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
|
||||||
OPTION_LIST='User=mtr,Password=mtr,Schema=public,Tabtype=TABLE,Maxres=10';
|
OPTION_LIST='Tabtype=TABLE,Maxres=10';
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
Table_Cat Table_Schema Table_Name Table_Type Remark
|
Table_Cat Table_Schema Table_Name Table_Type Remark
|
||||||
public employee TABLE NULL
|
NULL public employee TABLE NULL
|
||||||
public t1 TABLE NULL
|
NULL public t1 TABLE NULL
|
||||||
public t2 TABLE NULL
|
NULL public t2 TABLE NULL
|
||||||
|
NULL public tchar TABLE NULL
|
||||||
|
NULL public testuuid TABLE NULL
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=columns
|
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC tabname=employee CATFUNC=columns
|
||||||
CONNECTION='jdbc:postgresql://localhost/mtr' tabname=employee
|
CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono';
|
||||||
OPTION_LIST='User=mtr,Password=mtr,Maxres=10';
|
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
|
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
|
||||||
NULL public employee id 4 int4 10 0 0 10 0 NULL
|
NULL public employee id 4 int4 10 0 0 10 0 NULL
|
||||||
@@ -34,13 +37,14 @@ NULL public employee salary 2 numeric 8 0 2 10 1 NULL
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE SERVER 'postgresql' FOREIGN DATA WRAPPER 'postgresql' OPTIONS (
|
CREATE SERVER 'postgresql' FOREIGN DATA WRAPPER 'postgresql' OPTIONS (
|
||||||
HOST 'localhost',
|
HOST 'localhost',
|
||||||
DATABASE 'mtr',
|
DATABASE 'test',
|
||||||
USER 'mtr',
|
USER 'postgres',
|
||||||
PASSWORD 'mtr',
|
PASSWORD 'tinono',
|
||||||
PORT 0,
|
PORT 0,
|
||||||
SOCKET '',
|
SOCKET '',
|
||||||
OWNER 'root');
|
OWNER 'root');
|
||||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='postgresql/public.employee';
|
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
|
||||||
|
CONNECTION='postgresql/public.employee';
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
id name title salary
|
id name title salary
|
||||||
4567 Johnson Engineer 12560.50
|
4567 Johnson Engineer 12560.50
|
||||||
@@ -60,6 +64,3 @@ SELECT * FROM t2 WHERE command='drop table employee';
|
|||||||
command number message
|
command number message
|
||||||
drop table employee 0 Affected rows
|
drop table employee 0 Affected rows
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
SET GLOBAL connect_jvm_path=NULL;
|
|
||||||
SET GLOBAL connect_class_path=NULL;
|
|
||||||
SET GLOBAL time_zone = SYSTEM;
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
SET GLOBAL connect_class_path='C:/MariaDB-10.1/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
|
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
|
||||||
|
set connect_enable_mongo=1;
|
||||||
#
|
#
|
||||||
# Test the MONGO table type
|
# Test the MONGO table type
|
||||||
#
|
#
|
||||||
@@ -381,3 +382,7 @@ planner 167 41.75
|
|||||||
postcard 23 5.75
|
postcard 23 5.75
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
true
|
true
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
set connect_enable_mongo=0;
|
||||||
|
>>>>>>> connect/10.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
SET GLOBAL connect_class_path='C:/MariaDB-10.1/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
|
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
|
||||||
|
set connect_enable_mongo=1;
|
||||||
#
|
#
|
||||||
# Test the MONGO table type
|
# Test the MONGO table type
|
||||||
#
|
#
|
||||||
@@ -381,3 +382,4 @@ planner 167 41.75
|
|||||||
postcard 23 5.75
|
postcard 23 5.75
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
true
|
true
|
||||||
|
set connect_enable_mongo=0;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
set connect_enable_mongo=1;
|
||||||
#
|
#
|
||||||
# Test the MONGO table type
|
# Test the MONGO table type
|
||||||
#
|
#
|
||||||
@@ -380,3 +381,4 @@ planner 167 41.75
|
|||||||
postcard 23 5.75
|
postcard 23 5.75
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
true
|
true
|
||||||
|
set connect_enable_mongo=0;
|
||||||
|
|||||||
@@ -50,17 +50,19 @@ SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL), 'One more') Arra
|
|||||||
Array
|
Array
|
||||||
[56,3.141600,"foo",null,"One more"]
|
[56,3.141600,"foo",null,"One more"]
|
||||||
SELECT Json_Array_Add(JsonValue('one value'), 'One more');
|
SELECT Json_Array_Add(JsonValue('one value'), 'One more');
|
||||||
ERROR HY000: Can't initialize function 'json_array_add'; First argument must be a json item
|
Json_Array_Add(JsonValue('one value'), 'One more')
|
||||||
|
["\"one value\"","One more"]
|
||||||
SELECT Json_Array_Add('one value', 'One more');
|
SELECT Json_Array_Add('one value', 'One more');
|
||||||
ERROR HY000: Can't initialize function 'json_array_add'; First argument must be a json item
|
Json_Array_Add('one value', 'One more')
|
||||||
|
["one value","One more"]
|
||||||
SELECT Json_Array_Add('one value' json_, 'One more');
|
SELECT Json_Array_Add('one value' json_, 'One more');
|
||||||
Json_Array_Add('one value' json_, 'One more')
|
Json_Array_Add('one value' json_, 'One more')
|
||||||
one value
|
one value
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1105 Error 2 opening one value
|
Warning 1105 Error 2 opening one value
|
||||||
Warning 1105 First argument target is not an array
|
|
||||||
SELECT Json_Array_Add(5 json_, 'One more');
|
SELECT Json_Array_Add(5 json_, 'One more');
|
||||||
ERROR HY000: Can't initialize function 'json_array_add'; First argument must be a json item
|
Json_Array_Add(5 json_, 'One more')
|
||||||
|
[5,"One more"]
|
||||||
SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 0);
|
SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 0);
|
||||||
Json_Array_Add('[5,3,8,7,9]' json_, 4, 0)
|
Json_Array_Add('[5,3,8,7,9]' json_, 4, 0)
|
||||||
[4,5,3,8,7,9]
|
[4,5,3,8,7,9]
|
||||||
|
|||||||
@@ -272,10 +272,9 @@ Json_Serialize(Jbin_Array('a','b','c'))
|
|||||||
["a","b","c"]
|
["a","b","c"]
|
||||||
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd'));
|
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd'));
|
||||||
Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd'))
|
Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd'))
|
||||||
Null json tree
|
[null,"d"]
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1105 Open(map) error 2 on not_exist.json
|
Warning 1105 Open(map) error 2 on not_exist.json
|
||||||
Warning 1105 First argument is not an array
|
|
||||||
# This does not modify the file
|
# This does not modify the file
|
||||||
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'));
|
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'));
|
||||||
Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'))
|
Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'))
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
set connect_enable_mongo=1;
|
||||||
#
|
#
|
||||||
# Test the MONGO table type
|
# Test the MONGO table type
|
||||||
#
|
#
|
||||||
@@ -376,3 +377,4 @@ planner 167 41.750000
|
|||||||
postcard 23 5.750000
|
postcard 23 5.750000
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
true
|
true
|
||||||
|
set connect_enable_mongo=0;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
SET GLOBAL connect_class_path='C:/MariaDB-10.1/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
|
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
|
||||||
|
set connect_enable_mongo=1;
|
||||||
#
|
#
|
||||||
# Test the MONGO table type
|
# Test the MONGO table type
|
||||||
#
|
#
|
||||||
@@ -377,3 +378,4 @@ planner 167 41.75
|
|||||||
postcard 23 5.75
|
postcard 23 5.75
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
true
|
true
|
||||||
|
set connect_enable_mongo=0;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
SET GLOBAL connect_class_path='C:/MariaDB-10.1/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
|
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
|
||||||
|
set connect_enable_mongo=1;
|
||||||
#
|
#
|
||||||
# Test the MONGO table type
|
# Test the MONGO table type
|
||||||
#
|
#
|
||||||
@@ -377,3 +378,4 @@ planner 167 41.75
|
|||||||
postcard 23 5.75
|
postcard 23 5.75
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
true
|
true
|
||||||
|
set connect_enable_mongo=0;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ a b
|
|||||||
CREATE TABLE total (a int, b char(10))
|
CREATE TABLE total (a int, b char(10))
|
||||||
ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5'
|
ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5'
|
||||||
OPTION_LIST='thread=yes,port=PORT';
|
OPTION_LIST='thread=yes,port=PORT';
|
||||||
set connect_xtrace=1;
|
set connect_xtrace=96;
|
||||||
SELECT * FROM total order by a desc;
|
SELECT * FROM total order by a desc;
|
||||||
a b
|
a b
|
||||||
19 test19
|
19 test19
|
||||||
@@ -118,7 +118,7 @@ SELECT * FROM t2;
|
|||||||
v
|
v
|
||||||
22
|
22
|
||||||
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
|
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
|
||||||
set connect_xtrace=1;
|
set connect_xtrace=96;
|
||||||
SELECT * FROM total order by v desc;
|
SELECT * FROM total order by v desc;
|
||||||
v
|
v
|
||||||
22
|
22
|
||||||
@@ -137,7 +137,7 @@ SELECT * FROM t2;
|
|||||||
v
|
v
|
||||||
22
|
22
|
||||||
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
|
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
|
||||||
set connect_xtrace=1;
|
set connect_xtrace=96;
|
||||||
SELECT * FROM total order by v desc;
|
SELECT * FROM total order by v desc;
|
||||||
v
|
v
|
||||||
22
|
22
|
||||||
|
|||||||
29
storage/connect/mysql-test/connect/r/vcol.result
Normal file
29
storage/connect/mysql-test/connect/r/vcol.result
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
create table t1 (
|
||||||
|
#linenum int(6) not null default 0 special=rowid,
|
||||||
|
name char(12) not null,
|
||||||
|
city char(11) not null,
|
||||||
|
birth date not null date_format='DD/MM/YYYY',
|
||||||
|
hired date not null date_format='DD/MM/YYYY' flag=36,
|
||||||
|
agehired int(3) as (floor(datediff(hired,birth)/365.25))
|
||||||
|
)
|
||||||
|
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
|
||||||
|
select * from t1;
|
||||||
|
name city birth hired agehired
|
||||||
|
John Boston 1986-01-25 2010-06-02 24
|
||||||
|
Henry Boston 1987-06-07 2008-04-01 20
|
||||||
|
George San Jose 1981-08-10 2010-06-02 28
|
||||||
|
Sam Chicago 1979-11-22 2007-10-10 27
|
||||||
|
James Dallas 1992-05-13 2009-12-14 17
|
||||||
|
Bill Boston 1986-09-11 2008-02-10 21
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (
|
||||||
|
#linenum int(6) not null default 0 special=rowid,
|
||||||
|
name char(12) not null,
|
||||||
|
city char(11) not null,
|
||||||
|
birth date not null date_format='DD/MM/YYYY',
|
||||||
|
hired date not null date_format='DD/MM/YYYY' flag=36,
|
||||||
|
agehired int(3) as (floor(datediff(hired,birth)/365.25)),
|
||||||
|
index (agehired)
|
||||||
|
)
|
||||||
|
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
|
||||||
|
ERROR HY000: Key/Index cannot be defined on a non-stored computed column
|
||||||
BIN
storage/connect/mysql-test/connect/std_data/JavaWrappers.jar
Normal file
BIN
storage/connect/mysql-test/connect/std_data/JavaWrappers.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,25 +3,32 @@
|
|||||||
#
|
#
|
||||||
# This test is run against Postgresql driver
|
# This test is run against Postgresql driver
|
||||||
#
|
#
|
||||||
|
eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar';
|
||||||
CREATE TABLE t2 (
|
CREATE TABLE t2 (
|
||||||
command varchar(128) not null,
|
command varchar(128) not null,
|
||||||
number int(5) not null flag=1,
|
number int(5) not null flag=1,
|
||||||
message varchar(255) flag=2)
|
message varchar(255) flag=2)
|
||||||
ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:postgresql://localhost/mtr'
|
ENGINE=CONNECT TABLE_TYPE=JDBC
|
||||||
OPTION_LIST='User=mtr,Password=mtr,Schema=public,Execsrc=1';
|
CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
|
||||||
|
OPTION_LIST='Execsrc=1';
|
||||||
|
#CONNECTION='jdbc:postgresql://localhost/mtr'
|
||||||
|
#OPTION_LIST='User=mtr,Password=mtr,Schema=public,Execsrc=1';
|
||||||
SELECT * FROM t2 WHERE command='drop table employee';
|
SELECT * FROM t2 WHERE command='drop table employee';
|
||||||
SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2))';
|
SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2))';
|
||||||
SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)";
|
SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)";
|
||||||
|
|
||||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
|
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
|
||||||
CONNECTION='jdbc:postgresql://localhost/mtr'
|
CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
|
||||||
OPTION_LIST='User=mtr,Password=mtr,Schema=public,Tabtype=TABLE,Maxres=10';
|
OPTION_LIST='Tabtype=TABLE,Maxres=10';
|
||||||
|
#CONNECTION='jdbc:postgresql://localhost/mtr'
|
||||||
|
#OPTION_LIST='User=mtr,Password=mtr,Schema=public,Tabtype=TABLE,Maxres=10';
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=columns
|
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC tabname=employee CATFUNC=columns
|
||||||
CONNECTION='jdbc:postgresql://localhost/mtr' tabname=employee
|
CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono';
|
||||||
OPTION_LIST='User=mtr,Password=mtr,Maxres=10';
|
#CONNECTION='jdbc:postgresql://localhost/mtr' tabname=employee;
|
||||||
|
#OPTION_LIST='User=mtr,Password=mtr,Maxres=10';
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
@@ -30,14 +37,18 @@ DROP TABLE t1;
|
|||||||
#
|
#
|
||||||
CREATE SERVER 'postgresql' FOREIGN DATA WRAPPER 'postgresql' OPTIONS (
|
CREATE SERVER 'postgresql' FOREIGN DATA WRAPPER 'postgresql' OPTIONS (
|
||||||
HOST 'localhost',
|
HOST 'localhost',
|
||||||
DATABASE 'mtr',
|
DATABASE 'test',
|
||||||
USER 'mtr',
|
USER 'postgres',
|
||||||
PASSWORD 'mtr',
|
PASSWORD 'tinono',
|
||||||
PORT 0,
|
PORT 0,
|
||||||
SOCKET '',
|
SOCKET '',
|
||||||
OWNER 'root');
|
OWNER 'root');
|
||||||
|
#DATABASE 'mtr',
|
||||||
|
#USER 'mtr',
|
||||||
|
#PASSWORD 'mtr',
|
||||||
|
|
||||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='postgresql/public.employee';
|
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
|
||||||
|
CONNECTION='postgresql/public.employee';
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
INSERT INTO t1 VALUES(3126,'Smith', 'Clerk', 5230.00);
|
INSERT INTO t1 VALUES(3126,'Smith', 'Clerk', 5230.00);
|
||||||
UPDATE t1 SET salary = salary + 100.00;
|
UPDATE t1 SET salary = salary + 100.00;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user