Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6ec8f00a
Commit
6ec8f00a
authored
Jan 23, 2013
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added to CONNECT the missing type TYPE_BIGINT (longlong).
parent
5c8c4f4f
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1292 additions
and
107 deletions
+1292
-107
storage/connect/global.h
storage/connect/global.h
+1
-0
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+4
-1
storage/connect/myutil.cpp
storage/connect/myutil.cpp
+3
-0
storage/connect/valblk.cpp
storage/connect/valblk.cpp
+201
-0
storage/connect/valblk.h
storage/connect/valblk.h
+53
-2
storage/connect/value.cpp
storage/connect/value.cpp
+920
-102
storage/connect/value.h
storage/connect/value.h
+110
-2
No files found.
storage/connect/global.h
View file @
6ec8f00a
...
...
@@ -76,6 +76,7 @@
#define TYPE_STRING 1
#define TYPE_FLOAT 2
#define TYPE_SHORT 3
#define TYPE_BIGINT 5
#define TYPE_LIST 6
#define TYPE_INT 7
...
...
storage/connect/ha_connect.cc
View file @
6ec8f00a
...
...
@@ -1075,6 +1075,9 @@ void *ha_connect::GetColumnOption(void *field, PCOLINFO pcf)
case
MYSQL_TYPE_TIMESTAMP
:
pcf
->
Type
=
TYPE_DATE
;
break
;
case
MYSQL_TYPE_LONGLONG
:
pcf
->
Type
=
TYPE_BIGINT
;
break
;
default:
pcf
->
Type
=
TYPE_ERROR
;
}
// endswitch type
...
...
@@ -3509,6 +3512,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
case
MYSQL_TYPE_YEAR
:
case
MYSQL_TYPE_NEWDATE
:
case
MYSQL_TYPE_VARCHAR
:
case
MYSQL_TYPE_LONGLONG
:
break
;
// Ok
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_STRING
:
...
...
@@ -3518,7 +3522,6 @@ int ha_connect::create(const char *name, TABLE *table_arg,
break
;
// To be checked
case
MYSQL_TYPE_TINY
:
case
MYSQL_TYPE_BIT
:
case
MYSQL_TYPE_LONGLONG
:
case
MYSQL_TYPE_NULL
:
case
MYSQL_TYPE_ENUM
:
case
MYSQL_TYPE_SET
:
...
...
storage/connect/myutil.cpp
View file @
6ec8f00a
...
...
@@ -98,9 +98,12 @@ int MYSQLtoPLG(int mytype)
break
;
case
MYSQL_TYPE_LONG
:
case
MYSQL_TYPE_INT24
:
case
MYSQL_TYPE_ENUM
:
// ???
type
=
TYPE_INT
;
break
;
case
MYSQL_TYPE_LONGLONG
:
type
=
TYPE_BIGINT
;
break
;
case
MYSQL_TYPE_DECIMAL
:
#if !defined(ALPHA)
case
MYSQL_TYPE_NEWDECIMAL
:
...
...
storage/connect/valblk.cpp
View file @
6ec8f00a
...
...
@@ -113,6 +113,9 @@ PVBLK AllocValBlock(PGLOBAL g, void *mp, int type, int nval, int len,
case
TYPE_DATE
:
// ?????
blkp
=
new
(
g
)
DATBLK
(
mp
,
nval
);
break
;
case
TYPE_BIGINT
:
blkp
=
new
(
g
)
BIGBLK
(
mp
,
nval
);
break
;
case
TYPE_FLOAT
:
blkp
=
new
(
g
)
DBLBLK
(
mp
,
nval
,
prec
);
break
;
...
...
@@ -233,6 +236,14 @@ int CHRBLK::GetIntValue(int n)
return
atol
((
char
*
)
GetValPtrEx
(
n
));
}
// end of GetIntValue
/***********************************************************************/
/* Return the value of the nth element converted to big int. */
/***********************************************************************/
longlong
CHRBLK
::
GetBigintValue
(
int
n
)
{
return
atoll
((
char
*
)
GetValPtrEx
(
n
));
}
// end of GetIntValue
/***********************************************************************/
/* Return the value of the nth element converted to double. */
/***********************************************************************/
...
...
@@ -1027,6 +1038,196 @@ void DATBLK::SetValue(PSZ p, int n)
}
// end of SetValue
/* -------------------------- Class BIGBLK --------------------------- */
/***********************************************************************/
/* Constructor. */
/***********************************************************************/
BIGBLK
::
BIGBLK
(
void
*
mp
,
int
nval
)
:
VALBLK
(
mp
,
TYPE_BIGINT
,
nval
),
Lngp
((
longlong
*&
)
Blkp
)
{
}
// end of BIGBLK constructor
/***********************************************************************/
/* Initialization routine. */
/***********************************************************************/
void
BIGBLK
::
Init
(
PGLOBAL
g
,
bool
check
)
{
if
(
!
Blkp
)
Blkp
=
PlugSubAlloc
(
g
,
NULL
,
Nval
*
sizeof
(
longlong
));
Check
=
check
;
Global
=
g
;
}
// end of Init
/***********************************************************************/
/* Set one value in a block. */
/***********************************************************************/
void
BIGBLK
::
SetValue
(
PVAL
valp
,
int
n
)
{
CheckParms
(
valp
,
n
)
Lngp
[
n
]
=
valp
->
GetBigintValue
();
}
// end of SetValue
/***********************************************************************/
/* Set one value in a block. */
/***********************************************************************/
void
BIGBLK
::
SetValue
(
PSZ
p
,
int
n
)
{
#if defined(_DEBUG) || defined(DEBTRACE)
if
(
Check
)
{
PGLOBAL
&
g
=
Global
;
strcpy
(
g
->
Message
,
MSG
(
BAD_SET_STRING
));
longjmp
(
g
->
jumper
[
g
->
jump_level
],
Type
);
}
// endif Check
#endif
Lngp
[
n
]
=
atoll
(
p
);
}
// end of SetValue
/***********************************************************************/
/* Set one value in a block if val is less than the current value. */
/***********************************************************************/
void
BIGBLK
::
SetMin
(
PVAL
valp
,
int
n
)
{
CheckParms
(
valp
,
n
)
longlong
lval
=
valp
->
GetIntValue
();
longlong
&
lmin
=
Lngp
[
n
];
if
(
lval
<
lmin
)
lmin
=
lval
;
}
// end of SetMin
/***********************************************************************/
/* Set one value in a block if val is greater than the current value. */
/***********************************************************************/
void
BIGBLK
::
SetMax
(
PVAL
valp
,
int
n
)
{
CheckParms
(
valp
,
n
)
longlong
lval
=
valp
->
GetIntValue
();
longlong
&
lmax
=
Lngp
[
n
];
if
(
lval
>
lmax
)
lmax
=
lval
;
}
// end of SetMax
/***********************************************************************/
/* Set one value in a block from a value in another block. */
/***********************************************************************/
void
BIGBLK
::
SetValue
(
PVBLK
pv
,
int
n1
,
int
n2
)
{
CheckType
(
pv
)
Lngp
[
n1
]
=
((
BIGBLK
*
)
pv
)
->
Lngp
[
n2
];
}
// end of SetValue
/***********************************************************************/
/* Set many values in a block from values in another block. */
/***********************************************************************/
void
BIGBLK
::
SetValues
(
PVBLK
pv
,
int
k
,
int
n
)
{
CheckType
(
pv
)
longlong
*
lp
=
((
BIGBLK
*
)
pv
)
->
Lngp
;
for
(
register
int
i
=
k
;
i
<
n
;
i
++
)
Lngp
[
i
]
=
lp
[
i
];
}
// end of SetValues
/***********************************************************************/
/* This function is used by class RESCOL when calculating COUNT. */
/***********************************************************************/
void
BIGBLK
::
AddMinus1
(
PVBLK
pv
,
int
n1
,
int
n2
)
{
assert
(
Type
==
pv
->
GetType
());
Lngp
[
n1
]
+=
(((
BIGBLK
*
)
pv
)
->
Lngp
[
n2
]
-
1
);
}
// end of AddMinus1
/***********************************************************************/
/* Move one value from i to j. */
/***********************************************************************/
void
BIGBLK
::
Move
(
int
i
,
int
j
)
{
Lngp
[
j
]
=
Lngp
[
i
];
}
// end of Move
/***********************************************************************/
/* Compare a Value object with the nth value of the block. */
/***********************************************************************/
int
BIGBLK
::
CompVal
(
PVAL
vp
,
int
n
)
{
CheckParms
(
vp
,
n
)
longlong
mlv
=
Lngp
[
n
];
longlong
vlv
=
vp
->
GetBigintValue
();
return
(
vlv
>
mlv
)
?
1
:
(
vlv
<
mlv
)
?
(
-
1
)
:
0
;
}
// end of CompVal
/***********************************************************************/
/* Compare two values of the block. */
/***********************************************************************/
int
BIGBLK
::
CompVal
(
int
i1
,
int
i2
)
{
longlong
lv1
=
Lngp
[
i1
];
longlong
lv2
=
Lngp
[
i2
];
return
(
lv1
>
lv2
)
?
1
:
(
lv1
<
lv2
)
?
(
-
1
)
:
0
;
}
// end of CompVal
/***********************************************************************/
/* Get a pointer on the nth value of the block. */
/***********************************************************************/
void
*
BIGBLK
::
GetValPtr
(
int
n
)
{
CheckIndex
(
n
)
return
Lngp
+
n
;
}
// end of GetValPtr
/***********************************************************************/
/* Get a pointer on the nth value of the block. */
/***********************************************************************/
void
*
BIGBLK
::
GetValPtrEx
(
int
n
)
{
CheckIndex
(
n
)
return
Lngp
+
n
;
}
// end of GetValPtrEx
/***********************************************************************/
/* Returns index of matching value in block or -1. */
/***********************************************************************/
int
BIGBLK
::
Find
(
PVAL
vp
)
{
CheckType
(
vp
)
int
i
;
longlong
n
=
vp
->
GetBigintValue
();
for
(
i
=
0
;
i
<
Nval
;
i
++
)
if
(
n
==
Lngp
[
i
])
break
;
return
(
i
<
Nval
)
?
i
:
(
-
1
);
}
// end of Find
/***********************************************************************/
/* Returns the length of the longest string in the block. */
/***********************************************************************/
int
BIGBLK
::
GetMaxLength
(
void
)
{
char
buf
[
24
];
int
i
,
n
;
for
(
i
=
n
=
0
;
i
<
Nval
;
i
++
)
{
sprintf
(
buf
,
"%lld"
,
Lngp
[
i
]);
n
=
max
(
n
,
(
signed
)
strlen
(
buf
));
}
// endfor i
return
n
;
}
// end of GetMaxLength
/* -------------------------- Class DBLBLK --------------------------- */
/***********************************************************************/
...
...
storage/connect/valblk.h
View file @
6ec8f00a
/*************** Valblk H Declares Source Code File (.H) ***************/
/* Name: VALBLK.H Version 1.
6
*/
/* Name: VALBLK.H Version 1.
7
*/
/* */
/* (C) Copyright to the author Olivier BERTRAND 2005-201
2
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
3
*/
/* */
/* This file contains the VALBLK and derived classes declares. */
/***********************************************************************/
...
...
@@ -42,6 +42,7 @@ class VALBLK : public BLOCK {
virtual
PSZ
GetCharValue
(
int
n
);
virtual
short
GetShortValue
(
int
n
)
=
0
;
virtual
int
GetIntValue
(
int
n
)
=
0
;
virtual
longlong
GetBigintValue
(
int
n
)
=
0
;
virtual
double
GetFloatValue
(
int
n
)
=
0
;
virtual
void
ReAlloc
(
void
*
mp
,
int
n
)
{
Blkp
=
mp
;
Nval
=
n
;}
virtual
void
Reset
(
int
n
)
=
0
;
...
...
@@ -52,6 +53,7 @@ class VALBLK : public BLOCK {
// Methods
virtual
void
SetValue
(
short
sval
,
int
n
)
{
assert
(
false
);}
virtual
void
SetValue
(
int
lval
,
int
n
)
{
assert
(
false
);}
virtual
void
SetValue
(
longlong
lval
,
int
n
)
{
assert
(
false
);}
virtual
void
SetValue
(
PSZ
sp
,
int
n
)
{
assert
(
false
);}
virtual
void
SetValue
(
PVAL
valp
,
int
n
)
=
0
;
virtual
void
SetMin
(
PVAL
valp
,
int
n
)
=
0
;
...
...
@@ -98,6 +100,7 @@ class CHRBLK : public VALBLK {
virtual
PSZ
GetCharValue
(
int
n
);
virtual
short
GetShortValue
(
int
n
);
virtual
int
GetIntValue
(
int
n
);
virtual
longlong
GetBigintValue
(
int
n
);
virtual
double
GetFloatValue
(
int
n
);
virtual
void
Reset
(
int
n
);
virtual
void
SetPrec
(
int
p
)
{
Ci
=
(
p
!=
0
);}
...
...
@@ -143,6 +146,7 @@ class STRBLK : public VALBLK {
virtual
PSZ
GetCharValue
(
int
n
)
{
return
Strp
[
n
];}
virtual
short
GetShortValue
(
int
n
)
{
return
(
short
)
atoi
(
Strp
[
n
]);}
virtual
int
GetIntValue
(
int
n
)
{
return
atol
(
Strp
[
n
]);}
virtual
longlong
GetBigintValue
(
int
n
)
{
return
atoll
(
Strp
[
n
]);}
virtual
double
GetFloatValue
(
int
n
)
{
return
atof
(
Strp
[
n
]);}
virtual
void
Reset
(
int
n
)
{
Strp
[
n
]
=
NULL
;}
...
...
@@ -180,6 +184,7 @@ class SHRBLK : public VALBLK {
//virtual PSZ GetCharValue(int n);
virtual
short
GetShortValue
(
int
n
)
{
return
Shrp
[
n
];}
virtual
int
GetIntValue
(
int
n
)
{
return
(
int
)
Shrp
[
n
];}
virtual
longlong
GetBigintValue
(
int
n
)
{
return
(
longlong
)
Shrp
[
n
];}
virtual
double
GetFloatValue
(
int
n
)
{
return
(
double
)
Shrp
[
n
];}
virtual
void
Reset
(
int
n
)
{
Shrp
[
n
]
=
0
;}
...
...
@@ -187,6 +192,7 @@ class SHRBLK : public VALBLK {
virtual
void
SetValue
(
PSZ
sp
,
int
n
);
virtual
void
SetValue
(
short
sval
,
int
n
)
{
Shrp
[
n
]
=
sval
;}
virtual
void
SetValue
(
int
lval
,
int
n
)
{
Shrp
[
n
]
=
(
short
)
lval
;}
virtual
void
SetValue
(
longlong
lval
,
int
n
)
{
Shrp
[
n
]
=
(
short
)
lval
;}
virtual
void
SetValue
(
PVAL
valp
,
int
n
);
virtual
void
SetMin
(
PVAL
valp
,
int
n
);
virtual
void
SetMax
(
PVAL
valp
,
int
n
);
...
...
@@ -220,6 +226,7 @@ class LNGBLK : public VALBLK {
//virtual PSZ GetCharValue(int n);
virtual
short
GetShortValue
(
int
n
)
{
return
(
short
)
Lngp
[
n
];}
virtual
int
GetIntValue
(
int
n
)
{
return
Lngp
[
n
];}
virtual
longlong
GetBigintValue
(
int
n
)
{
return
(
longlong
)
Lngp
[
n
];}
virtual
double
GetFloatValue
(
int
n
)
{
return
(
double
)
Lngp
[
n
];}
virtual
void
Reset
(
int
n
)
{
Lngp
[
n
]
=
0
;}
...
...
@@ -227,6 +234,7 @@ class LNGBLK : public VALBLK {
virtual
void
SetValue
(
PSZ
sp
,
int
n
);
virtual
void
SetValue
(
short
sval
,
int
n
)
{
Lngp
[
n
]
=
(
int
)
sval
;}
virtual
void
SetValue
(
int
lval
,
int
n
)
{
Lngp
[
n
]
=
lval
;}
virtual
void
SetValue
(
longlong
lval
,
int
n
)
{
Lngp
[
n
]
=
(
int
)
lval
;}
virtual
void
SetValue
(
PVAL
valp
,
int
n
);
virtual
void
SetMin
(
PVAL
valp
,
int
n
);
virtual
void
SetMax
(
PVAL
valp
,
int
n
);
...
...
@@ -265,6 +273,48 @@ class DATBLK : public LNGBLK {
PVAL
Dvalp
;
// Date value used to convert string
};
// end of class DATBLK
/***********************************************************************/
/* Class LNGBLK: represents a block of int integer values. */
/***********************************************************************/
class
BIGBLK
:
public
VALBLK
{
public:
// Constructors
BIGBLK
(
void
*
mp
,
int
size
);
// Implementation
virtual
void
Init
(
PGLOBAL
g
,
bool
check
);
virtual
int
GetVlen
(
void
)
{
return
sizeof
(
longlong
);}
//virtual PSZ GetCharValue(int n);
virtual
short
GetShortValue
(
int
n
)
{
return
(
short
)
Lngp
[
n
];}
virtual
int
GetIntValue
(
int
n
)
{
return
(
int
)
Lngp
[
n
];}
virtual
longlong
GetBigintValue
(
int
n
)
{
return
Lngp
[
n
];}
virtual
double
GetFloatValue
(
int
n
)
{
return
(
double
)
Lngp
[
n
];}
virtual
void
Reset
(
int
n
)
{
Lngp
[
n
]
=
0LL
;}
// Methods
virtual
void
SetValue
(
PSZ
sp
,
int
n
);
virtual
void
SetValue
(
short
sval
,
int
n
)
{
Lngp
[
n
]
=
(
longlong
)
sval
;}
virtual
void
SetValue
(
int
lval
,
int
n
)
{
Lngp
[
n
]
=
(
longlong
)
lval
;}
virtual
void
SetValue
(
longlong
lval
,
int
n
)
{
Lngp
[
n
]
=
lval
;}
virtual
void
SetValue
(
PVAL
valp
,
int
n
);
virtual
void
SetMin
(
PVAL
valp
,
int
n
);
virtual
void
SetMax
(
PVAL
valp
,
int
n
);
virtual
void
SetValue
(
PVBLK
pv
,
int
n1
,
int
n2
);
virtual
void
SetValues
(
PVBLK
pv
,
int
k
,
int
n
);
virtual
void
AddMinus1
(
PVBLK
pv
,
int
n1
,
int
n2
);
virtual
void
Move
(
int
i
,
int
j
);
virtual
int
CompVal
(
PVAL
vp
,
int
n
);
virtual
int
CompVal
(
int
i1
,
int
i2
);
virtual
void
*
GetValPtr
(
int
n
);
virtual
void
*
GetValPtrEx
(
int
n
);
virtual
int
Find
(
PVAL
vp
);
virtual
int
GetMaxLength
(
void
);
protected:
// Members
longlong
*
const
&
Lngp
;
};
// end of class BIGBLK
/***********************************************************************/
/* Class DBLBLK: represents a block of double float values. */
/***********************************************************************/
...
...
@@ -279,6 +329,7 @@ class DBLBLK : public VALBLK {
//virtual PSZ GetCharValue(int n);
virtual
short
GetShortValue
(
int
n
)
{
return
(
short
)
Dblp
[
n
];}
virtual
int
GetIntValue
(
int
n
)
{
return
(
int
)
Dblp
[
n
];}
virtual
longlong
GetBigintValue
(
int
n
)
{
return
(
longlong
)
Dblp
[
n
];}
virtual
double
GetFloatValue
(
int
n
)
{
return
Dblp
[
n
];}
virtual
void
Reset
(
int
n
)
{
Dblp
[
n
]
=
0.0
;}
virtual
void
SetPrec
(
int
p
)
{
Prec
=
p
;}
...
...
storage/connect/value.cpp
View file @
6ec8f00a
This diff is collapsed.
Click to expand it.
storage/connect/value.h
View file @
6ec8f00a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment