rework of patch #879693 to support 0=1 in where clause

This commit is contained in:
brianb
2004-02-08 21:54:20 +00:00
parent 4a56f06da9
commit fed589b2e7
11 changed files with 129 additions and 64 deletions

View File

@@ -27,6 +27,8 @@
#include "dmalloc.h"
#endif
GHashTable *mdb_backends;
/* Access data types */
MdbBackendType mdb_access_types[] = {
{"Unknown 0x00", 0,0,0 },

View File

@@ -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;