summaryrefslogtreecommitdiff
path: root/storage/csv
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
committerSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
commit65ca700def99289cc31a7040537f5aa6e12bf485 (patch)
tree97b3a07299b626c519da0e80c122b5b79b933914 /storage/csv
parent2ab57de38d13d927ddff2d51aed4af34e13998f5 (diff)
parent6e5bcca7935d3c62f84bb640e5357664a210ee12 (diff)
downloadmariadb-git-65ca700def99289cc31a7040537f5aa6e12bf485.tar.gz
merge.
checkpoint. does not compile.
Diffstat (limited to 'storage/csv')
-rw-r--r--storage/csv/Makefile.am2
-rw-r--r--storage/csv/ha_tina.cc39
-rw-r--r--storage/csv/ha_tina.h4
3 files changed, 40 insertions, 5 deletions
diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am
index 5e3587c893f..76e683ec282 100644
--- a/storage/csv/Makefile.am
+++ b/storage/csv/Makefile.am
@@ -32,7 +32,7 @@ noinst_HEADERS = ha_tina.h transparent_file.h
EXTRA_LTLIBRARIES = ha_csv.la
pkglib_LTLIBRARIES = @plugin_csv_shared_target@
ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
-ha_csv_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_PLUGIN
+ha_csv_la_CXXFLAGS = -shared $(AM_CXXFLAGS) -DMYSQL_PLUGIN
ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc
EXTRA_LIBRARIES = libcsv.a
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index e8012a86ae6..d53f33945fa 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -491,7 +491,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
*/
current_position(0), next_position(0), local_saved_data_file_length(0),
file_buff(0), chain_alloced(0), chain_size(DEFAULT_CHAIN_LENGTH),
- local_data_file_version(0), records_is_known(0)
+ local_data_file_version(0), records_is_known(0), curr_lock_type(F_UNLCK)
{
/* Set our original buffers from pre-allocated memory */
buffer.set((char*)byte_buffer, IO_SIZE, &my_charset_bin);
@@ -540,6 +540,13 @@ int ha_tina::encode_quote(uchar *buf)
ptr= attribute.ptr();
end_ptr= attribute.length() + ptr;
+ /*
+ Ensure that buffer is big enough. This will also speed things up
+ as we don't have to do any new allocation in the loop below
+ */
+ if (buffer.realloc(buffer.length() + attribute.length()*2+2))
+ return 0; // Failure
+
buffer.append('"');
for (; ptr < end_ptr; ptr++)
@@ -845,7 +852,7 @@ const char **ha_tina::bas_ext() const
for CSV engine. For more details see mysys/thr_lock.c
*/
-void tina_get_status(void* param, int concurrent_insert)
+void tina_get_status(void* param, my_bool concurrent_insert)
{
ha_tina *tina= (ha_tina*) param;
tina->get_status();
@@ -1637,6 +1644,14 @@ int ha_tina::delete_all_rows()
DBUG_RETURN(rc);
}
+int ha_tina::external_lock(THD *thd __attribute__((unused)), int lock_type)
+{
+ if (lock_type==F_UNLCK && curr_lock_type == F_WRLCK)
+ update_status();
+ curr_lock_type= lock_type;
+ return 0;
+}
+
/*
Called by the database to lock the table. Keep in mind that this
is an internal lock.
@@ -1651,7 +1666,7 @@ THR_LOCK_DATA **ha_tina::store_lock(THD *thd,
return to;
}
-/*
+/*
Create a table. You do not want to leave the table open after a call to
this (the database will call ::open() if it needs to).
*/
@@ -1769,4 +1784,20 @@ mysql_declare_plugin(csv)
NULL /* config options */
}
mysql_declare_plugin_end;
-
+maria_declare_plugin(csv)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &csv_storage_engine,
+ "CSV",
+ "Brian Aker, MySQL AB",
+ "CSV storage engine",
+ PLUGIN_LICENSE_GPL,
+ tina_init_func, /* Plugin Init */
+ tina_done_func, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+ NULL, /* status variables */
+ NULL, /* system variables */
+ "1.0", /* string version */
+ MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
+}
+maria_declare_plugin_end;
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index 845b50e3869..dc2fc743117 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -85,6 +85,8 @@ class ha_tina: public handler
MEM_ROOT blobroot;
private:
+ int curr_lock_type;
+
bool get_write_pos(my_off_t *end_pos, tina_set *closest_hole);
int open_update_temp_file_if_needed();
int init_tina_writer();
@@ -156,6 +158,8 @@ public:
bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes);
+ int external_lock(THD *thd, int lock_type);
+
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type);