diff options
author | monty@narttu.mysql.fi <> | 2000-11-15 23:00:06 +0200 |
---|---|---|
committer | monty@narttu.mysql.fi <> | 2000-11-15 23:00:06 +0200 |
commit | e69becf133867fff26b59ba74ec1ee722ce1e81e (patch) | |
tree | 622092bf596b26a1f762020729c03d573a5b216d /client | |
parent | 7a013339f84c48ea6194a35d9c00d0d549466b1d (diff) | |
download | mariadb-git-e69becf133867fff26b59ba74ec1ee722ce1e81e.tar.gz |
changed to use IO_CACHE instead of FILE
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqlimport.c | 4 | ||||
-rw-r--r-- | client/sql_string.cc | 26 | ||||
-rw-r--r-- | client/sql_string.h | 18 |
3 files changed, 26 insertions, 22 deletions
diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 68cd84fbbb7..d00c99d4061 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -25,7 +25,7 @@ ** * * ** ************************* */ -#define IMPORT_VERSION "2.5" +#define IMPORT_VERSION "2.6" #include <global.h> #include <my_sys.h> @@ -125,7 +125,7 @@ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n"); Give the column names in a comma separated list.\n\ This is same as giving columns to LOAD DATA INFILE.\n\ -C, --compress Use compression in server/client protocol\n\ - -d, --delete Deletes first all rows from table.\n\ + -d, --delete First delete all rows from table.\n\ -f, --force Continue even if we get an sql-error.\n\ -h, --host=... Connect to host.\n\ -i, --ignore If duplicate unique key was found, keep old row.\n\ diff --git a/client/sql_string.cc b/client/sql_string.cc index 7ca2d3c419e..4b9ebef21f1 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -95,17 +95,6 @@ bool String::realloc(uint32 alloc_length) return FALSE; } - -#ifdef NOT_NEEDED -bool String::set(long num) -{ - if (alloc(14)) - return TRUE; - str_length=(uint32) (int10_to_str(num,Ptr,-10)-Ptr); - return FALSE; -} -#endif - bool String::set(longlong num) { if (alloc(21)) @@ -274,6 +263,7 @@ bool String::append(const char *s,uint32 arg_length) return FALSE; } +#ifdef TO_BE_REMOVED bool String::append(FILE* file, uint32 arg_length, myf my_flags) { if (realloc(str_length+arg_length)) @@ -286,6 +276,20 @@ bool String::append(FILE* file, uint32 arg_length, myf my_flags) str_length+=arg_length; return FALSE; } +#endif + +bool String::append(IO_CACHE* file, uint32 arg_length) +{ + if (realloc(str_length+arg_length)) + return TRUE; + if (my_b_read(file, (byte*) Ptr + str_length, arg_length)) + { + shrink(str_length); + return TRUE; + } + str_length+=arg_length; + return FALSE; +} uint32 String::numchars() { diff --git a/client/sql_string.h b/client/sql_string.h index 8711cf314ad..74dbc4cc6bd 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -100,16 +100,16 @@ public: bool set(ulonglong num); bool set(double num,uint decimals=2); inline void free() + { + if (alloced) { - if (alloced) - { - alloced=0; - Alloced_length=0; - my_free(Ptr,MYF(0)); - Ptr=0; - } + alloced=0; + Alloced_length=0; + my_free(Ptr,MYF(0)); + Ptr=0; + str_length=0; /* Safety */ } - + } inline bool alloc(uint32 arg_length) { if (arg_length < Alloced_length) @@ -152,7 +152,7 @@ public: bool copy(const char *s,uint32 arg_length); // Allocate new string bool append(const String &s); bool append(const char *s,uint32 arg_length=0); - bool append(FILE* file, uint32 arg_length, myf my_flags); + bool append(IO_CACHE* file, uint32 arg_length); int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1 int strrstr(const String &search,uint32 offset=0); // Returns offset to substring or -1 bool replace(uint32 offset,uint32 arg_length,const String &to); |