r20379 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20378‎ | r20379 | r20380 >
Date:23:58, 12 March 2007
Author:river
Status:old
Tags:
Comment:
field length fixes
Modified paths:
  • /trunk/skirmish/Makefile (modified) (history)
  • /trunk/skirmish/ora.cc (modified) (history)

Diff [purge]

Index: trunk/skirmish/ora.cc
@@ -152,7 +152,7 @@
153153 if (!ora_success(OCIAttrGet(p, OCI_DTYPE_PARAM, &colname, &namelen, OCI_ATTR_NAME, conn->err)))
154154 throw db::error(conn->error());
155155
156 - fields[i].name = colname;
 156+ fields[i].name.assign(colname, colname + namelen);
157157
158158 ub2 width;
159159 if (!ora_success(OCIAttrGet(p, OCI_DTYPE_PARAM, &width, 0, OCI_ATTR_DATA_SIZE, conn->err)))
@@ -160,9 +160,9 @@
161161
162162 fields[i].width = width;
163163
164 - fields[i].data.resize(width);
 164+ fields[i].data.resize(width + 1);
165165 ub2 rcode, len;
166 - if (!ora_success(OCIDefineByPos(stmt, &fields[i].define, conn->err, i + 1, &fields[i].data[0], width,
 166+ if (!ora_success(OCIDefineByPos(stmt, &fields[i].define, conn->err, i + 1, &fields[i].data[0], width + 1,
167167 SQLT_STR, &fields[i].isnull, &len, &rcode, OCI_DEFAULT)))
168168 throw db::error(conn->error());
169169 }
@@ -180,6 +180,7 @@
181181
182182 result::~result()
183183 {
 184+ OCIHandleFree(stmt, OCI_HTYPE_STMT);
184185 }
185186
186187 bool
Index: trunk/skirmish/Makefile
@@ -9,8 +9,7 @@
1010
1111 OBJS = $(SRCS:.cc=.o)
1212
13 -all:
14 - $(MAKE) skirmish
 13+all: skirmish
1514
1615 skirmish: $(OBJS)
1716 $(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)