Commit 1af7d555 authored by Antony T Curtis's avatar Antony T Curtis

Fixups for OQGraph v3 on MariaDB 10.0

parent f887a956
...@@ -9,7 +9,17 @@ INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) ...@@ -9,7 +9,17 @@ INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
FIND_PACKAGE(JUDY) FIND_PACKAGE(JUDY)
IF(NOT JUDY_FOUND) IF(NOT JUDY_FOUND)
MESSAGE(STATUS "Judy not found") MESSAGE(STATUS "Judy not found")
RETURN() include(ExternalProject)
ExternalProject_Add(
Judy
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Judy
CONFIGURE_COMMAND sh bootstrap && sh configure --with-pic --disable-shared
UPDATE_COMMAND ""
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
)
SET(JUDY_LIBRARIES ${CMAKE_CURRENT_SOURCE_DIR}/Judy/src/obj/.libs/libJudy.a)
SET(JUDY_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Judy/src)
ENDIF() ENDIF()
INCLUDE_DIRECTORIES(${JUDY_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${JUDY_INCLUDE_DIR})
...@@ -24,6 +34,8 @@ ELSE() ...@@ -24,6 +34,8 @@ ELSE()
# See if that works. On old gcc it'll fail because of -fno-rtti # See if that works. On old gcc it'll fail because of -fno-rtti
CHECK_CXX_SOURCE_COMPILES( CHECK_CXX_SOURCE_COMPILES(
" "
#define BOOST_NO_RTTI 1
#define BOOST_NO_TYPEID 1
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/property_map/property_map.hpp> #include <boost/property_map/property_map.hpp>
int main() { return 0; } int main() { return 0; }
...@@ -40,8 +52,13 @@ IF(BOOST_OK) ...@@ -40,8 +52,13 @@ IF(BOOST_OK)
STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
ENDIF(MSVC) ENDIF(MSVC)
MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc STORAGE_ENGINE ADD_DEFINITIONS(-DBOOST_NO_RTTI=1 -DBOOST_NO_TYPEID=1 -DBOOST_DISABLE_ASSERTS=1)
MODULE_ONLY)
MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc graphcore-graph.cc
oqgraph_shim.cc oqgraph_thunk.cc oqgraph_judy.cc
STORAGE_ENGINE
MODULE_ONLY
LINK_LIBRARIES ${JUDY_LIBRARIES})
ELSE(BOOST_OK) ELSE(BOOST_OK)
MESSAGE(STATUS "Requisites for OQGraph not met") MESSAGE(STATUS "Requisites for OQGraph not met")
ENDIF(BOOST_OK) ENDIF(BOOST_OK)
This diff is collapsed.
#! /bin/sh #! /bin/sh
set -x set -x
libtoolize --force --copy if [ ! -x "`which libtoolize`" ]; then
glibtoolize --force --copy
else
libtoolize --force --copy
fi
#aclocal-1.9 #aclocal-1.9
aclocal aclocal
#autoheader2.50 #autoheader2.50
autoheader autoheader
#add --include-deps if you want to bootstrap with any other compiler than gcc #add --include-deps if you want to bootstrap with any other compiler than gcc
#automake --add-missing --copy --include-deps #automake --add-missing --copy --include-deps
automake-1.9 --add-missing --force --copy automake --add-missing --force --copy
#autoconf2.50 #autoconf2.50
autoconf autoconf
rm -f config.cache rm -f config.cache
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc. # Inc.
timestamp='2007-03-06' timestamp='2006-07-02'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
...@@ -161,7 +161,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -161,7 +161,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*) machine=arm-unknown ;; arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;; sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;; sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac esac
# The Operating System including object format, if it has switched # The Operating System including object format, if it has switched
...@@ -781,7 +780,7 @@ EOF ...@@ -781,7 +780,7 @@ EOF
i*:CYGWIN*:*) i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin echo ${UNAME_MACHINE}-pc-cygwin
exit ;; exit ;;
*:MINGW*:*) i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32 echo ${UNAME_MACHINE}-pc-mingw32
exit ;; exit ;;
i*:windows32*:*) i*:windows32*:*)
...@@ -791,15 +790,12 @@ EOF ...@@ -791,15 +790,12 @@ EOF
i*:PW*:*) i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32 echo ${UNAME_MACHINE}-pc-pw32
exit ;; exit ;;
*:Interix*:[3456]*) x86:Interix*:[3456]*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE} echo i586-pc-interix${UNAME_RELEASE}
exit ;; exit ;;
EM64T | authenticamd) EM64T:Interix*:[3456]*)
echo x86_64-unknown-interix${UNAME_RELEASE} echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;; exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks echo i${UNAME_MACHINE}-pc-mks
exit ;; exit ;;
...@@ -954,9 +950,6 @@ EOF ...@@ -954,9 +950,6 @@ EOF
x86_64:Linux:*:*) x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu echo x86_64-unknown-linux-gnu
exit ;; exit ;;
xtensa:Linux:*:*)
echo xtensa-unknown-linux-gnu
exit ;;
i*86:Linux:*:*) i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so # The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent # first see if it will tell us. cd to the root directory to prevent
...@@ -1215,15 +1208,6 @@ EOF ...@@ -1215,15 +1208,6 @@ EOF
SX-6:SUPER-UX:*:*) SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE} echo sx6-nec-superux${UNAME_RELEASE}
exit ;; exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*) Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE} echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;; exit ;;
......
...@@ -114,6 +114,10 @@ ...@@ -114,6 +114,10 @@
slash. */ slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK #undef LSTAT_FOLLOWS_SLASHED_SYMLINK
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */ /* Name of package */
#undef PACKAGE #undef PACKAGE
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc. # Inc.
timestamp='2007-01-18' timestamp='2006-09-20'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
...@@ -245,12 +245,12 @@ case $basic_machine in ...@@ -245,12 +245,12 @@ case $basic_machine in
| bfin \ | bfin \
| c4x | clipper \ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| fido | fr30 | frv \ | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \ | m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep \ | maxq | mb | microblaze | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
...@@ -324,7 +324,7 @@ case $basic_machine in ...@@ -324,7 +324,7 @@ case $basic_machine in
| clipper-* | craynv-* | cydra-* \ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
...@@ -925,9 +925,6 @@ case $basic_machine in ...@@ -925,9 +925,6 @@ case $basic_machine in
basic_machine=sh-hitachi basic_machine=sh-hitachi
os=-hms os=-hms
;; ;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64) sh64)
basic_machine=sh64-unknown basic_machine=sh64-unknown
;; ;;
...@@ -1222,7 +1219,7 @@ case $os in ...@@ -1222,7 +1219,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*) | -skyos* | -haiku* | -rdos* | -toppers*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
...@@ -1417,9 +1414,6 @@ case $basic_machine in ...@@ -1417,9 +1414,6 @@ case $basic_machine in
m68*-cisco) m68*-cisco)
os=-aout os=-aout
;; ;;
mep-*)
os=-elf
;;
mips*-cisco) mips*-cisco)
os=-elf os=-elf
;; ;;
......
...@@ -37,6 +37,6 @@ namespace open_query ...@@ -37,6 +37,6 @@ namespace open_query
class Field; class Field;
typedef struct st_table TABLE; typedef struct TABLE TABLE;
#endif #endif
...@@ -454,14 +454,14 @@ namespace open_query ...@@ -454,14 +454,14 @@ namespace open_query
{ {
graph_traits<Graph>::out_edge_iterator ei, ei_end; graph_traits<Graph>::out_edge_iterator ei, ei_end;
tie(ei, ei_end)= out_edges(orig, g); tie(ei, ei_end)= out_edges(orig, g);
if ((ei= find_if(ei, ei_end, target_equals(dest, g))) != ei_end) if ((ei= std::find_if(ei, ei_end, target_equals(dest, g))) != ei_end)
return *ei; return *ei;
} }
else else
{ {
graph_traits<Graph>::in_edge_iterator ei, ei_end; graph_traits<Graph>::in_edge_iterator ei, ei_end;
tie(ei, ei_end)= in_edges(dest, g); tie(ei, ei_end)= in_edges(dest, g);
if ((ei= find_if(ei, ei_end, source_equals(orig, g))) != ei_end) if ((ei= std::find_if(ei, ei_end, source_equals(orig, g))) != ei_end)
return *ei; return *ei;
} }
return optional<Edge>(); return optional<Edge>();
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
#ifdef HAVE_OQGRAPH
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
...@@ -41,7 +40,8 @@ ...@@ -41,7 +40,8 @@
#include "table.h" #include "table.h"
#include "field.h" #include "field.h"
#include "key.h" #include "key.h"
//#include "sql_class.h" #include "unireg.h"
#include "sql_class.h"
#define OQGRAPH_STATS_UPDATE_THRESHOLD 10 #define OQGRAPH_STATS_UPDATE_THRESHOLD 10
...@@ -58,7 +58,7 @@ struct oqgraph_table_option_struct ...@@ -58,7 +58,7 @@ struct oqgraph_table_option_struct
}; };
#define ha_table_option_struct oqgraph_table_option_struct #define ha_table_option_struct oqgraph_table_option_struct
ha_create_table_option oqgraph_table_option_list[]= static const ha_create_table_option oqgraph_table_option_list[]=
{ {
HA_TOPTION_STRING("data_table", table_name), HA_TOPTION_STRING("data_table", table_name),
HA_TOPTION_STRING("origid", origid), HA_TOPTION_STRING("origid", origid),
...@@ -106,6 +106,7 @@ statistic_increment(table->in_use->status_var.X, &LOCK_status) ...@@ -106,6 +106,7 @@ statistic_increment(table->in_use->status_var.X, &LOCK_status)
#define STATISTIC_INCREMENT(X) /* nothing */ #define STATISTIC_INCREMENT(X) /* nothing */
#define MOVE(X) move_field_offset(X) #define MOVE(X) move_field_offset(X)
#define RECORDS stats.records #define RECORDS stats.records
#endif
static bool oqgraph_init_done= 0; static bool oqgraph_init_done= 0;
...@@ -116,6 +117,7 @@ static handler* oqgraph_create_handler(handlerton *hton, TABLE_SHARE *table, ...@@ -116,6 +117,7 @@ static handler* oqgraph_create_handler(handlerton *hton, TABLE_SHARE *table,
return new (mem_root) ha_oqgraph(hton, table); return new (mem_root) ha_oqgraph(hton, table);
} }
#if MYSQL_VERSION_ID >= 50100
static int oqgraph_init(handlerton *hton) static int oqgraph_init(handlerton *hton)
{ {
#else #else
...@@ -123,14 +125,8 @@ static bool oqgraph_init() ...@@ -123,14 +125,8 @@ static bool oqgraph_init()
{ {
if (have_oqgraph == SHOW_OPTION_DISABLED) if (have_oqgraph == SHOW_OPTION_DISABLED)
return 1; return 1;
if (pthread_mutex_init(&LOCK_oqgraph, MY_MUTEX_INIT_FAST)) #endif
goto error;
if (my_hash_init(&oqgraph_open_tables, &my_charset_bin, 32, 0, 0,
get_key, 0, 0))
{
pthread_mutex_destroy(&LOCK_oqgraph);
goto error;
}
#if MYSQL_VERSION_ID >= 50100 #if MYSQL_VERSION_ID >= 50100
hton->state= SHOW_OPTION_YES; hton->state= SHOW_OPTION_YES;
hton->db_type= DB_TYPE_AUTOASSIGN; hton->db_type= DB_TYPE_AUTOASSIGN;
...@@ -143,64 +139,8 @@ static bool oqgraph_init() ...@@ -143,64 +139,8 @@ static bool oqgraph_init()
static int oqgraph_fini(void *) static int oqgraph_fini(void *)
{ {
my_hash_free(&oqgraph_open_tables);
pthread_mutex_destroy(&LOCK_oqgraph);
oqgraph_init_done= FALSE; oqgraph_init_done= FALSE;
return 0;
}
#endif #endif
static OQGRAPH_INFO *get_share(const char *name, TABLE *table=0)
{
OQGRAPH_INFO *share;
uint length= strlen(name);
safe_mutex_assert_owner(&LOCK_oqgraph);
if (!(share= (OQGRAPH_INFO*) my_hash_search(&oqgraph_open_tables,
(byte*) name, length)))
{
if (!table ||
!(share= new OQGRAPH_INFO))
return 0;
share->use_count= share->key_stat_version= share->records= 0;
share->dropped= 0;
strmov(share->name, name);
if (!(share->graph= oqgraph::create()))
{
delete share;
return 0;
}
if (my_hash_insert(&oqgraph_open_tables, (byte*) share))
{
oqgraph::free(share->graph);
delete share;
return 0;
}
thr_lock_init(&share->lock);
}
share->use_count++;
return share;
}
static int free_share(OQGRAPH_INFO *share, bool drop=0)
{
safe_mutex_assert_owner(&LOCK_oqgraph);
if (!share)
return 0;
if (drop)
{
share->dropped= true;
my_hash_delete(&oqgraph_open_tables, (byte*) share);
}
if (!--share->use_count)
{
if (share->dropped)
{
thr_lock_delete(&share->lock);
oqgraph::free(share->graph);
delete share;
}
}
return 0; return 0;
} }
...@@ -363,7 +303,7 @@ bool ha_oqgraph::get_error_message(int error, String* buf) ...@@ -363,7 +303,7 @@ bool ha_oqgraph::get_error_message(int error, String* buf)
return false; return false;
} }
void ha_oqgraph::print_error(const char* fmt, ...) void ha_oqgraph::fprint_error(const char* fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
...@@ -406,18 +346,18 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked) ...@@ -406,18 +346,18 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
while (open_table_def(thd, share, 0)) while (open_table_def(thd, share, 0))
{ {
if (thd->is_error() && thd->main_da.sql_errno() != ER_NO_SUCH_TABLE) if (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE)
{ {
free_table_share(share); free_table_share(share);
return thd->main_da.sql_errno(); return thd->stmt_da->sql_errno();
} }
if (ha_create_table_from_engine(thd, table->s->db.str, options->table_name)) if (ha_create_table_from_engine(thd, table->s->db.str, options->table_name))
{ {
free_table_share(share); free_table_share(share);
return thd->main_da.sql_errno(); return thd->stmt_da->sql_errno();
} }
mysql_reset_errors(thd, 1); /*mysql_reset_errors(thd, 1);*/
thd->clear_error(); thd->clear_error();
continue; continue;
} }
...@@ -433,7 +373,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked) ...@@ -433,7 +373,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
{ {
open_table_error(share, 1, EMFILE, 0); open_table_error(share, 1, EMFILE, 0);
free_table_share(share); free_table_share(share);
print_error("VIEWs are not supported for a backing store"); fprint_error("VIEWs are not supported for a backing store");
return -1; return -1;
} }
...@@ -464,7 +404,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked) ...@@ -464,7 +404,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if (!edges->file) if (!edges->file)
{ {
print_error("Some error occurred opening table '%s'", options->table_name); fprint_error("Some error occurred opening table '%s'", options->table_name);
free_table_share(share); free_table_share(share);
return -1; return -1;
} }
...@@ -476,7 +416,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked) ...@@ -476,7 +416,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if ((*field)->cmp_type() != INT_RESULT || if ((*field)->cmp_type() != INT_RESULT ||
!((*field)->flags & NOT_NULL_FLAG)) !((*field)->flags & NOT_NULL_FLAG))
{ {
print_error("Column '%s.%s' is not a not-null integer type", fprint_error("Column '%s.%s' is not a not-null integer type",
options->table_name, options->origid); options->table_name, options->origid);
closefrm(edges, 0); closefrm(edges, 0);
free_table_share(share); free_table_share(share);
...@@ -493,7 +433,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked) ...@@ -493,7 +433,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if ((*field)->type() != origid->type() || if ((*field)->type() != origid->type() ||
!((*field)->flags & NOT_NULL_FLAG)) !((*field)->flags & NOT_NULL_FLAG))
{ {
print_error("Column '%s.%s' is not a not-null integer type", fprint_error("Column '%s.%s' is not a not-null integer type",
options->table_name, options->destid); options->table_name, options->destid);
closefrm(edges, 0); closefrm(edges, 0);
free_table_share(share); free_table_share(share);
...@@ -510,7 +450,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked) ...@@ -510,7 +450,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if ((*field)->result_type() != REAL_RESULT || if ((*field)->result_type() != REAL_RESULT ||
!((*field)->flags & NOT_NULL_FLAG)) !((*field)->flags & NOT_NULL_FLAG))
{ {
print_error("Column '%s.%s' is not a not-null real type", fprint_error("Column '%s.%s' is not a not-null real type",
options->table_name, options->weight); options->table_name, options->weight);
closefrm(edges, 0); closefrm(edges, 0);
free_table_share(share); free_table_share(share);
...@@ -522,7 +462,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked) ...@@ -522,7 +462,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if (!origid || !destid || (!weight && options->weight)) if (!origid || !destid || (!weight && options->weight))
{ {
print_error("Data columns missing on table '%s'", options->table_name); fprint_error("Data columns missing on table '%s'", options->table_name);
closefrm(edges, 0); closefrm(edges, 0);
free_table_share(share); free_table_share(share);
return -1; return -1;
...@@ -530,7 +470,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked) ...@@ -530,7 +470,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if (!(graph_share = oqgraph::create(edges, origid, destid, weight))) if (!(graph_share = oqgraph::create(edges, origid, destid, weight)))
{ {
print_error("Unable to create graph instance."); fprint_error("Unable to create graph instance.");
closefrm(edges, 0); closefrm(edges, 0);
free_table_share(share); free_table_share(share);
return -1; return -1;
...@@ -586,17 +526,17 @@ void ha_oqgraph::update_key_stats() ...@@ -586,17 +526,17 @@ void ha_oqgraph::update_key_stats()
int ha_oqgraph::write_row(byte * buf) int ha_oqgraph::write_row(byte * buf)
{ {
return ER_OPEN_AS_READONLY; return HA_ERR_TABLE_READONLY;
} }
int ha_oqgraph::update_row(const byte * old, byte * buf) int ha_oqgraph::update_row(const byte * old, byte * buf)
{ {
return ER_OPEN_AS_READONLY; return HA_ERR_TABLE_READONLY;
} }
int ha_oqgraph::delete_row(const byte * buf) int ha_oqgraph::delete_row(const byte * buf)
{ {
return ER_OPEN_AS_READONLY; return HA_ERR_TABLE_READONLY;
} }
int ha_oqgraph::index_read(byte * buf, const byte * key, uint key_len, int ha_oqgraph::index_read(byte * buf, const byte * key, uint key_len,
...@@ -807,7 +747,7 @@ int ha_oqgraph::extra(enum ha_extra_function operation) ...@@ -807,7 +747,7 @@ int ha_oqgraph::extra(enum ha_extra_function operation)
int ha_oqgraph::delete_all_rows() int ha_oqgraph::delete_all_rows()
{ {
return ER_OPEN_AS_READONLY; return HA_ERR_TABLE_READONLY;
} }
int ha_oqgraph::external_lock(THD *thd, int lock_type) int ha_oqgraph::external_lock(THD *thd, int lock_type)
...@@ -835,14 +775,6 @@ int ha_oqgraph::delete_table(const char *) ...@@ -835,14 +775,6 @@ int ha_oqgraph::delete_table(const char *)
int ha_oqgraph::rename_table(const char *, const char *) int ha_oqgraph::rename_table(const char *, const char *)
{ {
pthread_mutex_lock(&LOCK_oqgraph);
if (OQGRAPH_INFO *share= get_share(from))
{
strmov(share->name, to);
my_hash_update(&oqgraph_open_tables, (byte*) share,
(byte*) from, strlen(from));
}
pthread_mutex_unlock(&LOCK_oqgraph);
return 0; return 0;
} }
...@@ -887,7 +819,7 @@ int ha_oqgraph::create(const char *name, TABLE *table_arg, ...@@ -887,7 +819,7 @@ int ha_oqgraph::create(const char *name, TABLE *table_arg,
HA_CREATE_INFO *create_info) HA_CREATE_INFO *create_info)
{ {
oqgraph_table_option_struct *options= oqgraph_table_option_struct *options=
reinterpret_cast<oqgraph_table_option_struct*>(table->s->option_struct); reinterpret_cast<oqgraph_table_option_struct*>(table_arg->s->option_struct);
if (int res = oqgraph_check_table_structure(table_arg)) if (int res = oqgraph_check_table_structure(table_arg))
return error_code(res); return error_code(res);
...@@ -924,7 +856,3 @@ maria_declare_plugin(oqgraph) ...@@ -924,7 +856,3 @@ maria_declare_plugin(oqgraph)
MariaDB_PLUGIN_MATURITY_BETA MariaDB_PLUGIN_MATURITY_BETA
} }
maria_declare_plugin_end; maria_declare_plugin_end;
#endif
#endif
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#endif #endif
#include "handler.h" #include "handler.h"
#include "table.h"
typedef struct oqgraph_info_st OQGRAPH_INFO; typedef struct oqgraph_info_st OQGRAPH_INFO;
typedef uchar byte; typedef uchar byte;
...@@ -112,7 +113,7 @@ public: ...@@ -112,7 +113,7 @@ public:
bool get_error_message(int error, String* buf); bool get_error_message(int error, String* buf);
void print_error(const char* fmt, ...); void fprint_error(const char* fmt, ...);
private: private:
void update_key_stats(); void update_key_stats();
......
...@@ -29,7 +29,12 @@ ...@@ -29,7 +29,12 @@
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#define MYSQL_SERVER #define MYSQL_SERVER
#include "mysql_priv.h" #include "mysql_version.h"
#include "sql_base.h"
#include "table.h"
#include "field.h"
#include "key.h"
#include "unireg.h"
static int debugid = 0; static int debugid = 0;
...@@ -183,7 +188,9 @@ int oqgraph3::cursor::restore_position() ...@@ -183,7 +188,9 @@ int oqgraph3::cursor::restore_position()
return rc; return rc;
} }
if (table.vfield)
update_virtual_fields(table.in_use, &table); update_virtual_fields(table.in_use, &table);
table.file->position(table.record[0]); table.file->position(table.record[0]);
while (memcmp(table.file->ref, _position.data(), table.file->ref_length)) while (memcmp(table.file->ref, _position.data(), table.file->ref_length))
...@@ -193,6 +200,8 @@ int oqgraph3::cursor::restore_position() ...@@ -193,6 +200,8 @@ int oqgraph3::cursor::restore_position()
table.file->ha_index_end(); table.file->ha_index_end();
return rc; return rc;
} }
if (table.vfield)
update_virtual_fields(table.in_use, &table); update_virtual_fields(table.in_use, &table);
if ((_origid && vertex_id(_graph->_source->val_int()) != *_origid) || if ((_origid && vertex_id(_graph->_source->val_int()) != *_origid) ||
...@@ -203,7 +212,6 @@ int oqgraph3::cursor::restore_position() ...@@ -203,7 +212,6 @@ int oqgraph3::cursor::restore_position()
} }
table.file->position(table.record[0]); table.file->position(table.record[0]);
} }
update_virtual_fields(table.in_use, &table);
} }
else else
...@@ -217,6 +225,8 @@ int oqgraph3::cursor::restore_position() ...@@ -217,6 +225,8 @@ int oqgraph3::cursor::restore_position()
table.file->ha_rnd_end(); table.file->ha_rnd_end();
return rc; return rc;
} }
if (table.vfield)
update_virtual_fields(table.in_use, &table); update_virtual_fields(table.in_use, &table);
} }
...@@ -292,6 +302,7 @@ int oqgraph3::cursor::seek_next() ...@@ -292,6 +302,7 @@ int oqgraph3::cursor::seek_next()
return clear_position(rc); return clear_position(rc);
} }
if (table.vfield)
update_virtual_fields(table.in_use, &table); update_virtual_fields(table.in_use, &table);
_graph->_stale= true; _graph->_stale= true;
...@@ -326,6 +337,7 @@ int oqgraph3::cursor::seek_prev() ...@@ -326,6 +337,7 @@ int oqgraph3::cursor::seek_prev()
return clear_position(rc); return clear_position(rc);
} }
if (table.vfield)
update_virtual_fields(table.in_use, &table); update_virtual_fields(table.in_use, &table);
_graph->_stale= true; _graph->_stale= true;
...@@ -487,6 +499,7 @@ int oqgraph3::cursor::seek_to( ...@@ -487,6 +499,7 @@ int oqgraph3::cursor::seek_to(
return clear_position(rc); return clear_position(rc);
} }
if (table.vfield)
update_virtual_fields(table.in_use, &table); update_virtual_fields(table.in_use, &table);
if ((_origid && vertex_id(_graph->_source->val_int()) != *_origid) || if ((_origid && vertex_id(_graph->_source->val_int()) != *_origid) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment