summaryrefslogtreecommitdiff
path: root/storage/connect/filamtxt.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-08-25 18:34:51 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-08-25 18:34:51 +0200
commitda69d41a29672ca9709a16144758f9d1de9908a6 (patch)
tree3b9aef82eaa6279f54eb59f4c38272e40c593baf /storage/connect/filamtxt.cpp
parent22e8ab422cab074ba057bf7d0cf15c8c6dad2d8b (diff)
downloadmariadb-git-da69d41a29672ca9709a16144758f9d1de9908a6.tar.gz
- Make storing and sorting values using less memory allocation
(while doing indexed UPDATE/DELETE) modified: storage/connect/array.cpp storage/connect/filamtxt.cpp - Force unix like line endings modified: storage/connect/tabvct.h
Diffstat (limited to 'storage/connect/filamtxt.cpp')
-rw-r--r--storage/connect/filamtxt.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index 8f04cb358d0..a3ca20bbdb4 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -282,14 +282,17 @@ bool TXTFAM::AddListValue(PGLOBAL g, int type, void *val, PPARM *top)
PPARM pp = (PPARM)PlugSubAlloc(g, NULL, sizeof(PARM));
switch (type) {
- case TYPE_INT:
- pp->Value = PlugSubAlloc(g, NULL, sizeof(int));
- *((int*)pp->Value) = *((int*)val);
- break;
- case TYPE_STRING:
- pp->Value = PlugSubAlloc(g, NULL, strlen((char*)val) + 1);
- strcpy((char*)pp->Value, (char*)val);
+// case TYPE_INT:
+// pp->Value = PlugSubAlloc(g, NULL, sizeof(int));
+// *((int*)pp->Value) = *((int*)val);
+// break;
+ case TYPE_VOID:
+ pp->Value = (void*)*(int*)val;
break;
+// case TYPE_STRING:
+// pp->Value = PlugSubAlloc(g, NULL, strlen((char*)val) + 1);
+// strcpy((char*)pp->Value, (char*)val);
+// break;
case TYPE_PCHAR:
pp->Value = val;
break;
@@ -310,18 +313,22 @@ bool TXTFAM::AddListValue(PGLOBAL g, int type, void *val, PPARM *top)
int TXTFAM::StoreValues(PGLOBAL g, bool upd)
{
int pos = GetPos();
- bool rc = AddListValue(g, TYPE_INT, &pos, &To_Pos);
+ bool rc = AddListValue(g, TYPE_VOID, &pos, &To_Pos);
if (!rc) {
pos = GetNextPos();
- rc = AddListValue(g, TYPE_INT, &pos, &To_Sos);
+ rc = AddListValue(g, TYPE_VOID, &pos, &To_Sos);
} // endif rc
if (upd && !rc) {
+ char *buf;
+
if (Tdbp->PrepareWriting(g))
return RC_FX;
- rc = AddListValue(g, TYPE_STRING, Tdbp->GetLine(), &To_Upd);
+ buf = (char*)PlugSubAlloc(g, NULL, strlen(Tdbp->GetLine()) + 1);
+ strcpy(buf, Tdbp->GetLine());
+ rc = AddListValue(g, TYPE_PCHAR, buf, &To_Upd);
} // endif upd
return rc ? RC_FX : RC_OK;