Skip to content

Commit 5fa2a6c

Browse files
committed
Merge branch 'ob-10.0' into 10.0
2 parents 7704fde + c387e7d commit 5fa2a6c

22 files changed

+295
-90
lines changed
382 KB
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
2+
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
3+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
4+
<security>
5+
<requestedPrivileges>
6+
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
7+
</requestedPrivileges>
8+
</security>
9+
</trustInfo>
10+
</assembly>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
La ressource de manifeste a �t� mise � jour pour la derni�re fois � 15:30:20,49 le 24/04/2015
Binary file not shown.
Binary file not shown.

storage/connect/filamdbf.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ typedef struct _descriptor {
115115
/* Side effects: */
116116
/* Moves file pointer to byte 32; fills buffer at buf with */
117117
/* first 32 bytes of file. */
118+
/* Converts numeric values to platform byte ordering (LE in file) */
118119
/****************************************************************************/
119120
static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf)
120121
{
@@ -142,6 +143,11 @@ static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf)
142143
} else
143144
strcpy(g->Message, MSG(DBASE_FILE));
144145

146+
// Convert numeric fields to have them in platform byte ordering
147+
buf->Records = uint4korr(&buf->Records);
148+
buf->Headlen = uint2korr(&buf->Headlen);
149+
buf->Reclen = uint2korr(&buf->Reclen);
150+
145151
// Check last byte(s) of header
146152
if (fseek(file, buf->Headlen - dbc, SEEK_SET) != 0) {
147153
sprintf(g->Message, MSG(BAD_HEADER), fn);
@@ -565,8 +571,8 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
565571
header->Filedate[0] = datm->tm_year - 100;
566572
header->Filedate[1] = datm->tm_mon + 1;
567573
header->Filedate[2] = datm->tm_mday;
568-
header->Headlen = (ushort)hlen;
569-
header->Reclen = (ushort)reclen;
574+
int2store(&header->Headlen, hlen);
575+
int2store(&header->Reclen, reclen);
570576
descp = (DESCRIPTOR*)header;
571577

572578
// Currently only standard Xbase types are supported
@@ -729,7 +735,7 @@ bool DBFFAM::CopyHeader(PGLOBAL g)
729735
if (Headlen) {
730736
void *hdr = PlugSubAlloc(g, NULL, Headlen);
731737
size_t n, hlen = (size_t)Headlen;
732-
int pos = ftell(Stream);
738+
int pos = ftell(Stream);
733739

734740
if (fseek(Stream, 0, SEEK_SET))
735741
strcpy(g->Message, "Seek error in CopyHeader");
@@ -863,13 +869,14 @@ void DBFFAM::CloseTableFile(PGLOBAL g, bool abort)
863869

864870
if (n > Records) {
865871
// Update the number of rows in the file header
866-
char filename[_MAX_PATH];
872+
char filename[_MAX_PATH], nRecords[4];
867873

874+
int4store(&nRecords, n);
868875
PlugSetPath(filename, To_File, Tdbp->GetPath());
869876
if ((Stream= global_fopen(g, MSGID_OPEN_MODE_STRERROR, filename, "r+b")))
870877
{
871878
fseek(Stream, 4, SEEK_SET); // Get header.Records position
872-
fwrite(&n, sizeof(int), 1, Stream);
879+
fwrite(nRecords, sizeof(nRecords), 1, Stream);
873880
fclose(Stream);
874881
Stream= NULL;
875882
Records= n; // Update Records value
@@ -944,13 +951,13 @@ bool DBMFAM::AllocateBuffer(PGLOBAL g)
944951
/************************************************************************/
945952
DBFHEADER *hp = (DBFHEADER*)Memory;
946953

947-
if (Lrecl != (int)hp->Reclen) {
948-
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, hp->Reclen);
954+
if (Lrecl != (int)uint2korr(&hp->Reclen)) {
955+
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, uint2korr(&hp->Reclen));
949956
return true;
950957
} // endif Lrecl
951958

952-
Records = (int)hp->Records;
953-
Headlen = (int)hp->Headlen;
959+
Records = (int)uint4korr(&hp->Records);
960+
Headlen = (int)uint2korr(&hp->Headlen);
954961
} // endif Headlen
955962

956963
/**************************************************************************/

storage/connect/global.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ extern "C" {
118118
/* Static variables */
119119
/***********************************************************************/
120120
#if defined(STORAGE)
121-
char sys_stamp[4] = SYS_STAMP;
121+
char sys_stamp[5] = SYS_STAMP;
122122
#else
123123
extern char sys_stamp[];
124124
#endif

storage/connect/ha_connect.cc

Lines changed: 32 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -168,35 +168,21 @@
168168
#define JSONMAX 10 // JSON Default max grp size
169169

170170
extern "C" {
171-
char version[]= "Version 1.03.0006 April 12, 2015";
172-
171+
char version[]= "Version 1.03.0007 April 30, 2015";
173172
#if defined(WIN32)
174-
char compver[]= "Version 1.03.0006 " __DATE__ " " __TIME__;
173+
char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__;
175174
char slash= '\\';
176175
#else // !WIN32
177176
char slash= '/';
178177
#endif // !WIN32
179-
180-
// int trace= 0; // The general trace value
181-
// ulong xconv= 0; // The type conversion option
182-
// int zconv= 0; // The text conversion size
183178
} // extern "C"
184179

185180
#if defined(XMAP)
186181
my_bool xmap= false;
187182
#endif // XMAP
188183

189-
// uint worksize= 0;
190184
ulong ha_connect::num= 0;
191-
//int DTVAL::Shift= 0;
192185

193-
/* CONNECT system variables */
194-
//atic int conv_size= 0;
195-
//atic uint work_size= 0;
196-
//atic ulong type_conv= 0;
197-
#if defined(XMAP)
198-
//atic my_bool indx_map= 0;
199-
#endif // XMAP
200186
#if defined(XMSG)
201187
extern "C" {
202188
char *msg_path;
@@ -613,9 +599,9 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir)
613599
delete_table method in handler.cc
614600
*/
615601
static const char *ha_connect_exts[]= {
616-
".dos", ".fix", ".csv", ".bin", ".fmt", ".dbf", ".xml", ".ini", ".vec",
617-
".dnx", ".fnx", ".bnx", ".vnx", ".dbx", ".dop", ".fop", ".bop", ".vop",
618-
NULL};
602+
".dos", ".fix", ".csv", ".bin", ".fmt", ".dbf", ".xml", ".json", ".ini",
603+
".vec", ".dnx", ".fnx", ".bnx", ".vnx", ".dbx", ".dop", ".fop", ".bop",
604+
".vop", NULL};
619605

620606
/**
621607
@brief
@@ -4646,8 +4632,13 @@ int ha_connect::delete_or_rename_table(const char *name, const char *to)
46464632

46474633
} // endif pos
46484634

4649-
} else // Avoid infamous DBUG_ASSERT
4650-
thd->get_stmt_da()->reset_diagnostics_area();
4635+
} // endif open_table_def
4636+
4637+
// This below was done to avoid DBUG_ASSERT in some case that
4638+
// we don't know anymore what they were. It was suppressed because
4639+
// it did cause assertion in other cases (see MDEV-7935)
4640+
// } else // Avoid infamous DBUG_ASSERT
4641+
// thd->get_stmt_da()->reset_diagnostics_area();
46514642

46524643
free_table_share(share);
46534644
} else // Temporary file
@@ -4730,6 +4721,25 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key,
47304721
DBUG_RETURN(rows);
47314722
} // end of records_in_range
47324723

4724+
// Used to check whether a MYSQL table is created on itself
4725+
bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host,
4726+
const char *db, char *tab, const char *src, int port)
4727+
{
4728+
if (src)
4729+
return false;
4730+
else if (host && stricmp(host, "localhost") && strcmp(host, "127.0.0.1"))
4731+
return false;
4732+
else if (db && stricmp(db, s->db.str))
4733+
return false;
4734+
else if (tab && stricmp(tab, s->table_name.str))
4735+
return false;
4736+
else if (port && port != (signed)GetDefaultPort())
4737+
return false;
4738+
4739+
strcpy(g->Message, "This MySQL table is defined on itself");
4740+
return true;
4741+
} // end of CheckSelf
4742+
47334743
/**
47344744
Convert an ISO-8859-1 column name to UTF-8
47354745
*/
@@ -4891,7 +4901,7 @@ static int init_table_share(THD* thd,
48914901
oom|= sql->append(' ');
48924902
oom|= sql->append(opt->name);
48934903
oom|= sql->append('=');
4894-
oom|= sql->append(vull ? "ON" : "OFF");
4904+
oom|= sql->append(vull ? "YES" : "NO");
48954905
} // endif vull
48964906

48974907
break;
@@ -4933,25 +4943,6 @@ static int init_table_share(THD* thd,
49334943
sql->ptr(), sql->length());
49344944
} // end of init_table_share
49354945

4936-
// Used to check whether a MYSQL table is created on itself
4937-
bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host,
4938-
const char *db, char *tab, const char *src, int port)
4939-
{
4940-
if (src)
4941-
return false;
4942-
else if (host && stricmp(host, "localhost") && strcmp(host, "127.0.0.1"))
4943-
return false;
4944-
else if (db && stricmp(db, s->db.str))
4945-
return false;
4946-
else if (tab && stricmp(tab, s->table_name.str))
4947-
return false;
4948-
else if (port && port != (signed)GetDefaultPort())
4949-
return false;
4950-
4951-
strcpy(g->Message, "This MySQL table is defined on itself");
4952-
return true;
4953-
} // end of CheckSelf
4954-
49554946
/**
49564947
@brief
49574948
connect_assisted_discovery() is called when creating a table with no columns.

storage/connect/jsonudf.cpp

Lines changed: 80 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,45 @@
1717
#include "json.h"
1818

1919
#define MEMFIX 512
20+
#define UDF_EXEC_ARGS \
21+
UDF_INIT*, UDF_ARGS*, char*, unsigned long*, char*, char*
2022

2123
uint GetJsonGrpSize(void);
2224

2325
extern "C" {
2426
DllExport my_bool Json_Value_init(UDF_INIT*, UDF_ARGS*, char*);
25-
DllExport char *Json_Value(UDF_INIT*, UDF_ARGS*, char*,
26-
unsigned long*, char *, char *);
27+
DllExport char *Json_Value(UDF_EXEC_ARGS);
2728
DllExport void Json_Value_deinit(UDF_INIT*);
29+
2830
DllExport my_bool Json_Array_init(UDF_INIT*, UDF_ARGS*, char*);
29-
DllExport char *Json_Array(UDF_INIT*, UDF_ARGS*, char*,
30-
unsigned long*, char *, char *);
31+
DllExport char *Json_Array(UDF_EXEC_ARGS);
3132
DllExport void Json_Array_deinit(UDF_INIT*);
33+
3234
DllExport my_bool Json_Array_Add_init(UDF_INIT*, UDF_ARGS*, char*);
33-
DllExport char *Json_Array_Add(UDF_INIT*, UDF_ARGS*, char*,
34-
unsigned long*, char *, char *);
35+
DllExport char *Json_Array_Add(UDF_EXEC_ARGS);
3536
DllExport void Json_Array_Add_deinit(UDF_INIT*);
37+
38+
DllExport my_bool Json_Array_Delete_init(UDF_INIT*, UDF_ARGS*, char*);
39+
DllExport char *Json_Array_Delete(UDF_EXEC_ARGS);
40+
DllExport void Json_Array_Delete_deinit(UDF_INIT*);
41+
3642
DllExport my_bool Json_Object_init(UDF_INIT*, UDF_ARGS*, char*);
37-
DllExport char *Json_Object(UDF_INIT*, UDF_ARGS*, char*,
38-
unsigned long*, char *, char *);
43+
DllExport char *Json_Object(UDF_EXEC_ARGS);
3944
DllExport void Json_Object_deinit(UDF_INIT*);
45+
4046
DllExport my_bool Json_Object_Nonull_init(UDF_INIT*, UDF_ARGS*, char*);
41-
DllExport char *Json_Object_Nonull(UDF_INIT*, UDF_ARGS*, char*,
42-
unsigned long*, char *, char *);
47+
DllExport char *Json_Object_Nonull(UDF_EXEC_ARGS);
4348
DllExport void Json_Object_Nonull_deinit(UDF_INIT*);
49+
4450
DllExport my_bool Json_Array_Grp_init(UDF_INIT*, UDF_ARGS*, char*);
4551
DllExport void Json_Array_Grp_add(UDF_INIT *, UDF_ARGS *, char *, char *);
46-
DllExport char *Json_Array_Grp(UDF_INIT*, UDF_ARGS*, char*,
47-
unsigned long*, char *, char *);
52+
DllExport char *Json_Array_Grp(UDF_EXEC_ARGS);
4853
DllExport void Json_Array_Grp_clear(UDF_INIT *, char *, char *);
4954
DllExport void Json_Array_Grp_deinit(UDF_INIT*);
55+
5056
DllExport my_bool Json_Object_Grp_init(UDF_INIT*, UDF_ARGS*, char*);
5157
DllExport void Json_Object_Grp_add(UDF_INIT *, UDF_ARGS *, char *, char *);
52-
DllExport char *Json_Object_Grp(UDF_INIT*, UDF_ARGS*, char*,
53-
unsigned long*, char *, char *);
58+
DllExport char *Json_Object_Grp(UDF_EXEC_ARGS);
5459
DllExport void Json_Object_Grp_clear(UDF_INIT *, char *, char *);
5560
DllExport void Json_Object_Grp_deinit(UDF_INIT*);
5661
} // extern "C"
@@ -404,6 +409,67 @@ void Json_Array_Add_deinit(UDF_INIT* initid)
404409
PlugExit((PGLOBAL)initid->ptr);
405410
} // end of Json_Array_Add_deinit
406411

412+
/***********************************************************************/
413+
/* Add values to a Json array. */
414+
/***********************************************************************/
415+
my_bool Json_Array_Delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
416+
{
417+
unsigned long reslen, memlen;
418+
419+
if (args->arg_count != 2) {
420+
strcpy(message, "Json_Value_Delete must have 2 arguments");
421+
return true;
422+
} else if (!IsJson(args, 0)) {
423+
strcpy(message, "Json_Value_Delete first argument must be a json item");
424+
return true;
425+
} else
426+
CalcLen(args, false, reslen, memlen);
427+
428+
return JsonInit(initid, message, reslen, memlen);
429+
} // end of Json_Array_Delete_init
430+
431+
char *Json_Array_Delete(UDF_INIT *initid, UDF_ARGS *args, char *result,
432+
unsigned long *res_length, char *is_null, char *error)
433+
{
434+
char *str;
435+
int n;
436+
PJVAL jvp;
437+
PJAR arp;
438+
PGLOBAL g = (PGLOBAL)initid->ptr;
439+
440+
PlugSubSet(g, g->Sarea, g->Sarea_Size);
441+
jvp = MakeValue(g, args, 0);
442+
443+
if (jvp->GetValType() != TYPE_JAR) {
444+
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
445+
"First argument is not an array");
446+
str = args->args[0];
447+
} else if (args->arg_type[1] != INT_RESULT) {
448+
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
449+
"Second argument is not an integer");
450+
str = args->args[0];
451+
} else {
452+
n = *(int*)args->args[1];
453+
arp = jvp->GetArray();
454+
arp->DeleteValue(n - 1);
455+
arp->InitArray(g);
456+
457+
if (!(str = Serialize(g, arp, NULL, 0))) {
458+
str = strcpy(result, g->Message);
459+
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, str);
460+
} // endif str
461+
462+
} // endif's
463+
464+
*res_length = strlen(str);
465+
return str;
466+
} // end of Json_Array_Delete
467+
468+
void Json_Array_Delete_deinit(UDF_INIT* initid)
469+
{
470+
PlugExit((PGLOBAL)initid->ptr);
471+
} // end of Json_Array_Delete_deinit
472+
407473
/***********************************************************************/
408474
/* Make a Json Oject containing all the parameters. */
409475
/***********************************************************************/

storage/connect/mysql-test/connect/r/json.result

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher L
8989
UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab';
9090
SELECT * FROM t1 WHERE ISBN = '9782212090819';
9191
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
92-
9782212090819 fr applications Philippe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
93-
9782212090819 fr applications Fran�ois Knab Construire une application XML NULL NULL Eyrolles Paris 1999
92+
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
93+
9782212090819 fr applications Philippe Knab Construire une application XML NULL NULL Eyrolles Paris 1999
9494
#
9595
# To add an author a new table must be created
9696
#
@@ -104,8 +104,8 @@ William J. Pardi
104104
INSERT INTO t2 VALUES('Charles','Dickens');
105105
SELECT * FROM t1;
106106
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
107-
9782212090819 fr applications Philippe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
108-
9782212090819 fr applications Fran�ois Knab Construire une application XML NULL NULL Eyrolles Paris 1999
107+
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
108+
9782212090819 fr applications Philippe Knab Construire une application XML NULL NULL Eyrolles Paris 1999
109109
9782840825685 fr applications William J. Pardi XML en Action adapt� de l'anglais par James Guerin Microsoft Press Paris 1999
110110
9782840825685 fr applications Charles Dickens XML en Action adapt� de l'anglais par James Guerin Microsoft Press Paris 1999
111111
DROP TABLE t1;
@@ -127,11 +127,11 @@ line
127127
"SUBJECT": "applications",
128128
"AUTHOR": [
129129
{
130-
"FIRSTNAME": "Philippe",
130+
"FIRSTNAME": "Jean-Christophe",
131131
"LASTNAME": "Bernadac"
132132
},
133133
{
134-
"FIRSTNAME": "Fran�ois",
134+
"FIRSTNAME": "Philippe",
135135
"LASTNAME": "Knab"
136136
}
137137
],

0 commit comments

Comments
 (0)