summaryrefslogtreecommitdiff
path: root/sql/gstream.h
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2004-03-04 08:50:37 +0200
committerunknown <monty@mashka.mysql.fi>2004-03-04 08:50:37 +0200
commitafa6728a9f7c00582b3dc9e96b2dce5c4ac1e56c (patch)
treef335ad0e2c6634a947a95d62cbee9a54ee9303e8 /sql/gstream.h
parentf96960f9e1605189cc49397c64ff1cff97faedf1 (diff)
downloadmariadb-git-afa6728a9f7c00582b3dc9e96b2dce5c4ac1e56c.tar.gz
Optimized GIS functions
heap/hp_delete.c: Added comments mysql-test/r/gis.result: Updated results after name changes (all results line are unchanged) mysql-test/r/show_check.result: Update test results after fix in hp_delete.cc mysql-test/t/gis.test: Changed table names to longer, hopefully non conflicting ones. Added missing drop table mysys/hash.c: Inendation cleanup mysys/tree.c: Updated comments Decrease tree->allocated on delete (for status) sql/field.cc: Added safety checking for GIS objects sql/gstream.cc: Added copyright message Made a lot of speed/space optimizations Changed class names to be MySQL compliant sql/gstream.h: Made a lot of speed/space optimizations Changed class names to be MySQL compliant sql/item_create.cc: Indentation fixup sql/item_geofunc.cc: Use new gis interface functions and new gis class names. Simple optimizations Indentation fixups Fixed a lot of unlikely but possible errors. sql/item_geofunc.h: Moved SRID_SIZE to spatial.h sql/spatial.cc: Added copyright message Made a lot of speed/space optimizations Changed class names to be MySQL compliant sql/spatial.h: Made a lot of speed/space optimizations Changed class names to be MySQL compliant Indentation fixes Use bool instead of int as result type for functions that only return 0 or 1 sql/sql_string.cc: Simple optimizations sql/sql_string.h: Simple cleanups sql/structs.h: Added LEX_STRING_WITH_INIT (needed by spatial.cc)
Diffstat (limited to 'sql/gstream.h')
-rw-r--r--sql/gstream.h40
1 files changed, 23 insertions, 17 deletions
diff --git a/sql/gstream.h b/sql/gstream.h
index a3914a534dd..2e9513d2639 100644
--- a/sql/gstream.h
+++ b/sql/gstream.h
@@ -15,10 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-class GTextReadStream
+class Gis_read_stream
{
public:
- enum TokTypes
+ enum enum_tok_types
{
unknown,
eostream,
@@ -29,41 +29,47 @@ public:
comma
};
- GTextReadStream(const char *buffer, int size)
- :m_cur(buffer), m_limit(buffer + size), m_last_text_position(buffer),
- m_err_msg(NULL)
+ Gis_read_stream(const char *buffer, int size)
+ :m_cur(buffer), m_limit(buffer + size), m_err_msg(NULL)
{}
- GTextReadStream(): m_cur(NULL), m_limit(NULL), m_err_msg(NULL)
+ Gis_read_stream(): m_cur(NullS), m_limit(NullS), m_err_msg(NullS)
{}
-
- ~GTextReadStream()
+ ~Gis_read_stream()
{
my_free(m_err_msg, MYF(MY_ALLOW_ZERO_PTR));
}
- int get_next_toc_type() const;
- const char *get_next_word(int *word_len);
- int get_next_number(double *d);
- char get_next_symbol();
+ enum enum_tok_types get_next_toc_type();
+ bool get_next_word(LEX_STRING *);
+ bool get_next_number(double *);
+ bool check_next_symbol(char);
- const char *get_last_text_position() const
+ inline void skip_space()
{
- return m_last_text_position;
+ while (my_isspace(&my_charset_latin1, *m_cur))
+ m_cur++;
+ }
+ /* Skip next character, if match. Return 1 if no match */
+ inline bool skip_char(char skip)
+ {
+ skip_space();
+ if (*m_cur != skip)
+ return 1; /* Didn't find char */
+ m_cur++;
+ return 0;
}
-
void set_error_msg(const char *msg);
// caller should free this pointer
char *get_error_msg()
{
char *err_msg = m_err_msg;
- m_err_msg = NULL;
+ m_err_msg= NullS;
return err_msg;
}
protected:
const char *m_cur;
const char *m_limit;
- const char *m_last_text_position;
char *m_err_msg;
};