mirror of
https://github.com/mdbtools/mdbtools.git
synced 2026-03-10 00:20:54 +08:00
rework of patch #879693 to support 0=1 in where clause
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
GHashTable *mdb_backends;
|
||||
|
||||
/* Access data types */
|
||||
MdbBackendType mdb_access_types[] = {
|
||||
{"Unknown 0x00", 0,0,0 },
|
||||
|
||||
@@ -119,7 +119,7 @@ mdb_find_indexable_sargs(MdbSargNode *node, gpointer data)
|
||||
* a pretty worthless test for indexes, ie NOT col1 = 3, we are
|
||||
* probably better off table scanning.
|
||||
*/
|
||||
if (mdb_is_relational_op(node->op)) {
|
||||
if (mdb_is_relational_op(node->op) && node->col) {
|
||||
//printf("op = %d value = %s\n", node->op, node->value.s);
|
||||
sarg.op = node->op;
|
||||
sarg.value = node->value;
|
||||
@@ -187,6 +187,10 @@ mdb_test_sarg_node(MdbHandle *mdb, MdbSargNode *node, MdbField *fields, int num_
|
||||
|
||||
if (mdb_is_relational_op(node->op)) {
|
||||
col = node->col;
|
||||
/* for const = const expressions */
|
||||
if (!col) {
|
||||
return (node->value.i);
|
||||
}
|
||||
elem = mdb_find_field(col->col_num, fields, num_fields);
|
||||
if (!mdb_test_sarg(mdb, col, node, &fields[elem]))
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user