Commit a0f9cbc9 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

Merge remote-tracking branch 'connect/10.2' into 10.2

parents 6d1d5c3a f9cf2df0
......@@ -326,6 +326,30 @@ IF(NOT TARGET connect)
RETURN()
ENDIF()
IF(WIN32)
IF (libmongoc-1.0_FOUND)
SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS
"/DELAYLOAD:libbson-1.0.dll /DELAYLOAD:libmongoc-1.0.dll")
ENDIF(libmongoc-1.0_FOUND)
ENDIF(WIN32)
# Install some extra files that belong to connect engine
IF(WIN32)
# install ha_connect.lib
GET_TARGET_PROPERTY(CONNECT_LOCATION connect LOCATION)
STRING(REPLACE "dll" "lib" CONNECT_LIB ${CONNECT_LOCATION})
IF(CMAKE_CONFIGURATION_TYPES)
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
CONNECT_LIB ${CONNECT_LIB})
ENDIF()
INSTALL(FILES ${CONNECT_LIB}
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
ENDIF(WIN32)
IF(NOT TARGET connect)
RETURN()
ENDIF()
# Install some extra files that belong to connect engine
IF(WIN32)
# install ha_connect.lib
......
package wrappers;
import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
public class Client {
static boolean DEBUG = true;
......@@ -58,6 +62,9 @@ public class Client {
String query;
System.out.println("Successfully connected to " + parms[1]);
s = jdi.GetQuoteString();
System.out.println("Qstr = '" + s + "'");
while ((query = getLine("Query: ", false)) != null) {
n = jdi.Execute(query);
System.out.println("Returned n = " + n);
......@@ -79,7 +86,11 @@ public class Client {
private static void PrintResult(int ncol) {
// Get result set meta data
int i;
Date date = new Date(0);
Time time = new Time(0);
Timestamp tsp = new Timestamp(0);
String columnName;
Object job;
// Get the column names; column indices start from 1
for (i = 1; i <= ncol; i++) {
......@@ -112,6 +123,7 @@ public class Client {
case java.sql.Types.VARCHAR:
case java.sql.Types.LONGVARCHAR:
case java.sql.Types.CHAR:
case 1111:
System.out.print(jdi.StringField(i, null));
break;
case java.sql.Types.INTEGER:
......@@ -120,14 +132,17 @@ public class Client {
case java.sql.Types.BIGINT:
System.out.print(jdi.BigintField(i, null));
break;
case java.sql.Types.TIMESTAMP:
System.out.print(jdi.TimestampField(i, null));
break;
case java.sql.Types.TIME:
System.out.print(jdi.TimeField(i, null));
time.setTime((long)jdi.TimeField(i, null) * 1000);
System.out.print(time);
break;
case java.sql.Types.DATE:
System.out.print(jdi.DateField(i, null));
date.setTime((long)jdi.DateField(i, null) * 1000);
System.out.print(date);
break;
case java.sql.Types.TIMESTAMP:
tsp.setTime((long)jdi.TimestampField(i, null) * 1000);
System.out.print(tsp);
break;
case java.sql.Types.SMALLINT:
System.out.print(jdi.IntField(i, null));
......@@ -141,6 +156,8 @@ public class Client {
case java.sql.Types.BOOLEAN:
System.out.print(jdi.BooleanField(i, null));
default:
job = jdi.ObjectField(i, null);
System.out.print(job.toString());
break;
} // endswitch Type
......
This diff was suppressed by a .gitattributes entry.
package wrappers;
import java.math.*;
import java.sql.*;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Date;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;
import java.util.UUID;
import javax.sql.DataSource;
......@@ -223,6 +235,24 @@ public class JdbcInterface {
} // end of SetTimestampParm
public void SetUuidParm(int i, String s) {
try {
UUID uuid;
if (s == null)
uuid = null;
else if (s.isEmpty())
uuid = UUID.randomUUID();
else
uuid = UUID.fromString(s);
pstmt.setObject(i, uuid);
} catch (Exception e) {
SetErrmsg(e);
} // end try/catch
} // end of SetUuidParm
public int SetNullParm(int i, int typ) {
int rc = 0;
......@@ -481,6 +511,8 @@ public class JdbcInterface {
System.out.println("Executing query '" + query + "'");
try {
if (rs != null)
rs.close();
rs = stmt.executeQuery(query);
rsmd = rs.getMetaData();
ncol = rsmd.getColumnCount();
......@@ -720,6 +752,22 @@ public class JdbcInterface {
return null;
} // end of ObjectField
public String UuidField(int n, String name) {
Object job;
if (rs == null) {
System.out.println("No result set");
} else
try {
job = (n > 0) ? rs.getObject(n) : rs.getObject(name);
return job.toString();
} catch (SQLException se) {
SetErrmsg(se);
} // end try/catch
return null;
} // end of UuidField
public int GetDrivers(String[] s, int mxs) {
int n = 0;
List<Driver> drivers = Collections.list(DriverManager.getDrivers());
......
package wrappers;
import java.sql.*;
import java.sql.SQLException;
import java.util.Hashtable;
import javax.sql.DataSource;
import org.postgresql.jdbc2.optional.PoolingDataSource;
public class PostgresqlInterface extends JdbcInterface {
......
......@@ -82,7 +82,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp)
if ((valtyp = pp->Type) != TYPE_STRING)
len = 1;
if (trace)
if (trace(1))
htrc("valtyp=%d len=%d\n", valtyp, len);
/*********************************************************************/
......@@ -287,7 +287,7 @@ bool ARRAY::AddValue(PGLOBAL g, PSZ strp)
return true;
} // endif Type
if (trace)
if (trace(1))
htrc(" adding string(%d): '%s'\n", Nval, strp);
//Value->SetValue_psz(strp);
......@@ -306,7 +306,7 @@ bool ARRAY::AddValue(PGLOBAL g, void *p)
return true;
} // endif Type
if (trace)
if (trace(1))
htrc(" adding pointer(%d): %p\n", Nval, p);
Vblp->SetValue((PSZ)p, Nval++);
......@@ -323,7 +323,7 @@ bool ARRAY::AddValue(PGLOBAL g, short n)
return true;
} // endif Type
if (trace)
if (trace(1))
htrc(" adding SHORT(%d): %hd\n", Nval, n);
//Value->SetValue(n);
......@@ -342,7 +342,7 @@ bool ARRAY::AddValue(PGLOBAL g, int n)
return true;
} // endif Type
if (trace)
if (trace(1))
htrc(" adding int(%d): %d\n", Nval, n);
//Value->SetValue(n);
......@@ -361,7 +361,7 @@ bool ARRAY::AddValue(PGLOBAL g, double d)
return true;
} // endif Type
if (trace)
if (trace(1))
htrc(" adding float(%d): %lf\n", Nval, d);
Value->SetValue(d);
......@@ -380,7 +380,7 @@ bool ARRAY::AddValue(PGLOBAL g, PXOB xp)
return true;
} // endif Type
if (trace)
if (trace(1))
htrc(" adding (%d) from xp=%p\n", Nval, xp);
//AddValue(xp->GetValue());
......@@ -399,7 +399,7 @@ bool ARRAY::AddValue(PGLOBAL g, PVAL vp)
return true;
} // endif Type
if (trace)
if (trace(1))
htrc(" adding (%d) from vp=%p\n", Nval, vp);
Vblp->SetValue(vp, Nval++);
......@@ -990,7 +990,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
len += strlen(tp);
} // enfor i
if (trace)
if (trace(1))
htrc("Arraylist: len=%d\n", len);
p = (char *)PlugSubAlloc(g, NULL, len);
......@@ -1003,7 +1003,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
strcat(p, (++i == Nval) ? ")" : ",");
} // enfor i
if (trace)
if (trace(1))
htrc("Arraylist: newlen=%d\n", strlen(p));
return p;
......
......@@ -241,7 +241,7 @@ int BLKFILARI::BlockEval(PGLOBAL)
break;
} // endswitch Opc
if (trace)
if (trace(1))
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);
return Result;
......@@ -338,7 +338,7 @@ int BLKFILAR2::BlockEval(PGLOBAL)
break;
} // endswitch Opc
if (trace)
if (trace(1))
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);
return Result;
......@@ -474,7 +474,7 @@ int BLKFILMR2::BlockEval(PGLOBAL)
break;
} // endswitch Opc
if (trace)
if (trace(1))
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);
return Result;
......@@ -567,7 +567,7 @@ int BLKSPCARI::BlockEval(PGLOBAL)
break;
} // endswitch Opc
if (trace)
if (trace(1))
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);
return Result;
......
......@@ -38,8 +38,8 @@ typedef class BLOCK *PBLOCK;
class DllExport BLOCK {
public:
void * operator new(size_t size, PGLOBAL g, void *p = NULL) {
// if (trace > 3)
// htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);
if (trace(256))
htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);
return (PlugSubAlloc(g, p, size));
} // end of new
......
......@@ -45,6 +45,7 @@ enum USETEMP {TMP_NO = 0, /* Never */
/***********************************************************************/
enum TYPCONV {TPC_NO = 0, /* Never */
TPC_YES = 1, /* Always */
TPC_SKIP = 2}; /* Skip TEXT columns */
TPC_FORCE = 2, /* Also convert BLOBs */
TPC_SKIP = 3}; /* Skip TEXT columns */
#endif // _CHKLVL_DEFINED_
......@@ -280,7 +280,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
all = true;
if (Pcg->Pipe) {
if (trace)
if (trace(1))
htrc("Pipeline: %s\n", options);
p = strrchr(options, ']');
......@@ -330,7 +330,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
*(char*)p = ']'; // Restore Colist for discovery
p = s->GetStr();
if (trace)
if (trace(33))
htrc("New Pipeline: %s\n", p);
Query = bson_new_from_json((const uint8_t *)p, -1, &Error);
......@@ -350,7 +350,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
} else {
if (Pcg->Filter || filp) {
if (trace) {
if (trace(1)) {
if (Pcg->Filter)
htrc("Filter: %s\n", Pcg->Filter);
......@@ -377,7 +377,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
tp->SetFilter(NULL); // Not needed anymore
} // endif To_Filter
if (trace)
if (trace(33))
htrc("selector: %s\n", s->GetStr());
s->Resize(s->GetLength() + 1);
......@@ -393,7 +393,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
if (!all) {
if (options && *options) {
if (trace)
if (trace(1))
htrc("options=%s\n", options);
p = options;
......@@ -450,10 +450,10 @@ int CMgoConn::ReadNext(PGLOBAL g)
if (!Cursor && MakeCursor(g)) {
rc = RC_FX;
} else if (mongoc_cursor_next(Cursor, &Document)) {
if (trace > 1) {
if (trace(512)) {
bson_iter_t iter;
ShowDocument(&iter, Document, "");
} else if (trace == 1)
} else if (trace(1))
htrc("%s\n", GetDocument(g));
} else if (mongoc_cursor_error(Cursor, &Error)) {
......@@ -589,7 +589,7 @@ int CMgoConn::Write(PGLOBAL g)
if (DocWrite(g, Fpc))
return RC_FX;
if (trace) {
if (trace(2)) {
char *str = bson_as_json(Fpc->Child, NULL);
htrc("Inserting: %s\n", str);
bson_free(str);
......@@ -623,7 +623,7 @@ int CMgoConn::Write(PGLOBAL g)
} // endif iter
if (b) {
if (trace) {
if (trace(2)) {
char *str = bson_as_json(query, NULL);
htrc("update query: %s\n", str);
bson_free(str);
......
......@@ -76,7 +76,7 @@ COLBLK::COLBLK(PCOL col1, PTDB tdbp)
//To_Orig = col1;
To_Tdb = tdbp;
if (trace > 1)
if (trace(2))
htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
if (tdbp)
......@@ -115,7 +115,7 @@ bool COLBLK::SetFormat(PGLOBAL, FORMAT& fmt)
{
fmt = Format;
if (trace > 1)
if (trace(2))
htrc("COLBLK: %p format=%c(%d,%d)\n",
this, *fmt.Type, fmt.Length, fmt.Prec);
......@@ -128,7 +128,7 @@ bool COLBLK::SetFormat(PGLOBAL, FORMAT& fmt)
/***********************************************************************/
bool COLBLK::Eval(PGLOBAL g)
{
if (trace > 1)
if (trace(2))
htrc("Col Eval: %s status=%.4X\n", Name, Status);
if (!GetStatus(BUF_READ)) {
......@@ -165,7 +165,7 @@ bool COLBLK::InitValue(PGLOBAL g)
AddStatus(BUF_READY);
Value->SetNullable(Nullable);
if (trace > 1)
if (trace(2))
htrc(" colp=%p type=%d value=%p coluse=%.4X status=%.4X\n",
this, Buf_Type, Value, ColUse, Status);
......
......@@ -92,7 +92,7 @@ void CntEndDB(PGLOBAL g)
free(dbuserp);
if (trace)
if (trace(1))
htrc("CntEndDB: Freeing Dup\n");
g->Activityp->Aptr = NULL;
......@@ -112,14 +112,14 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
bool rc= false;
PDBUSER dbuserp= PlgGetUser(g);
if (trace) {
if (trace(1)) {
printf("CntCheckDB: dbuserp=%p\n", dbuserp);
} // endif trace
if (!dbuserp || !handler)
return true;
if (trace)
if (trace(1))
printf("cat=%p oldhandler=%p newhandler=%p\n", dbuserp->Catalog,
(dbuserp->Catalog) ? ((MYCAT*)dbuserp->Catalog)->GetHandler() : NULL,
handler);
......@@ -150,7 +150,7 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
/*********************************************************************/
sprintf(g->Message, MSG(DATABASE_LOADED), "???");
if (trace)
if (trace(1))
printf("msg=%s\n", g->Message);
return rc;
......@@ -198,7 +198,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
PDBUSER dup = PlgGetUser(g);
volatile PCATLG cat = (dup) ? dup->Catalog : NULL; // Safe over throw
if (trace)
if (trace(1))
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
if (!cat)
......@@ -208,7 +208,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
// Get table object from the catalog
tabp = new(g) XTAB(name);
if (trace)
if (trace(1))
printf("CntGetTDB: tabp=%p\n", tabp);
// Perhaps this should be made thread safe
......@@ -218,13 +218,13 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
printf("CntGetTDB: %s\n", g->Message);
} catch (int n) {
if (trace)
if (trace(1))
htrc("Exception %d: %s\n", n, g->Message);
} catch (const char *msg) {
strcpy(g->Message, msg);
} // end catch
if (trace)
if (trace(1))
printf("Returning tdbp=%p mode=%d\n", tdbp, mode);
return tdbp;
......@@ -243,7 +243,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
//PCOLUMN cp;
PDBUSER dup= PlgGetUser(g);
if (trace)
if (trace(1))
printf("CntOpenTable: tdbp=%p mode=%d\n", tdbp, mode);
if (!tdbp) {
......@@ -260,7 +260,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
} else for (p = c1; *p; p += n) {
// Allocate only used column blocks
if (trace)
if (trace(1))
printf("Allocating column %s\n", p);
g->Message[0] = 0; // To check whether ColDB made an error message
......@@ -325,7 +325,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
tdbp->SetSetCols(tdbp->GetColumns());
// Now do open the physical table
if (trace)
if (trace(1))
printf("Opening table %s in mode %d tdbp=%p\n",
tdbp->GetName(), mode, tdbp);
......@@ -341,7 +341,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
} // endif del
if (trace)
if (trace(1))
printf("About to open the table: tdbp=%p\n", tdbp);
if (mode != MODE_ANY && mode != MODE_ALTER) {
......@@ -356,7 +356,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
rcop = false;
} catch (int n) {
if (trace)
if (trace(1))
htrc("Exception %d: %s\n", n, g->Message);
} catch (const char *msg) {
strcpy(g->Message, msg);
......@@ -399,12 +399,13 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr)
} // endfor colp
} catch (int n) {
if (trace)
if (trace(1))
printf("Error %d reading columns: %s\n", n, g->Message);
rc = RC_FX;
} catch (const char *msg) {
strcpy(g->Message, msg);
rc = RC_NF;
} // end catch
return rc;
......@@ -549,7 +550,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
return rc;
} // endif !USE_OPEN
if (trace)
if (trace(1))
printf("CntCloseTable: tdbp=%p mode=%d nox=%d abort=%d\n",
tdbp, tdbp->GetMode(), nox, abort);
......@@ -579,11 +580,11 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
tdbp->CloseDB(g);
tdbp->SetAbort(false);
if (trace > 1)
if (trace(2))
printf("Table %s closed\n", tdbp->GetName());
if (!nox && tdbp->GetMode() != MODE_READ && tdbp->GetMode() != MODE_ANY) {
if (trace > 1)
if (trace(2))
printf("About to reset opt\n");
if (!tdbp->IsRemote()) {
......@@ -603,7 +604,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
rc = RC_FX;
} // end catch
if (trace > 1)
if (trace(2))
htrc("Done rc=%d\n", rc);
return (rc == RC_OK || rc == RC_INFO) ? 0 : rc;
......@@ -922,7 +923,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
valp->SetBinValue((void*)p);
#endif // !WORDS_BIGENDIAN
if (trace) {
if (trace(1)) {
char bf[32];
printf("i=%d n=%d key=%s\n", i, n, valp->GetCharString(bf));
} // endif trace
......@@ -944,7 +945,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
xbp->SetNval(n);
if (trace)
if (trace(1))
printf("xbp=%p Nval=%d i=%d incl=%d\n", xbp, n, i, incl[i]);
k[i]= xbp->Range(g, i + 1, incl[i]);
......@@ -953,7 +954,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
} // endfor i
if (trace)
if (trace(1))
printf("k1=%d k0=%d\n", k[1], k[0]);
return k[1] - k[0];
......
......@@ -90,7 +90,7 @@ int MAPFAM::GetFileLength(PGLOBAL g)
len = (To_Fb && To_Fb->Count) ? To_Fb->Length : TXTFAM::GetFileLength(g);
if (trace)
if (trace(1))
htrc("Mapped file length=%d\n", len);
return len;
......@@ -128,7 +128,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
&& fp->Count && fp->Mode == mode)
break;
if (trace)
if (trace(1))
htrc("Mapping file, fp=%p\n", fp);
} else
......@@ -166,7 +166,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
"map", (int) rc, filename);
if (trace)
if (trace(1))
htrc("CreateFileMap: %s\n", g->Message);
return (mode == MODE_READ && rc == ENOENT)
......@@ -227,7 +227,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
Fpos = Mempos = Memory;
Top = Memory + len;
if (trace)
if (trace(1))
htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
fp, fp->Count, Memory, len, Top);
......@@ -407,7 +407,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
{
int n;
if (trace)
if (trace(1))
htrc("MAP DeleteDB: irc=%d mempos=%p tobuf=%p Tpos=%p Spos=%p\n",
irc, Mempos, To_Buf, Tpos, Spos);
......@@ -417,7 +417,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/*******************************************************************/
Fpos = Top;
if (trace)
if (trace(1))
htrc("Fpos placed at file top=%p\n", Fpos);
} // endif irc
......@@ -435,7 +435,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
memmove(Tpos, Spos, n);
Tpos += n;
if (trace)
if (trace(1))
htrc("move %d bytes\n", n);
} // endif n
......@@ -443,7 +443,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
if (irc == RC_OK) {
Spos = Mempos; // New start position
if (trace)
if (trace(1))
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
} else if (To_Fb) { // Can be NULL for deleted files
......@@ -473,7 +473,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
return RC_FX;
} // endif
if (trace)
if (trace(1))
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
if (!SetEndOfFile(fp->Handle)) {
......@@ -511,7 +511,7 @@ void MAPFAM::CloseTableFile(PGLOBAL g, bool)
PlugCloseFile(g, To_Fb);
//To_Fb = NULL; // To get correct file size in Cardinality
if (trace)
if (trace(1))
htrc("MAP Close: closing %s count=%d\n",
To_File, (To_Fb) ? To_Fb->Count : 0);
......
......@@ -203,7 +203,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
PQRYRES qrp;
PCOLRES crp;
if (trace)
if (trace(1))
htrc("DBFColumns: File %s\n", SVP(fn));
if (!info) {
......@@ -245,7 +245,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
return qrp;
} // endif info
if (trace) {
if (trace(1)) {
htrc("Structure of %s\n", filename);
htrc("headlen=%hd reclen=%hd degree=%d\n",
mainhead.Headlen(), mainhead.Reclen(), fields);
......@@ -271,7 +271,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
} else
len = thisfield.Length;
if (trace)
if (trace(1))
htrc("%-11s %c %6ld %3d %2d %3d %3d\n",
thisfield.Name, thisfield.Type, thisfield.Offset, len,
thisfield.Decimals, thisfield.Setfield, thisfield.Mdxfield);
......@@ -522,14 +522,14 @@ bool DBFFAM::OpenTableFile(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath());
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
return (mode == MODE_READ && errno == ENOENT)
? PushWarning(g, Tdbp) : true;
} // endif Stream
if (trace)
if (trace(1))
htrc("File %s is open in mode %s\n", filename, opmode);
To_Fb = dbuserp->Openlist; // Keep track of File block
......@@ -938,7 +938,7 @@ void DBFFAM::CloseTableFile(PGLOBAL g, bool abort)
rc = PlugCloseFile(g, To_Fb);
fin:
if (trace)
if (trace(1))
htrc("DBF CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
To_File, mode, wrc, rc);
......
......@@ -322,7 +322,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
return RC_FX;
} // endif fseek
if (trace > 1)
if (trace(2))
htrc("File position is now %d\n", ftell(Stream));
if (Padded)
......@@ -344,7 +344,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#endif
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
return RC_FX;
......@@ -361,7 +361,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
/***********************************************************************/
int FIXFAM::WriteBuffer(PGLOBAL g)
{
if (trace > 1)
if (trace(2))
htrc("FIX WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
......@@ -374,7 +374,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
return RC_OK; // We write only full blocks
} // endif CurNum
if (trace > 1)
if (trace(2))
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
// Now start the writing process.
......@@ -388,7 +388,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
CurNum = 0;
Tdbp->SetLine(To_Buf);
if (trace > 1)
if (trace(2))
htrc("write done\n");
} else { // Mode == MODE_UPDATE
......@@ -431,7 +431,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
/* file, and at the end erase all trailing records. */
/* This will be experimented. */
/*********************************************************************/
if (trace > 1)
if (trace(2))
htrc("DOS DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
irc, UseTemp, Fpos, Tpos, Spos);
......@@ -441,7 +441,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
/*******************************************************************/
Fpos = Tdbp->Cardinality(g);
if (trace > 1)
if (trace(2))
htrc("Fpos placed at file end=%d\n", Fpos);
} else // Fpos is the deleted line position
......@@ -491,7 +491,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
OldBlk = -2; // To force fseek to be executed on next block
} // endif moved
if (trace > 1)
if (trace(2))
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
} else {
......@@ -540,7 +540,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
close(h);
if (trace > 1)
if (trace(2))
htrc("done, h=%d irc=%d\n", h, irc);
} // endif UseTemp
......@@ -572,7 +572,7 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
req = (size_t)MY_MIN(n, Dbflen);
len = fread(DelBuf, Lrecl, req, Stream);
if (trace > 1)
if (trace(2))
htrc("after read req=%d len=%d\n", req, len);
if (len != req) {
......@@ -591,13 +591,13 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
return true;
} // endif
if (trace > 1)
if (trace(2))
htrc("after write pos=%d\n", ftell(Stream));
Tpos += (int)req;
Spos += (int)req;
if (trace > 1)
if (trace(2))
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
*b = true;
......@@ -648,7 +648,7 @@ void FIXFAM::CloseTableFile(PGLOBAL g, bool abort)
rc = PlugCloseFile(g, To_Fb);
fin:
if (trace)
if (trace(1))
htrc("FIX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
To_File, mode, wrc, rc);
......@@ -718,7 +718,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)),
DWORD nbr, drc, len = (DWORD)req;
bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
if (trace > 1)
if (trace(2))
htrc("after read req=%d brc=%d nbr=%d\n", req, brc, nbr);
if (!brc) {
......@@ -730,7 +730,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)),
(LPTSTR)buf, sizeof(buf), NULL);
sprintf(g->Message, MSG(READ_ERROR), To_File, buf);
if (trace > 1)
if (trace(2))
htrc("BIGREAD: %s\n", g->Message);
rc = -1;
......@@ -757,7 +757,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
DWORD nbw, drc, len = (DWORD)req;
bool brc = WriteFile(h, inbuf, len, &nbw, NULL);
if (trace > 1)
if (trace(2))
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
if (!brc || nbw != len) {
......@@ -775,7 +775,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf);
if (trace > 1)
if (trace(2))
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
nbw, len, drc, g->Message);
......@@ -790,7 +790,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno));
if (trace > 1)
if (trace(2))
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
nbw, len, errno, g->Message);
......@@ -828,7 +828,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath());
if (trace)
if (trace(1))
htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode);
#if defined(__WIN__)
......@@ -888,7 +888,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
} else
rc = 0;
if (trace > 1)
if (trace(2))
htrc(" rc=%d access=%p share=%p creation=%d handle=%p fn=%s\n",
rc, access, share, creation, Hfile, filename);
......@@ -942,7 +942,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
} else
rc = 0;
if (trace > 1)
if (trace(2))
htrc(" rc=%d oflag=%p tmode=%p handle=%p fn=%s\n",
rc, oflag, tmode, Hfile, filename);
......@@ -1026,11 +1026,11 @@ int BGXFAM::Cardinality(PGLOBAL g)
if (Hfile == INVALID_HANDLE_VALUE) {
int h = open64(filename, O_RDONLY, 0);
if (trace)
if (trace(1))
htrc(" h=%d\n", h);
if (h == INVALID_HANDLE_VALUE) {
if (trace)
if (trace(1))
htrc(" errno=%d ENOENT=%d\n", errno, ENOENT);
if (errno != ENOENT) {
......@@ -1074,7 +1074,7 @@ int BGXFAM::Cardinality(PGLOBAL g)
} else
card = (int)(fsize / (BIGINT)Lrecl); // Fixed length file
if (trace)
if (trace(1))
htrc(" Computed max_K=%d fsize=%lf lrecl=%d\n",
card, (double)fsize, Lrecl);
......@@ -1181,7 +1181,7 @@ int BGXFAM::ReadBuffer(PGLOBAL g)
if (BigSeek(g, Hfile, (BIGINT)Fpos * (BIGINT)Lrecl))
return RC_FX;
if (trace > 1)
if (trace(2))
htrc("File position is now %d\n", Fpos);
nbr = BigRead(g, Hfile, To_Buf, (Padded) ? Blksize : Lrecl * Nrec);
......@@ -1205,7 +1205,7 @@ int BGXFAM::ReadBuffer(PGLOBAL g)
/***********************************************************************/
int BGXFAM::WriteBuffer(PGLOBAL g)
{
if (trace > 1)
if (trace(2))
htrc("BIG WriteDB: Mode=%d buf=%p line=%p Nrec=%d Rbuf=%d CurNum=%d\n",
Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
......@@ -1218,7 +1218,7 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
return RC_OK; // We write only full blocks
} // endif CurNum
if (trace > 1)
if (trace(2))
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
// Now start the writing process.
......@@ -1229,7 +1229,7 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
CurNum = 0;
Tdbp->SetLine(To_Buf);
if (trace > 1)
if (trace(2))
htrc("write done\n");
} else { // Mode == MODE_UPDATE
......@@ -1270,7 +1270,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
/* file, and at the end erase all trailing records. */
/* This will be experimented. */
/*********************************************************************/
if (trace > 1)
if (trace(2))
htrc("BGX DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
irc, UseTemp, Fpos, Tpos, Spos);
......@@ -1280,7 +1280,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
/*******************************************************************/
Fpos = Tdbp->Cardinality(g);
if (trace > 1)
if (trace(2))
htrc("Fpos placed at file end=%d\n", Fpos);
} else // Fpos is the deleted line position
......@@ -1318,7 +1318,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
return RC_FX;
if (irc == RC_OK) {
if (trace)
if (trace(1))
assert(Spos == Fpos);
Spos++; // New start position is on next line
......@@ -1330,7 +1330,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
OldBlk = -2; // To force fseek to be executed on next block
} // endif moved
if (trace > 1)
if (trace(2))
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
} else if (irc != RC_OK) {
......@@ -1459,7 +1459,7 @@ bool BGXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
Tpos += (int)req;
Spos += (int)req;
if (trace > 1)
if (trace(2))
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
*b = true;
......@@ -1510,7 +1510,7 @@ void BGXFAM::CloseTableFile(PGLOBAL g, bool abort)
rc = PlugCloseFile(g, To_Fb);
fin:
if (trace)
if (trace(1))
htrc("BGX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
To_File, mode, wrc, rc);
......
......@@ -203,7 +203,7 @@ bool GZFAM::AllocateBuffer(PGLOBAL g)
Buflen = Lrecl + 2; // Lrecl does not include CRLF
//Buflen *= ((Mode == MODE_DELETE) ? DOS_BUFF_LEN : 1); NIY
if (trace)
if (trace(1))
htrc("SubAllocating a buffer of %d bytes\n", Buflen);
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
......@@ -347,7 +347,7 @@ int GZFAM::ReadBuffer(PGLOBAL g)
} else
rc = Zerror(g);
if (trace > 1)
if (trace(2))
htrc(" Read: '%s' rc=%d\n", To_Buf, rc);
return rc;
......@@ -389,7 +389,7 @@ void GZFAM::CloseTableFile(PGLOBAL, bool)
{
int rc = gzclose(Zfile);
if (trace)
if (trace(1))
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
Zfile = NULL; // So we can know whether table is open
......@@ -702,7 +702,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
} else
rc = gzclose(Zfile);
if (trace)
if (trace(1))
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
Zfile = NULL; // So we can know whether table is open
......@@ -1382,7 +1382,7 @@ void ZLBFAM::CloseTableFile(PGLOBAL g, bool)
} else
rc = fclose(Stream);
if (trace)
if (trace(1))
htrc("ZLB CloseTableFile: closing %s mode=%d rc=%d\n",
To_File, Tdbp->GetMode(), rc);
......@@ -1408,7 +1408,7 @@ void ZLBFAM::Rewind(void)
rewind(Stream);
if (!(st = fread(Zlenp, sizeof(int), 1, Stream)) && trace)
if (!(st = fread(Zlenp, sizeof(int), 1, Stream)) && trace(1))
htrc("fread error %d in Rewind", errno);
fseek(Stream, *Zlenp + sizeof(int), SEEK_SET);
......
......@@ -194,12 +194,12 @@ int TXTFAM::GetFileLength(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath());
h= global_open(g, MSGID_OPEN_MODE_STRERROR, filename, _O_RDONLY);
if (trace)
if (trace(1))
htrc("GetFileLength: fn=%s h=%d\n", filename, h);
if (h == -1) {
if (errno != ENOENT) {
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
len = -1;
......@@ -249,7 +249,7 @@ int TXTFAM::Cardinality(PGLOBAL g)
} // endif Padded
if (trace)
if (trace(1))
htrc(" Computed max_K=%d Filen=%d lrecl=%d\n",
card, len, Lrecl);
......@@ -390,7 +390,7 @@ int TXTFAM::UpdateSortedRows(PGLOBAL g)
return RC_OK;
err:
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
return RC_FX;
......@@ -439,7 +439,7 @@ int TXTFAM::DeleteSortedRows(PGLOBAL g)
return RC_OK;
err:
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
return RC_FX;
......@@ -512,7 +512,7 @@ int DOSFAM::GetFileLength(PGLOBAL g)
if ((len = _filelength(_fileno(Stream))) < 0)
sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", To_File);
if (trace)
if (trace(1))
htrc("File length=%d\n", len);
return len;
......@@ -598,14 +598,14 @@ bool DOSFAM::OpenTableFile(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath());
if (!(Stream = PlugOpenFile(g, filename, opmode))) {
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
return (mode == MODE_READ && errno == ENOENT)
? PushWarning(g, Tdbp) : true;
} // endif Stream
if (trace)
if (trace(1))
htrc("File %s open Stream=%p mode=%s\n", filename, Stream, opmode);
To_Fb = dbuserp->Openlist; // Keep track of File block
......@@ -628,7 +628,7 @@ bool DOSFAM::AllocateBuffer(PGLOBAL g)
// Lrecl does not include line ending
Buflen = Lrecl + Ending + ((Bin) ? 1 : 0) + 1; // Sergei
if (trace)
if (trace(1))
htrc("SubAllocating a buffer of %d bytes\n", Buflen);
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
......@@ -768,7 +768,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
if (!Stream)
return RC_EF;
if (trace > 1)
if (trace(2))
htrc("ReadBuffer: Tdbp=%p To_Line=%p Placed=%d\n",
Tdbp, Tdbp->To_Line, Placed);
......@@ -782,7 +782,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
CurBlk = (int)Rows++;
if (trace > 1)
if (trace(2))
htrc("ReadBuffer: CurBlk=%d\n", CurBlk);
/********************************************************************/
......@@ -803,14 +803,14 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
} else
Placed = false;
if (trace > 1)
if (trace(2))
htrc(" About to read: stream=%p To_Buf=%p Buflen=%d\n",
Stream, To_Buf, Buflen);
if (fgets(To_Buf, Buflen, Stream)) {
p = To_Buf + strlen(To_Buf) - 1;
if (trace > 1)
if (trace(2))
htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p);
#if defined(__WIN__)
......@@ -838,7 +838,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
} else if (*p == '\n')
*p = '\0'; // Eliminate ending new-line character
if (trace > 1)
if (trace(2))
htrc(" To_Buf='%s'\n", To_Buf);
strcpy(Tdbp->To_Line, To_Buf);
......@@ -853,13 +853,13 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
#endif
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
rc = RC_FX;
} // endif's fgets
if (trace > 1)
if (trace(2))
htrc("ReadBuffer: rc=%d\n", rc);
IsRead = true;
......@@ -895,7 +895,7 @@ int DOSFAM::WriteBuffer(PGLOBAL g)
/*******************************************************************/
curpos = ftell(Stream);
if (trace)
if (trace(1))
htrc("Last : %d cur: %d\n", Fpos, curpos);
if (UseTemp) {
......@@ -937,7 +937,7 @@ int DOSFAM::WriteBuffer(PGLOBAL g)
return RC_FX;
} // endif
if (trace)
if (trace(1))
htrc("write done\n");
return RC_OK;
......@@ -960,7 +960,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
/* file, and at the end erase all trailing records. */
/* This will be experimented. */
/*********************************************************************/
if (trace)
if (trace(1))
htrc(
"DOS DeleteDB: rc=%d UseTemp=%d curpos=%d Fpos=%d Tpos=%d Spos=%d\n",
irc, UseTemp, curpos, Fpos, Tpos, Spos);
......@@ -972,7 +972,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
fseek(Stream, 0, SEEK_END);
Fpos = ftell(Stream);
if (trace)
if (trace(1))
htrc("Fpos placed at file end=%d\n", Fpos);
} // endif irc
......@@ -1015,7 +1015,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
Spos = GetNextPos(); // New start position
if (trace)
if (trace(1))
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
} else {
......@@ -1058,7 +1058,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
close(h);
if (trace)
if (trace(1))
htrc("done, h=%d irc=%d\n", h, irc);
} // endif !UseTemp
......@@ -1083,7 +1083,7 @@ bool DOSFAM::OpenTempFile(PGLOBAL g)
strcat(PlugRemoveType(tempname, tempname), ".t");
if (!(T_Stream = PlugOpenFile(g, tempname, "wb"))) {
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
rc = true;
......@@ -1112,7 +1112,7 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
req = (size_t)MY_MIN(n, Dbflen);
len = fread(DelBuf, 1, req, Stream);
if (trace)
if (trace(1))
htrc("after read req=%d len=%d\n", req, len);
if (len != req) {
......@@ -1131,13 +1131,13 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
return true;
} // endif
if (trace)
if (trace(1))
htrc("after write pos=%d\n", ftell(Stream));
Tpos += (int)req;
Spos += (int)req;
if (trace)
if (trace(1))
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
*b = true;
......@@ -1217,7 +1217,7 @@ void DOSFAM::CloseTableFile(PGLOBAL g, bool abort)
} else {
rc = PlugCloseFile(g, To_Fb);
if (trace)
if (trace(1))
htrc("DOS Close: closing %s rc=%d\n", To_File, rc);
} // endif UseTemp
......@@ -1453,7 +1453,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
// Calculate the length of block to read
BlkLen = BlkPos[CurBlk + 1] - BlkPos[CurBlk];
if (trace)
if (trace(1))
htrc("File position is now %d\n", ftell(Stream));
// Read the entire next block
......@@ -1487,7 +1487,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#endif
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
return RC_FX;
......@@ -1637,7 +1637,7 @@ void BLKFAM::CloseTableFile(PGLOBAL g, bool abort)
rc = PlugCloseFile(g, To_Fb);
if (trace)
if (trace(1))
htrc("BLK CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
To_File, Tdbp->GetMode(), wrc, rc);
......
This diff is collapsed.
......@@ -699,7 +699,7 @@ bool UNZIPUTL::openEntry(PGLOBAL g)
entryopen = true;
} // endif rc
if (trace)
if (trace(1))
htrc("Openning entry%s %s\n", fn, (entryopen) ? "oked" : "failed");
return !entryopen;
......@@ -751,7 +751,7 @@ int UNZFAM::GetFileLength(PGLOBAL g)
int len = (zutp && zutp->entryopen) ? (int)(Top - Memory)
: TXTFAM::GetFileLength(g) * 3;
if (trace)
if (trace(1))
htrc("Zipped file length=%d\n", len);
return len;
......
......@@ -298,7 +298,7 @@ PFIL FILTER::Link(PGLOBAL g, PFIL fil2)
{
PFIL fil1;
if (trace)
if (trace(1))
htrc("Linking filter %p with op=%d... to filter %p with op=%d\n",
this, Opc, fil2, (fil2) ? fil2->Opc : 0);
......@@ -352,7 +352,7 @@ int FILTER::CheckColumn(PGLOBAL g, PSQL sqlp, PXOB &p, int &ag)
char errmsg[MAX_STR] = "";
int agg, k, n = 0;
if (trace)
if (trace(1))
htrc("FILTER CheckColumn: sqlp=%p ag=%d\n", sqlp, ag);
switch (Opc) {
......@@ -537,7 +537,7 @@ PFIL FILTER::SortJoin(PGLOBAL g)
bool FILTER::FindJoinFilter(POPJOIN opj, PFIL fprec, bool teq, bool tek,
bool tk2, bool tc2, bool tix, bool thx)
{
if (trace)
if (trace(1))
htrc("FindJoinFilter: opj=%p fprec=%p tests=(%d,%d,%d,%d)\n",
opj, fprec, teq, tek, tk2, tc2);
......@@ -864,7 +864,7 @@ bool FILTER::CheckLocal(PTDB tdbp)
{
bool local = TRUE;
if (trace) {
if (trace(1)) {
if (tdbp)
htrc("CheckLocal: filp=%p R%d\n", this, tdbp->GetTdb_No());
else
......@@ -874,7 +874,7 @@ bool FILTER::CheckLocal(PTDB tdbp)
for (int i = 0; local && i < 2; i++)
local = Arg(i)->CheckLocal(tdbp);
if (trace)
if (trace(1))
htrc("FCL: returning %d\n", local);
return (local);
......@@ -980,7 +980,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
{
int i, comtype = TYPE_ERROR;
if (trace)
if (trace(1))
htrc("converting(?) %s %p opc=%d\n",
(having) ? "having" : "filter", this, Opc);
......@@ -1011,7 +1011,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
return TRUE;
} // endswitch
if (trace)
if (trace(1))
htrc("Filter(%d): Arg type=%d\n", i, GetArgType(i));
// Set default values
......@@ -1056,7 +1056,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
return TRUE;
} // endif
if (trace)
if (trace(1))
htrc(" comtype=%d, B_T(%d)=%d Val(%d)=%p\n",
comtype, i, Test[i].B_T, i, Val(i));
......@@ -1064,7 +1064,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
// Set or allocate the filter argument values and buffers
for (i = 0; i < 2; i++) {
if (trace)
if (trace(1))
htrc(" conv type %d ? i=%d B_T=%d comtype=%d\n",
GetArgType(i), i, Test[i].B_T, comtype);
......@@ -1141,7 +1141,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
TEST: // Test for possible Eval optimization
if (trace)
if (trace(1))
htrc("Filp %p op=%d argtypes=(%d,%d)\n",
this, Opc, GetArgType(0), GetArgType(1));
......@@ -1230,7 +1230,7 @@ bool FILTER::Eval(PGLOBAL g)
else if (Test[i].Conv)
Val(i)->SetValue_pval(Arg(i)->GetValue());
if (trace)
if (trace(1))
htrc(" Filter: op=%d type=%d %d B_T=%d %d val=%p %p\n",
Opc, GetArgType(0), GetArgType(1), Test[0].B_T, Test[1].B_T,
Val(0), Val(1));
......@@ -1270,7 +1270,7 @@ bool FILTER::Eval(PGLOBAL g)
goto FilterError;
} // endswitch Type
if (trace) {
if (trace(1)) {
htrc(" IN filtering: ap=%p\n", ap);
if (ap)
......@@ -1360,7 +1360,7 @@ bool FILTER::Eval(PGLOBAL g)
goto FilterError;
} // endswitch Opc
if (trace)
if (trace(1))
htrc("Eval: filter %p Opc=%d result=%d\n",
this, Opc, Value->GetIntValue());
......@@ -1692,7 +1692,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
{
PFIL filp = NULL;
if (trace)
if (trace(1))
htrc("PrepareFilter: fp=%p having=%d\n", fp, having);
while (fp) {
......@@ -1714,7 +1714,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
filp->Next = NULL;
} // endwhile
if (trace)
if (trace(1))
htrc(" returning filp=%p\n", filp);
return filp;
......@@ -1740,7 +1740,7 @@ DllExport bool ApplyFilter(PGLOBAL g, PFIL filp)
if (filp->Eval(g))
throw (int)TYPE_FILTER;
if (trace > 1)
if (trace(2))
htrc("PlugFilter filp=%p result=%d\n",
filp, filp->GetResult());
......
......@@ -52,7 +52,7 @@
/***********************************************************************/
/* Define access to the thread based trace value. */
/***********************************************************************/
#define trace GetTraceValue()
#define trace(T) (bool)(GetTraceValue() & (uint)T)
/***********************************************************************/
/* Miscellaneous Constants */
......@@ -220,14 +220,19 @@ DllExport BOOL PlugIsAbsolutePath(LPCSTR path);
DllExport bool AllocSarea(PGLOBAL, uint);
DllExport void FreeSarea(PGLOBAL);
DllExport BOOL PlugSubSet(PGLOBAL, void *, uint);
DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t);
DllExport char *PlugDup(PGLOBAL g, const char *str);
DllExport void *MakePtr(void *, OFFSET);
DllExport void htrc(char const *fmt, ...);
DllExport int GetTraceValue(void);
//DllExport int GetTraceValue(void);
DllExport uint GetTraceValue(void);
#if defined(__cplusplus)
} // extern "C"
#endif
/***********************************************************************/
/* Non exported routine declarations. */
/***********************************************************************/
void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
/*-------------------------- End of Global.H --------------------------*/
This diff is collapsed.
......@@ -293,7 +293,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
next_key = &section->key;
prev_key = NULL;
if (trace > 1)
if (trace(2))
htrc("New section: '%s'\n",section->name);
continue;
......@@ -336,7 +336,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
next_key = &key->next;
prev_key = key;
if (trace > 1)
if (trace(2))
htrc("New key: name='%s', value='%s'\n",
key->name,key->value?key->value:"(none)");
......@@ -359,7 +359,7 @@ static BOOL PROFILE_FlushFile(void)
FILE *file = NULL;
struct stat buf;
if (trace > 1)
if (trace(2))
htrc("PROFILE_FlushFile: CurProfile=%p\n", CurProfile);
if (!CurProfile) {
......@@ -398,7 +398,7 @@ static BOOL PROFILE_FlushFile(void)
return FALSE;
} // endif !file
if (trace > 1)
if (trace(2))
htrc("Saving '%s'\n", CurProfile->filename);
PROFILE_Save(file, CurProfile->section);
......@@ -447,7 +447,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
struct stat buf;
PROFILE *tempProfile;
if (trace > 1)
if (trace(2))
htrc("PROFILE_Open: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
/* First time around */
......@@ -468,7 +468,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
/* Check for a match */
for (i = 0; i < N_CACHED_PROFILES; i++) {
if (trace > 1)
if (trace(2))
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) {
......@@ -483,11 +483,11 @@ static BOOL PROFILE_Open(LPCSTR filename)
} // endif i
if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime) {
if (trace > 1)
if (trace(2))
htrc("(%s): already opened (mru=%d)\n", filename, i);
} else {
if (trace > 1)
if (trace(2))
htrc("(%s): already opened, needs refreshing (mru=%d)\n", filename, i);
} // endif stat
......@@ -535,11 +535,11 @@ static BOOL PROFILE_Open(LPCSTR filename)
// strcpy(p, filename);
// _strlwr(p);
if (trace > 1)
if (trace(2))
htrc("Opening %s\n", filename);
if ((file = fopen(filename, "r"))) {
if (trace > 1)
if (trace(2))
htrc("(%s): found it\n", filename);
// CurProfile->unix_name = malloc(strlen(buffer)+1);
......@@ -574,12 +574,12 @@ void PROFILE_Close(LPCSTR filename)
struct stat buf;
PROFILE *tempProfile;
if (trace > 1)
if (trace(2))
htrc("PROFILE_Close: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
/* Check for a match */
for (i = 0; i < N_CACHED_PROFILES; i++) {
if (trace > 1)
if (trace(2))
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) {
......@@ -591,7 +591,7 @@ void PROFILE_Close(LPCSTR filename)
CurProfile=tempProfile;
} // endif i
if (trace > 1) {
if (trace(2)) {
if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime)
htrc("(%s): already opened (mru=%d)\n", filename, i);
else
......@@ -620,7 +620,7 @@ void PROFILE_End(void)
{
int i;
if (trace)
if (trace(3))
htrc("PROFILE_End: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
if (!CurProfile) // Sergey Vojtovich
......@@ -628,7 +628,7 @@ void PROFILE_End(void)
/* Close all opened files and free the cache structure */
for (i = 0; i < N_CACHED_PROFILES; i++) {
if (trace)
if (trace(3))
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
// CurProfile = MRUProfile[i]; Sergey Vojtovich
......@@ -894,7 +894,7 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len)
uint f,l;
PROFILESECTION *section;
if (trace > 1)
if (trace(2))
htrc("GetSectionNames: buffer=%p len=%u\n", buffer, len);
if (!buffer || !len)
......@@ -909,17 +909,17 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len)
buf = buffer;
section = CurProfile->section;
if (trace > 1)
if (trace(2))
htrc("GetSectionNames: section=%p\n", section);
while (section != NULL) {
if (trace > 1)
if (trace(2))
htrc("section=%s\n", section->name);
if (section->name[0]) {
l = strlen(section->name) + 1;
if (trace > 1)
if (trace(2))
htrc("l=%u f=%u\n", l, f);
if (l > f) {
......@@ -982,7 +982,7 @@ static int PROFILE_GetString(LPCSTR section, LPCSTR key_name,
key = PROFILE_Find(&CurProfile->section, section, key_name, FALSE, FALSE);
PROFILE_CopyEntry(buffer, (key && key->value) ? key->value : def_val, len, FALSE);
if (trace > 1)
if (trace(2))
htrc("('%s','%s','%s'): returning '%s'\n",
section, key_name, def_val, buffer );
......@@ -1010,7 +1010,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
LPCSTR value, BOOL create_always)
{
if (!key_name) { /* Delete a whole section */
if (trace > 1)
if (trace(2))
htrc("Deleting('%s')\n", section_name);
CurProfile->changed |= PROFILE_DeleteSection(&CurProfile->section,
......@@ -1018,7 +1018,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
return TRUE; /* Even if PROFILE_DeleteSection() has failed,
this is not an error on application's level.*/
} else if (!value) { /* Delete a key */
if (trace > 1)
if (trace(2))
htrc("Deleting('%s','%s')\n", section_name, key_name);
CurProfile->changed |= PROFILE_DeleteKey(&CurProfile->section,
......@@ -1027,7 +1027,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
} else { /* Set the key value */
PROFILEKEY *key = PROFILE_Find(&CurProfile->section, section_name,
key_name, TRUE, create_always);
if (trace > 1)
if (trace(2))
htrc("Setting('%s','%s','%s')\n", section_name, key_name, value);
if (!key)
......@@ -1040,17 +1040,17 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
value++;
if (!strcmp(key->value, value)) {
if (trace > 1)
if (trace(2))
htrc(" no change needed\n" );
return TRUE; /* No change needed */
} // endif value
if (trace > 1)
if (trace(2))
htrc(" replacing '%s'\n", key->value);
free(key->value);
} else if (trace > 1)
} else if (trace(2))
htrc(" creating key\n" );
key->value = (char*)malloc(strlen(value) + 1);
......@@ -1345,7 +1345,7 @@ GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
{
DWORD ret = 0;
if (trace > 1)
if (trace(2))
htrc("GPPSN: filename=%s\n", filename);
EnterCriticalSection(&PROFILE_CritSect);
......
......@@ -363,7 +363,7 @@ bool JAVAConn::GetJVM(PGLOBAL g)
bool JAVAConn::Open(PGLOBAL g)
{
bool brc = true, err = false;
jboolean jt = (trace > 0);
jboolean jt = (trace(1));
// Link or check whether jvm library was linked
if (GetJVM(g))
......@@ -430,7 +430,7 @@ bool JAVAConn::Open(PGLOBAL g)
jpop->Append(cp);
} // endif cp
if (trace) {
if (trace(1)) {
htrc("ClassPath=%s\n", ClassPath);
htrc("CLASSPATH=%s\n", cp);
htrc("%s\n", jpop->GetStr());
......@@ -486,7 +486,7 @@ bool JAVAConn::Open(PGLOBAL g)
break;
} // endswitch rc
if (trace)
if (trace(1))
htrc("%s\n", g->Message);
if (brc)
......
This diff is collapsed.
......@@ -29,6 +29,7 @@ class JDBConn : public JAVAConn {
// Attributes
public:
char *GetQuoteChar(void) { return m_IDQuoteChar; }
bool SetUUID(PGLOBAL g, PTDBJDBC tjp);
virtual int GetMaxValue(int infotype);
public:
......@@ -58,13 +59,6 @@ class JDBConn : public JAVAConn {
protected:
// Members
#if 0
JavaVM *jvm; // Pointer to the JVM (Java Virtual Machine)
JNIEnv *env; // Pointer to native interface
jclass jdi; // Pointer to the java wrapper class
jobject job; // The java wrapper class object
jmethodID errid; // The GetErrmsg method ID
#endif // 0
jmethodID xqid; // The ExecuteQuery method ID
jmethodID xuid; // The ExecuteUpdate method ID
jmethodID xid; // The Execute method ID
......@@ -84,8 +78,7 @@ class JDBConn : public JAVAConn {
jmethodID timfldid; // The TimeField method ID
jmethodID tspfldid; // The TimestampField method ID
jmethodID bigfldid; // The BigintField method ID
// PCSZ Msg;
// PCSZ m_Wrap;
jmethodID uidfldid; // The UuidField method ID
char m_IDQuoteChar[2];
PCSZ m_Pwd;
int m_Ncol;
......
......@@ -298,7 +298,7 @@ int JMGFAM::ReadBuffer(PGLOBAL g)
PSZ str = Jcp->GetDocument();
if (str) {
if (trace == 1)
if (trace(1))
htrc("%s\n", str);
strncpy(Tdbp->GetLine(), str, Lrecl);
......
......@@ -254,7 +254,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
all = true;
if (pipe && Options) {
if (trace)
if (trace(1))
htrc("Pipeline: %s\n", Options);
p = strrchr(Options, ']');
......@@ -312,13 +312,13 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
*(char*)p = ']'; // Restore Colist for discovery
p = s->GetStr();
if (trace)
if (trace(33))
htrc("New Pipeline: %s\n", p);
return AggregateCollection(p);
} else {
if (filter || filp) {
if (trace) {
if (trace(1)) {
if (filter)
htrc("Filter: %s\n", filter);
......@@ -346,7 +346,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
tdbp->SetFilter(NULL); // Not needed anymore
} // endif To_Filter
if (trace)
if (trace(33))
htrc("selector: %s\n", s->GetStr());
s->Resize(s->GetLength() + 1);
......@@ -355,7 +355,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
if (!all) {
if (Options && *Options) {
if (trace)
if (trace(1))
htrc("options=%s\n", Options);
op = Options;
......@@ -751,7 +751,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp)
jlong ar = env->CallLongMethod(job, updateid, upd);
if (trace)
if (trace(1))
htrc("DocUpdate: ar = %ld\n", ar);
if (Check((int)ar)) {
......@@ -770,7 +770,7 @@ int JMgoConn::DocDelete(PGLOBAL g, bool all)
int rc = RC_OK;
jlong ar = env->CallLongMethod(job, deleteid, all);
if (trace)
if (trace(1))
htrc("DocDelete: ar = %ld\n", ar);
if (Check((int)ar)) {
......
......@@ -97,7 +97,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
PJSON jsp = NULL;
STRG src;
if (trace)
if (trace(1))
htrc("ParseJson: s=%.10s len=%d\n", s, len);
if (!s || !len) {
......@@ -165,7 +165,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
}; // endswitch s[i]
if (!jsp)
sprintf(g->Message, "Invalid Json string '%.*s'", 50, s);
sprintf(g->Message, "Invalid Json string '%.*s'", MY_MIN(len, 50), s);
else if (ptyp && pretty == 3) {
*ptyp = 3; // Not recognized pretty
......@@ -178,7 +178,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
} // endif ptyp
} catch (int n) {
if (trace)
if (trace(1))
htrc("Exception %d: %s\n", n, g->Message);
jsp = NULL;
} catch (const char *msg) {
......@@ -652,7 +652,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty)
} // endif's
} catch (int n) {
if (trace)
if (trace(1))
htrc("Exception %d: %s\n", n, g->Message);
str = NULL;
} catch (const char *msg) {
......@@ -1015,6 +1015,20 @@ PJAR JOBJECT::GetKeyList(PGLOBAL g)
return jarp;
} // end of GetKeyList
/***********************************************************************/
/* Return all values as an array. */
/***********************************************************************/
PJAR JOBJECT::GetValList(PGLOBAL g)
{
PJAR jarp = new(g) JARRAY();
for (PJPR jpp = First; jpp; jpp = jpp->Next)
jarp->AddValue(g, jpp->GetVal());
jarp->InitArray(g);
return jarp;
} // end of GetValList
/***********************************************************************/
/* Get the value corresponding to the given key. */
/***********************************************************************/
......@@ -1224,6 +1238,7 @@ PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x)
Last->Next = jvp;
Last = jvp;
Last->Next = NULL;
} // endif x
return jvp;
......@@ -1318,6 +1333,24 @@ bool JARRAY::IsNull(void)
/* -------------------------- Class JVALUE- -------------------------- */
/***********************************************************************/
/* Constructor for a JSON. */
/***********************************************************************/
JVALUE::JVALUE(PJSON jsp) : JSON()
{
if (jsp->GetType() == TYPE_JVAL) {
Jsp = jsp->GetJsp();
Value = jsp->GetValue();
} else {
Jsp = jsp;
Value = NULL;
} // endif Type
Next = NULL;
Del = false;
Size = 1;
} // end of JVALUE constructor
/***********************************************************************/
/* Constructor for a Value with a given string or numeric value. */
/***********************************************************************/
......
......@@ -20,7 +20,8 @@ enum JTYP {TYPE_NULL = TYPE_VOID,
TYPE_BINT = TYPE_BIGINT,
TYPE_DTM = TYPE_DATE,
TYPE_INTG = TYPE_INT,
TYPE_JSON = 12,
TYPE_VAL = 12,
TYPE_JSON,
TYPE_JAR,
TYPE_JOB,
TYPE_JVAL};
......@@ -160,6 +161,7 @@ class JSON : public BLOCK {
//virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;}
virtual PJPR AddPair(PGLOBAL g, PCSZ key) {X return NULL;}
virtual PJAR GetKeyList(PGLOBAL g) {X return NULL;}
virtual PJAR GetValList(PGLOBAL g) {X return NULL;}
virtual PJVAL GetValue(const char *key) {X return NULL;}
virtual PJOB GetObject(void) {return NULL;}
virtual PJAR GetArray(void) {return NULL;}
......@@ -208,6 +210,7 @@ class JOBJECT : public JSON {
virtual PJOB GetObject(void) {return this;}
virtual PJVAL GetValue(const char* key);
virtual PJAR GetKeyList(PGLOBAL g);
virtual PJAR GetValList(PGLOBAL g);
virtual PSZ GetText(PGLOBAL g, PSZ text);
virtual bool Merge(PGLOBAL g, PJSON jsp);
virtual void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key);
......@@ -261,8 +264,7 @@ class JVALUE : public JSON {
friend bool SerializeValue(JOUT *, PJVAL);
public:
JVALUE(void) : JSON() {Clear();}
JVALUE(PJSON jsp) : JSON()
{Jsp = jsp; Value = NULL; Next = NULL; Del = false; Size = 1;}
JVALUE(PJSON jsp);
JVALUE(PGLOBAL g, PVAL valp);
JVALUE(PGLOBAL g, PCSZ strp);
......
This diff is collapsed.
......@@ -89,6 +89,10 @@ extern "C" {
DllExport char *json_object_list(UDF_EXEC_ARGS);
DllExport void json_object_list_deinit(UDF_INIT*);
DllExport my_bool json_object_values_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *json_object_values(UDF_EXEC_ARGS);
DllExport void json_object_values_deinit(UDF_INIT*);
DllExport my_bool jsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport long long jsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*);
......
This diff is collapsed.
......@@ -172,7 +172,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info)
goto err;
skipit:
if (trace)
if (trace(1))
htrc("MGOColumns: n=%d len=%d\n", n, length[0]);
/*********************************************************************/
......@@ -276,7 +276,7 @@ int MGODISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt)
tdp->Wrapname = (PSZ)GetStringTableOption(g, topt, "Wrapper",
(tdp->Version == 2) ? "Mongo2Interface" : "Mongo3Interface");
if (trace)
if (trace(1))
htrc("Uri %s coll=%s db=%s colist=%s filter=%s lvl=%d\n",
tdp->Uri, tdp->Tabname, tdp->Tabschema, tdp->Colist, tdp->Filter, lvl);
......
This diff is collapsed.
......@@ -177,7 +177,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
return NULL;
} // endif b
if (trace)
if (trace(1))
htrc("MyColumns: cmd='%s'\n", cmd.GetStr());
if ((n = myc.GetResultSize(g, cmd.GetStr())) < 0) {
......@@ -482,7 +482,7 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db,
return RC_FX;
} // endif m_DB
if (trace)
if (trace(1))
htrc("MYSQLC Open: m_DB=%.4X size=%d\n", m_DB, (int)sizeof(*m_DB));
// Removed to do like FEDERATED do
......@@ -744,7 +744,7 @@ int MYSQLC::ExecSQL(PGLOBAL g, const char *query, int *w)
m_Fields = mysql_num_fields(m_Res);
m_Rows = (!m_Use) ? (int)mysql_num_rows(m_Res) : 0;
if (trace)
if (trace(1))
htrc("ExecSQL: m_Res=%.4X size=%d m_Fields=%d m_Rows=%d\n",
m_Res, sizeof(*m_Res), m_Fields, m_Rows);
......@@ -1068,7 +1068,7 @@ void MYSQLC::Close(void)
{
FreeResult();
if (trace)
if (trace(1))
htrc("MYSQLC Close: m_DB=%.4X\n", m_DB);
mysql_close(m_DB);
......
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -381,3 +382,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -381,3 +382,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -380,3 +381,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
......@@ -272,10 +272,9 @@ Json_Serialize(Jbin_Array('a','b','c'))
["a","b","c"]
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd'));
Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd'))
Null json tree
[null,"d"]
Warnings:
Warning 1105 Open(map) error 2 on not_exist.json
Warning 1105 First argument is not an array
# This does not modify the file
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'));
Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'))
......
This diff was suppressed by a .gitattributes entry.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment