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
50c3a883
Commit
50c3a883
authored
Jan 08, 2005
by
pekka@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - wl-1442 fix Time ordering
parent
0462ccfe
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
132 additions
and
4 deletions
+132
-4
mysql-test/r/ndb_index_ordered.result
mysql-test/r/ndb_index_ordered.result
+45
-0
mysql-test/t/ndb_index_ordered.test
mysql-test/t/ndb_index_ordered.test
+19
-0
ndb/include/kernel/signaldata/DictTabInfo.hpp
ndb/include/kernel/signaldata/DictTabInfo.hpp
+7
-1
ndb/include/ndbapi/NdbDictionary.hpp
ndb/include/ndbapi/NdbDictionary.hpp
+2
-1
ndb/include/util/NdbSqlUtil.hpp
ndb/include/util/NdbSqlUtil.hpp
+3
-1
ndb/src/common/util/NdbSqlUtil.cpp
ndb/src/common/util/NdbSqlUtil.cpp
+33
-0
ndb/src/ndbapi/NdbDictionary.cpp
ndb/src/ndbapi/NdbDictionary.cpp
+3
-0
ndb/src/ndbapi/NdbDictionaryImpl.cpp
ndb/src/ndbapi/NdbDictionaryImpl.cpp
+7
-0
ndb/test/include/NdbSchemaOp.hpp
ndb/test/include/NdbSchemaOp.hpp
+1
-0
ndb/tools/restore/consumer.cpp
ndb/tools/restore/consumer.cpp
+3
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+9
-1
No files found.
mysql-test/r/ndb_index_ordered.result
View file @
50c3a883
...
...
@@ -375,3 +375,48 @@ count(*)-8
select count(*)-9 from t1 use index (da) where da <= '2055-01-01';
count(*)-9
0
select count(*)-9 from t1 use index (ye) where ye > '1900';
count(*)-9
0
select count(*)-6 from t1 use index (ye) where ye >= '1955';
count(*)-6
0
select count(*)-5 from t1 use index (ye) where ye > '1955';
count(*)-5
0
select count(*)-5 from t1 use index (ye) where ye < '1970';
count(*)-5
0
select count(*)-6 from t1 use index (ye) where ye < '2001';
count(*)-6
0
select count(*)-8 from t1 use index (ye) where ye <= '2001';
count(*)-8
0
select count(*)-9 from t1 use index (ye) where ye <= '2055';
count(*)-9
0
select count(*)-9 from t1 use index (ti) where ti >= '00:00:00';
count(*)-9
0
select count(*)-7 from t1 use index (ti) where ti > '00:00:00';
count(*)-7
0
select count(*)-7 from t1 use index (ti) where ti > '05:05:05';
count(*)-7
0
select count(*)-5 from t1 use index (ti) where ti > '06:06:06';
count(*)-5
0
select count(*)-5 from t1 use index (ti) where ti < '10:11:11';
count(*)-5
0
select count(*)-6 from t1 use index (ti) where ti <= '10:11:11';
count(*)-6
0
select count(*)-8 from t1 use index (ti) where ti < '23:59:59';
count(*)-8
0
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
count(*)-9
0
mysql-test/t/ndb_index_ordered.test
View file @
50c3a883
...
...
@@ -217,3 +217,22 @@ select count(*)-5 from t1 use index (da) where da < '1970-03-03';
select
count
(
*
)
-
6
from
t1
use
index
(da) where da < '2001-01-01'
;
select
count
(
*
)
-
8
from
t1
use
index
(da) where da <= '2001-01-02'
;
select
count
(
*
)
-
9
from
t1
use
index
(da) where da <= '2055-01-01'
;
# year
select
count
(
*
)
-
9
from
t1
use
index
(ye) where ye > '1900'
;
select
count
(
*
)
-
6
from
t1
use
index
(ye) where ye >= '1955'
;
select
count
(
*
)
-
5
from
t1
use
index
(ye) where ye > '1955'
;
select
count
(
*
)
-
5
from
t1
use
index
(ye) where ye < '1970'
;
select
count
(
*
)
-
6
from
t1
use
index
(ye) where ye < '2001'
;
select
count
(
*
)
-
8
from
t1
use
index
(ye) where ye <= '2001'
;
select
count
(
*
)
-
9
from
t1
use
index
(ye) where ye <= '2055'
;
# time
select
count
(
*
)
-
9
from
t1
use
index
(ti) where ti >= '00:00:00'
;
select
count
(
*
)
-
7
from
t1
use
index
(ti) where ti > '00:00:00'
;
select
count
(
*
)
-
7
from
t1
use
index
(ti) where ti > '05:05:05'
;
select
count
(
*
)
-
5
from
t1
use
index
(ti) where ti > '06:06:06'
;
select
count
(
*
)
-
5
from
t1
use
index
(ti) where ti < '10:11:11'
;
select
count
(
*
)
-
6
from
t1
use
index
(ti) where ti <= '10:11:11'
;
select
count
(
*
)
-
8
from
t1
use
index
(ti) where ti < '23:59:59'
;
select
count
(
*
)
-
9
from
t1
use
index
(ti) where ti <= '23:59:59'
;
ndb/include/kernel/signaldata/DictTabInfo.hpp
View file @
50c3a883
...
...
@@ -310,7 +310,8 @@ public:
ExtDatetime
=
NdbSqlUtil
::
Type
::
Datetime
,
ExtDate
=
NdbSqlUtil
::
Type
::
Date
,
ExtBlob
=
NdbSqlUtil
::
Type
::
Blob
,
ExtText
=
NdbSqlUtil
::
Type
::
Text
ExtText
=
NdbSqlUtil
::
Type
::
Text
,
ExtTime
=
NdbSqlUtil
::
Type
::
Time
};
// Attribute data interpretation
...
...
@@ -440,6 +441,11 @@ public:
// head + inline part [ attr precision lower half ]
AttributeArraySize
=
(
NDB_BLOB_HEAD_SIZE
<<
2
)
+
(
AttributeExtPrecision
&
0xFFFF
);
return
true
;
case
DictTabInfo
:
:
ExtTime
:
AttributeType
=
DictTabInfo
::
StringType
;
AttributeSize
=
DictTabInfo
::
an8Bit
;
AttributeArraySize
=
3
*
AttributeExtLength
;
return
true
;
};
return
false
;
}
...
...
ndb/include/ndbapi/NdbDictionary.hpp
View file @
50c3a883
...
...
@@ -187,7 +187,8 @@ public:
Datetime
,
///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
Date
,
///< Precision down to 1 day(sizeof(Date) == 4 bytes )
Blob
,
///< Binary large object (see NdbBlob)
Text
///< Text blob
Text
,
///< Text blob
Time
=
25
///< Time without date
};
/**
...
...
ndb/include/util/NdbSqlUtil.hpp
View file @
50c3a883
...
...
@@ -83,7 +83,8 @@ public:
Datetime
,
// Precision down to 1 sec (size 8 bytes)
Date
,
// Precision down to 1 day (size 4 bytes)
Blob
,
// Blob
Text
// Text blob
Text
,
// Text blob
Time
=
25
// Time without date
};
Enum
m_typeId
;
Cmp
*
m_cmp
;
// comparison method
...
...
@@ -135,6 +136,7 @@ private:
static
Cmp
cmpDate
;
static
Cmp
cmpBlob
;
static
Cmp
cmpText
;
static
Cmp
cmpTime
;
};
#endif
ndb/src/common/util/NdbSqlUtil.cpp
View file @
50c3a883
...
...
@@ -163,6 +163,22 @@ NdbSqlUtil::m_typeList[] = {
{
Type
::
Text
,
cmpText
},
{
Type
::
Undefined
,
// 5.0 Bit
NULL
},
{
Type
::
Undefined
,
// 5.0 Longvarchar
NULL
},
{
Type
::
Undefined
,
// 5.0 Longvarbinary
NULL
},
{
Type
::
Time
,
cmpTime
}
};
...
...
@@ -559,6 +575,23 @@ NdbSqlUtil::cmpText(const void* info, const Uint32* p1, const Uint32* p2, Uint32
return
CmpUnknown
;
}
int
NdbSqlUtil
::
cmpTime
(
const
void
*
info
,
const
Uint32
*
p1
,
const
Uint32
*
p2
,
Uint32
full
,
Uint32
size
)
{
assert
(
full
>=
size
&&
size
>
0
);
union
{
const
Uint32
*
p
;
const
unsigned
char
*
v
;
}
u1
,
u2
;
u1
.
p
=
p1
;
u2
.
p
=
p2
;
// from Field_time::val_int
Int32
j1
=
sint3korr
(
u1
.
v
);
Int32
j2
=
sint3korr
(
u2
.
v
);
if
(
j1
<
j2
)
return
-
1
;
if
(
j1
>
j2
)
return
+
1
;
return
0
;
}
// check charset
bool
...
...
ndb/src/ndbapi/NdbDictionary.cpp
View file @
50c3a883
...
...
@@ -947,6 +947,9 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
out
<<
"Text("
<<
col
.
getInlineSize
()
<<
","
<<
col
.
getPartSize
()
<<
";"
<<
col
.
getStripeSize
()
<<
";"
<<
csname
<<
")"
;
break
;
case
NdbDictionary
:
:
Column
::
Time
:
out
<<
"Time"
;
break
;
case
NdbDictionary
:
:
Column
::
Undefined
:
out
<<
"Undefined"
;
break
;
...
...
ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
50c3a883
...
...
@@ -148,6 +148,12 @@ NdbColumnImpl::init(Type t)
m_length
=
4
;
m_cs
=
default_cs
;
break
;
case
Time
:
m_precision
=
0
;
m_scale
=
0
;
m_length
=
1
;
m_cs
=
NULL
;
break
;
case
Undefined
:
assert
(
false
);
break
;
...
...
@@ -1177,6 +1183,7 @@ columnTypeMapping[] = {
{
DictTabInfo
::
ExtDate
,
NdbDictionary
::
Column
::
Date
},
{
DictTabInfo
::
ExtBlob
,
NdbDictionary
::
Column
::
Blob
},
{
DictTabInfo
::
ExtText
,
NdbDictionary
::
Column
::
Text
},
{
DictTabInfo
::
ExtTime
,
NdbDictionary
::
Column
::
Time
},
{
-
1
,
-
1
}
};
...
...
ndb/test/include/NdbSchemaOp.hpp
View file @
50c3a883
...
...
@@ -577,6 +577,7 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type)
return
String
;
case
NdbDictionary
:
:
Column
::
Datetime
:
case
NdbDictionary
:
:
Column
::
Date
:
case
NdbDictionary
:
:
Column
::
Time
:
case
NdbDictionary
:
:
Column
::
Undefined
:
default:
return
NoAttrTypeDef
;
...
...
ndb/tools/restore/consumer.cpp
View file @
50c3a883
...
...
@@ -74,6 +74,9 @@ BackupConsumer::create_table_string(const TableS & table,
case
NdbDictionary
:
:
Column
::
Date
:
pos
+=
sprintf
(
buf
+
pos
,
"%s"
,
"date"
);
break
;
case
NdbDictionary
:
:
Column
::
Time
:
pos
+=
sprintf
(
buf
+
pos
,
"%s"
,
"time"
);
break
;
case
NdbDictionary
:
:
Column
::
Undefined
:
// pos += sprintf(buf+pos, "%s", "varchar binary");
return
-
1
;
...
...
sql/ha_ndbcluster.cc
View file @
50c3a883
...
...
@@ -2264,6 +2264,11 @@ void ha_ndbcluster::print_results()
fprintf
(
DBUG_FILE
,
"Date
\t
%llu"
,
value
);
break
;
}
case
NdbDictionary
:
:
Column
::
Time
:
{
Uint64
value
=
(
Uint64
)
*
field
->
ptr
;
fprintf
(
DBUG_FILE
,
"Time
\t
%llu"
,
value
);
break
;
}
case
NdbDictionary
:
:
Column
::
Blob
:
{
Uint64
len
=
0
;
ndb_blob
->
getLength
(
len
);
...
...
@@ -3327,8 +3332,11 @@ static int create_ndb_column(NDBCOL &col,
col
.
setType
(
NDBCOL
::
Date
);
col
.
setLength
(
1
);
break
;
case
MYSQL_TYPE_DATE
:
// ?
case
MYSQL_TYPE_TIME
:
col
.
setType
(
NDBCOL
::
Time
);
col
.
setLength
(
1
);
break
;
case
MYSQL_TYPE_DATE
:
// ?
case
MYSQL_TYPE_YEAR
:
col
.
setType
(
NDBCOL
::
Char
);
col
.
setLength
(
field
->
pack_length
());
...
...
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