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) ...@@ -326,6 +326,30 @@ IF(NOT TARGET connect)
RETURN() RETURN()
ENDIF() 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 # Install some extra files that belong to connect engine
IF(WIN32) IF(WIN32)
# install ha_connect.lib # install ha_connect.lib
......
package wrappers; package wrappers;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.Console; import java.io.Console;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
public class Client { public class Client {
static boolean DEBUG = true; static boolean DEBUG = true;
...@@ -58,6 +62,9 @@ public class Client { ...@@ -58,6 +62,9 @@ public class Client {
String query; String query;
System.out.println("Successfully connected to " + parms[1]); System.out.println("Successfully connected to " + parms[1]);
s = jdi.GetQuoteString();
System.out.println("Qstr = '" + s + "'");
while ((query = getLine("Query: ", false)) != null) { while ((query = getLine("Query: ", false)) != null) {
n = jdi.Execute(query); n = jdi.Execute(query);
System.out.println("Returned n = " + n); System.out.println("Returned n = " + n);
...@@ -79,7 +86,11 @@ public class Client { ...@@ -79,7 +86,11 @@ public class Client {
private static void PrintResult(int ncol) { private static void PrintResult(int ncol) {
// Get result set meta data // Get result set meta data
int i; int i;
Date date = new Date(0);
Time time = new Time(0);
Timestamp tsp = new Timestamp(0);
String columnName; String columnName;
Object job;
// Get the column names; column indices start from 1 // Get the column names; column indices start from 1
for (i = 1; i <= ncol; i++) { for (i = 1; i <= ncol; i++) {
...@@ -112,6 +123,7 @@ public class Client { ...@@ -112,6 +123,7 @@ public class Client {
case java.sql.Types.VARCHAR: case java.sql.Types.VARCHAR:
case java.sql.Types.LONGVARCHAR: case java.sql.Types.LONGVARCHAR:
case java.sql.Types.CHAR: case java.sql.Types.CHAR:
case 1111:
System.out.print(jdi.StringField(i, null)); System.out.print(jdi.StringField(i, null));
break; break;
case java.sql.Types.INTEGER: case java.sql.Types.INTEGER:
...@@ -120,14 +132,17 @@ public class Client { ...@@ -120,14 +132,17 @@ public class Client {
case java.sql.Types.BIGINT: case java.sql.Types.BIGINT:
System.out.print(jdi.BigintField(i, null)); System.out.print(jdi.BigintField(i, null));
break; break;
case java.sql.Types.TIMESTAMP:
System.out.print(jdi.TimestampField(i, null));
break;
case java.sql.Types.TIME: 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; break;
case java.sql.Types.DATE: 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; break;
case java.sql.Types.SMALLINT: case java.sql.Types.SMALLINT:
System.out.print(jdi.IntField(i, null)); System.out.print(jdi.IntField(i, null));
...@@ -141,6 +156,8 @@ public class Client { ...@@ -141,6 +156,8 @@ public class Client {
case java.sql.Types.BOOLEAN: case java.sql.Types.BOOLEAN:
System.out.print(jdi.BooleanField(i, null)); System.out.print(jdi.BooleanField(i, null));
default: default:
job = jdi.ObjectField(i, null);
System.out.print(job.toString());
break; break;
} // endswitch Type } // endswitch Type
......
This diff was suppressed by a .gitattributes entry.
package wrappers; package wrappers;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; 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.Collections;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
import java.util.UUID;
import javax.sql.DataSource; import javax.sql.DataSource;
...@@ -223,6 +235,24 @@ public class JdbcInterface { ...@@ -223,6 +235,24 @@ public class JdbcInterface {
} // end of SetTimestampParm } // 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) { public int SetNullParm(int i, int typ) {
int rc = 0; int rc = 0;
...@@ -481,6 +511,8 @@ public class JdbcInterface { ...@@ -481,6 +511,8 @@ public class JdbcInterface {
System.out.println("Executing query '" + query + "'"); System.out.println("Executing query '" + query + "'");
try { try {
if (rs != null)
rs.close();
rs = stmt.executeQuery(query); rs = stmt.executeQuery(query);
rsmd = rs.getMetaData(); rsmd = rs.getMetaData();
ncol = rsmd.getColumnCount(); ncol = rsmd.getColumnCount();
...@@ -708,7 +740,7 @@ public class JdbcInterface { ...@@ -708,7 +740,7 @@ public class JdbcInterface {
return 0; return 0;
} // end of TimestampField } // end of TimestampField
public Object ObjectField(int n, String name) { public Object ObjectField(int n, String name) {
if (rs == null) { if (rs == null) {
System.out.println("No result set"); System.out.println("No result set");
} else try { } else try {
...@@ -720,6 +752,22 @@ public class JdbcInterface { ...@@ -720,6 +752,22 @@ public class JdbcInterface {
return null; return null;
} // end of ObjectField } // 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) { public int GetDrivers(String[] s, int mxs) {
int n = 0; int n = 0;
List<Driver> drivers = Collections.list(DriverManager.getDrivers()); List<Driver> drivers = Collections.list(DriverManager.getDrivers());
......
package wrappers; package wrappers;
import java.sql.*; import java.sql.SQLException;
import java.util.Hashtable; import java.util.Hashtable;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.postgresql.jdbc2.optional.PoolingDataSource; import org.postgresql.jdbc2.optional.PoolingDataSource;
public class PostgresqlInterface extends JdbcInterface { public class PostgresqlInterface extends JdbcInterface {
...@@ -19,7 +20,7 @@ public class PostgresqlInterface extends JdbcInterface { ...@@ -19,7 +20,7 @@ public class PostgresqlInterface extends JdbcInterface {
} // end of constructor } // end of constructor
@Override @Override
public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { public int JdbcConnect(String[] parms, int fsize, boolean scrollable) {
int rc = 0; int rc = 0;
String url = parms[1]; String url = parms[1];
......
...@@ -82,7 +82,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp) ...@@ -82,7 +82,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp)
if ((valtyp = pp->Type) != TYPE_STRING) if ((valtyp = pp->Type) != TYPE_STRING)
len = 1; len = 1;
if (trace) if (trace(1))
htrc("valtyp=%d len=%d\n", valtyp, len); htrc("valtyp=%d len=%d\n", valtyp, len);
/*********************************************************************/ /*********************************************************************/
...@@ -287,7 +287,7 @@ bool ARRAY::AddValue(PGLOBAL g, PSZ strp) ...@@ -287,7 +287,7 @@ bool ARRAY::AddValue(PGLOBAL g, PSZ strp)
return true; return true;
} // endif Type } // endif Type
if (trace) if (trace(1))
htrc(" adding string(%d): '%s'\n", Nval, strp); htrc(" adding string(%d): '%s'\n", Nval, strp);
//Value->SetValue_psz(strp); //Value->SetValue_psz(strp);
...@@ -306,7 +306,7 @@ bool ARRAY::AddValue(PGLOBAL g, void *p) ...@@ -306,7 +306,7 @@ bool ARRAY::AddValue(PGLOBAL g, void *p)
return true; return true;
} // endif Type } // endif Type
if (trace) if (trace(1))
htrc(" adding pointer(%d): %p\n", Nval, p); htrc(" adding pointer(%d): %p\n", Nval, p);
Vblp->SetValue((PSZ)p, Nval++); Vblp->SetValue((PSZ)p, Nval++);
...@@ -323,7 +323,7 @@ bool ARRAY::AddValue(PGLOBAL g, short n) ...@@ -323,7 +323,7 @@ bool ARRAY::AddValue(PGLOBAL g, short n)
return true; return true;
} // endif Type } // endif Type
if (trace) if (trace(1))
htrc(" adding SHORT(%d): %hd\n", Nval, n); htrc(" adding SHORT(%d): %hd\n", Nval, n);
//Value->SetValue(n); //Value->SetValue(n);
...@@ -342,7 +342,7 @@ bool ARRAY::AddValue(PGLOBAL g, int n) ...@@ -342,7 +342,7 @@ bool ARRAY::AddValue(PGLOBAL g, int n)
return true; return true;
} // endif Type } // endif Type
if (trace) if (trace(1))
htrc(" adding int(%d): %d\n", Nval, n); htrc(" adding int(%d): %d\n", Nval, n);
//Value->SetValue(n); //Value->SetValue(n);
...@@ -361,7 +361,7 @@ bool ARRAY::AddValue(PGLOBAL g, double d) ...@@ -361,7 +361,7 @@ bool ARRAY::AddValue(PGLOBAL g, double d)
return true; return true;
} // endif Type } // endif Type
if (trace) if (trace(1))
htrc(" adding float(%d): %lf\n", Nval, d); htrc(" adding float(%d): %lf\n", Nval, d);
Value->SetValue(d); Value->SetValue(d);
...@@ -380,7 +380,7 @@ bool ARRAY::AddValue(PGLOBAL g, PXOB xp) ...@@ -380,7 +380,7 @@ bool ARRAY::AddValue(PGLOBAL g, PXOB xp)
return true; return true;
} // endif Type } // endif Type
if (trace) if (trace(1))
htrc(" adding (%d) from xp=%p\n", Nval, xp); htrc(" adding (%d) from xp=%p\n", Nval, xp);
//AddValue(xp->GetValue()); //AddValue(xp->GetValue());
...@@ -399,7 +399,7 @@ bool ARRAY::AddValue(PGLOBAL g, PVAL vp) ...@@ -399,7 +399,7 @@ bool ARRAY::AddValue(PGLOBAL g, PVAL vp)
return true; return true;
} // endif Type } // endif Type
if (trace) if (trace(1))
htrc(" adding (%d) from vp=%p\n", Nval, vp); htrc(" adding (%d) from vp=%p\n", Nval, vp);
Vblp->SetValue(vp, Nval++); Vblp->SetValue(vp, Nval++);
...@@ -990,7 +990,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g) ...@@ -990,7 +990,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
len += strlen(tp); len += strlen(tp);
} // enfor i } // enfor i
if (trace) if (trace(1))
htrc("Arraylist: len=%d\n", len); htrc("Arraylist: len=%d\n", len);
p = (char *)PlugSubAlloc(g, NULL, len); p = (char *)PlugSubAlloc(g, NULL, len);
...@@ -1003,7 +1003,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g) ...@@ -1003,7 +1003,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
strcat(p, (++i == Nval) ? ")" : ","); strcat(p, (++i == Nval) ? ")" : ",");
} // enfor i } // enfor i
if (trace) if (trace(1))
htrc("Arraylist: newlen=%d\n", strlen(p)); htrc("Arraylist: newlen=%d\n", strlen(p));
return p; return p;
......
...@@ -241,7 +241,7 @@ int BLKFILARI::BlockEval(PGLOBAL) ...@@ -241,7 +241,7 @@ int BLKFILARI::BlockEval(PGLOBAL)
break; break;
} // endswitch Opc } // endswitch Opc
if (trace) if (trace(1))
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result); htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);
return Result; return Result;
...@@ -338,7 +338,7 @@ int BLKFILAR2::BlockEval(PGLOBAL) ...@@ -338,7 +338,7 @@ int BLKFILAR2::BlockEval(PGLOBAL)
break; break;
} // endswitch Opc } // endswitch Opc
if (trace) if (trace(1))
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result); htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);
return Result; return Result;
...@@ -474,7 +474,7 @@ int BLKFILMR2::BlockEval(PGLOBAL) ...@@ -474,7 +474,7 @@ int BLKFILMR2::BlockEval(PGLOBAL)
break; break;
} // endswitch Opc } // endswitch Opc
if (trace) if (trace(1))
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result); htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);
return Result; return Result;
...@@ -567,7 +567,7 @@ int BLKSPCARI::BlockEval(PGLOBAL) ...@@ -567,7 +567,7 @@ int BLKSPCARI::BlockEval(PGLOBAL)
break; break;
} // endswitch Opc } // endswitch Opc
if (trace) if (trace(1))
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result); htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);
return Result; return Result;
......
...@@ -38,8 +38,8 @@ typedef class BLOCK *PBLOCK; ...@@ -38,8 +38,8 @@ typedef class BLOCK *PBLOCK;
class DllExport BLOCK { class DllExport BLOCK {
public: public:
void * operator new(size_t size, PGLOBAL g, void *p = NULL) { void * operator new(size_t size, PGLOBAL g, void *p = NULL) {
// if (trace > 3) if (trace(256))
// htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p); htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);
return (PlugSubAlloc(g, p, size)); return (PlugSubAlloc(g, p, size));
} // end of new } // end of new
......
...@@ -45,6 +45,7 @@ enum USETEMP {TMP_NO = 0, /* Never */ ...@@ -45,6 +45,7 @@ enum USETEMP {TMP_NO = 0, /* Never */
/***********************************************************************/ /***********************************************************************/
enum TYPCONV {TPC_NO = 0, /* Never */ enum TYPCONV {TPC_NO = 0, /* Never */
TPC_YES = 1, /* Always */ 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_ #endif // _CHKLVL_DEFINED_
...@@ -280,7 +280,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g) ...@@ -280,7 +280,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
all = true; all = true;
if (Pcg->Pipe) { if (Pcg->Pipe) {
if (trace) if (trace(1))
htrc("Pipeline: %s\n", options); htrc("Pipeline: %s\n", options);
p = strrchr(options, ']'); p = strrchr(options, ']');
...@@ -330,7 +330,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g) ...@@ -330,7 +330,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
*(char*)p = ']'; // Restore Colist for discovery *(char*)p = ']'; // Restore Colist for discovery
p = s->GetStr(); p = s->GetStr();
if (trace) if (trace(33))
htrc("New Pipeline: %s\n", p); htrc("New Pipeline: %s\n", p);
Query = bson_new_from_json((const uint8_t *)p, -1, &Error); Query = bson_new_from_json((const uint8_t *)p, -1, &Error);
...@@ -350,7 +350,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g) ...@@ -350,7 +350,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
} else { } else {
if (Pcg->Filter || filp) { if (Pcg->Filter || filp) {
if (trace) { if (trace(1)) {
if (Pcg->Filter) if (Pcg->Filter)
htrc("Filter: %s\n", Pcg->Filter); htrc("Filter: %s\n", Pcg->Filter);
...@@ -377,7 +377,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g) ...@@ -377,7 +377,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
tp->SetFilter(NULL); // Not needed anymore tp->SetFilter(NULL); // Not needed anymore
} // endif To_Filter } // endif To_Filter
if (trace) if (trace(33))
htrc("selector: %s\n", s->GetStr()); htrc("selector: %s\n", s->GetStr());
s->Resize(s->GetLength() + 1); s->Resize(s->GetLength() + 1);
...@@ -393,7 +393,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g) ...@@ -393,7 +393,7 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
if (!all) { if (!all) {
if (options && *options) { if (options && *options) {
if (trace) if (trace(1))
htrc("options=%s\n", options); htrc("options=%s\n", options);
p = options; p = options;
...@@ -450,10 +450,10 @@ int CMgoConn::ReadNext(PGLOBAL g) ...@@ -450,10 +450,10 @@ int CMgoConn::ReadNext(PGLOBAL g)
if (!Cursor && MakeCursor(g)) { if (!Cursor && MakeCursor(g)) {
rc = RC_FX; rc = RC_FX;
} else if (mongoc_cursor_next(Cursor, &Document)) { } else if (mongoc_cursor_next(Cursor, &Document)) {
if (trace > 1) { if (trace(512)) {
bson_iter_t iter; bson_iter_t iter;
ShowDocument(&iter, Document, ""); ShowDocument(&iter, Document, "");
} else if (trace == 1) } else if (trace(1))
htrc("%s\n", GetDocument(g)); htrc("%s\n", GetDocument(g));
} else if (mongoc_cursor_error(Cursor, &Error)) { } else if (mongoc_cursor_error(Cursor, &Error)) {
...@@ -589,7 +589,7 @@ int CMgoConn::Write(PGLOBAL g) ...@@ -589,7 +589,7 @@ int CMgoConn::Write(PGLOBAL g)
if (DocWrite(g, Fpc)) if (DocWrite(g, Fpc))
return RC_FX; return RC_FX;
if (trace) { if (trace(2)) {
char *str = bson_as_json(Fpc->Child, NULL); char *str = bson_as_json(Fpc->Child, NULL);
htrc("Inserting: %s\n", str); htrc("Inserting: %s\n", str);
bson_free(str); bson_free(str);
...@@ -623,7 +623,7 @@ int CMgoConn::Write(PGLOBAL g) ...@@ -623,7 +623,7 @@ int CMgoConn::Write(PGLOBAL g)
} // endif iter } // endif iter
if (b) { if (b) {
if (trace) { if (trace(2)) {
char *str = bson_as_json(query, NULL); char *str = bson_as_json(query, NULL);
htrc("update query: %s\n", str); htrc("update query: %s\n", str);
bson_free(str); bson_free(str);
......
...@@ -76,7 +76,7 @@ COLBLK::COLBLK(PCOL col1, PTDB tdbp) ...@@ -76,7 +76,7 @@ COLBLK::COLBLK(PCOL col1, PTDB tdbp)
//To_Orig = col1; //To_Orig = col1;
To_Tdb = tdbp; To_Tdb = tdbp;
if (trace > 1) if (trace(2))
htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this); htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
if (tdbp) if (tdbp)
...@@ -115,7 +115,7 @@ bool COLBLK::SetFormat(PGLOBAL, FORMAT& fmt) ...@@ -115,7 +115,7 @@ bool COLBLK::SetFormat(PGLOBAL, FORMAT& fmt)
{ {
fmt = Format; fmt = Format;
if (trace > 1) if (trace(2))
htrc("COLBLK: %p format=%c(%d,%d)\n", htrc("COLBLK: %p format=%c(%d,%d)\n",
this, *fmt.Type, fmt.Length, fmt.Prec); this, *fmt.Type, fmt.Length, fmt.Prec);
...@@ -128,7 +128,7 @@ bool COLBLK::SetFormat(PGLOBAL, FORMAT& fmt) ...@@ -128,7 +128,7 @@ bool COLBLK::SetFormat(PGLOBAL, FORMAT& fmt)
/***********************************************************************/ /***********************************************************************/
bool COLBLK::Eval(PGLOBAL g) bool COLBLK::Eval(PGLOBAL g)
{ {
if (trace > 1) if (trace(2))
htrc("Col Eval: %s status=%.4X\n", Name, Status); htrc("Col Eval: %s status=%.4X\n", Name, Status);
if (!GetStatus(BUF_READ)) { if (!GetStatus(BUF_READ)) {
...@@ -165,7 +165,7 @@ bool COLBLK::InitValue(PGLOBAL g) ...@@ -165,7 +165,7 @@ bool COLBLK::InitValue(PGLOBAL g)
AddStatus(BUF_READY); AddStatus(BUF_READY);
Value->SetNullable(Nullable); Value->SetNullable(Nullable);
if (trace > 1) if (trace(2))
htrc(" colp=%p type=%d value=%p coluse=%.4X status=%.4X\n", htrc(" colp=%p type=%d value=%p coluse=%.4X status=%.4X\n",
this, Buf_Type, Value, ColUse, Status); this, Buf_Type, Value, ColUse, Status);
......
...@@ -92,7 +92,7 @@ void CntEndDB(PGLOBAL g) ...@@ -92,7 +92,7 @@ void CntEndDB(PGLOBAL g)
free(dbuserp); free(dbuserp);
if (trace) if (trace(1))
htrc("CntEndDB: Freeing Dup\n"); htrc("CntEndDB: Freeing Dup\n");
g->Activityp->Aptr = NULL; g->Activityp->Aptr = NULL;
...@@ -112,14 +112,14 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname) ...@@ -112,14 +112,14 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
bool rc= false; bool rc= false;
PDBUSER dbuserp= PlgGetUser(g); PDBUSER dbuserp= PlgGetUser(g);
if (trace) { if (trace(1)) {
printf("CntCheckDB: dbuserp=%p\n", dbuserp); printf("CntCheckDB: dbuserp=%p\n", dbuserp);
} // endif trace } // endif trace
if (!dbuserp || !handler) if (!dbuserp || !handler)
return true; return true;
if (trace) if (trace(1))
printf("cat=%p oldhandler=%p newhandler=%p\n", dbuserp->Catalog, printf("cat=%p oldhandler=%p newhandler=%p\n", dbuserp->Catalog,
(dbuserp->Catalog) ? ((MYCAT*)dbuserp->Catalog)->GetHandler() : NULL, (dbuserp->Catalog) ? ((MYCAT*)dbuserp->Catalog)->GetHandler() : NULL,
handler); handler);
...@@ -150,7 +150,7 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname) ...@@ -150,7 +150,7 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
/*********************************************************************/ /*********************************************************************/
sprintf(g->Message, MSG(DATABASE_LOADED), "???"); sprintf(g->Message, MSG(DATABASE_LOADED), "???");
if (trace) if (trace(1))
printf("msg=%s\n", g->Message); printf("msg=%s\n", g->Message);
return rc; return rc;
...@@ -198,7 +198,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h) ...@@ -198,7 +198,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
PDBUSER dup = PlgGetUser(g); PDBUSER dup = PlgGetUser(g);
volatile PCATLG cat = (dup) ? dup->Catalog : NULL; // Safe over throw 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); printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
if (!cat) if (!cat)
...@@ -208,7 +208,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h) ...@@ -208,7 +208,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
// Get table object from the catalog // Get table object from the catalog
tabp = new(g) XTAB(name); tabp = new(g) XTAB(name);
if (trace) if (trace(1))
printf("CntGetTDB: tabp=%p\n", tabp); printf("CntGetTDB: tabp=%p\n", tabp);
// Perhaps this should be made thread safe // Perhaps this should be made thread safe
...@@ -218,13 +218,13 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h) ...@@ -218,13 +218,13 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
printf("CntGetTDB: %s\n", g->Message); printf("CntGetTDB: %s\n", g->Message);
} catch (int n) { } catch (int n) {
if (trace) if (trace(1))
htrc("Exception %d: %s\n", n, g->Message); htrc("Exception %d: %s\n", n, g->Message);
} catch (const char *msg) { } catch (const char *msg) {
strcpy(g->Message, msg); strcpy(g->Message, msg);
} // end catch } // end catch
if (trace) if (trace(1))
printf("Returning tdbp=%p mode=%d\n", tdbp, mode); printf("Returning tdbp=%p mode=%d\n", tdbp, mode);
return tdbp; return tdbp;
...@@ -243,7 +243,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, ...@@ -243,7 +243,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
//PCOLUMN cp; //PCOLUMN cp;
PDBUSER dup= PlgGetUser(g); PDBUSER dup= PlgGetUser(g);
if (trace) if (trace(1))
printf("CntOpenTable: tdbp=%p mode=%d\n", tdbp, mode); printf("CntOpenTable: tdbp=%p mode=%d\n", tdbp, mode);
if (!tdbp) { if (!tdbp) {
...@@ -260,7 +260,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, ...@@ -260,7 +260,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
} else for (p = c1; *p; p += n) { } else for (p = c1; *p; p += n) {
// Allocate only used column blocks // Allocate only used column blocks
if (trace) if (trace(1))
printf("Allocating column %s\n", p); printf("Allocating column %s\n", p);
g->Message[0] = 0; // To check whether ColDB made an error message 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, ...@@ -325,7 +325,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
tdbp->SetSetCols(tdbp->GetColumns()); tdbp->SetSetCols(tdbp->GetColumns());
// Now do open the physical table // Now do open the physical table
if (trace) if (trace(1))
printf("Opening table %s in mode %d tdbp=%p\n", printf("Opening table %s in mode %d tdbp=%p\n",
tdbp->GetName(), mode, tdbp); tdbp->GetName(), mode, tdbp);
...@@ -341,7 +341,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, ...@@ -341,7 +341,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
} // endif del } // endif del
if (trace) if (trace(1))
printf("About to open the table: tdbp=%p\n", tdbp); printf("About to open the table: tdbp=%p\n", tdbp);
if (mode != MODE_ANY && mode != MODE_ALTER) { if (mode != MODE_ANY && mode != MODE_ALTER) {
...@@ -356,7 +356,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, ...@@ -356,7 +356,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
rcop = false; rcop = false;
} catch (int n) { } catch (int n) {
if (trace) if (trace(1))
htrc("Exception %d: %s\n", n, g->Message); htrc("Exception %d: %s\n", n, g->Message);
} catch (const char *msg) { } catch (const char *msg) {
strcpy(g->Message, msg); strcpy(g->Message, msg);
...@@ -399,12 +399,13 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr) ...@@ -399,12 +399,13 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr)
} // endfor colp } // endfor colp
} catch (int n) { } catch (int n) {
if (trace) if (trace(1))
printf("Error %d reading columns: %s\n", n, g->Message); printf("Error %d reading columns: %s\n", n, g->Message);
rc = RC_FX; rc = RC_FX;
} catch (const char *msg) { } catch (const char *msg) {
strcpy(g->Message, msg); strcpy(g->Message, msg);
rc = RC_NF;
} // end catch } // end catch
return rc; return rc;
...@@ -549,7 +550,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) ...@@ -549,7 +550,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
return rc; return rc;
} // endif !USE_OPEN } // endif !USE_OPEN
if (trace) if (trace(1))
printf("CntCloseTable: tdbp=%p mode=%d nox=%d abort=%d\n", printf("CntCloseTable: tdbp=%p mode=%d nox=%d abort=%d\n",
tdbp, tdbp->GetMode(), nox, abort); tdbp, tdbp->GetMode(), nox, abort);
...@@ -579,11 +580,11 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) ...@@ -579,11 +580,11 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
tdbp->CloseDB(g); tdbp->CloseDB(g);
tdbp->SetAbort(false); tdbp->SetAbort(false);
if (trace > 1) if (trace(2))
printf("Table %s closed\n", tdbp->GetName()); printf("Table %s closed\n", tdbp->GetName());
if (!nox && tdbp->GetMode() != MODE_READ && tdbp->GetMode() != MODE_ANY) { if (!nox && tdbp->GetMode() != MODE_READ && tdbp->GetMode() != MODE_ANY) {
if (trace > 1) if (trace(2))
printf("About to reset opt\n"); printf("About to reset opt\n");
if (!tdbp->IsRemote()) { if (!tdbp->IsRemote()) {
...@@ -603,7 +604,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) ...@@ -603,7 +604,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
rc = RC_FX; rc = RC_FX;
} // end catch } // end catch
if (trace > 1) if (trace(2))
htrc("Done rc=%d\n", rc); htrc("Done rc=%d\n", rc);
return (rc == RC_OK || rc == RC_INFO) ? 0 : 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, ...@@ -922,7 +923,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
valp->SetBinValue((void*)p); valp->SetBinValue((void*)p);
#endif // !WORDS_BIGENDIAN #endif // !WORDS_BIGENDIAN
if (trace) { if (trace(1)) {
char bf[32]; char bf[32];
printf("i=%d n=%d key=%s\n", i, n, valp->GetCharString(bf)); printf("i=%d n=%d key=%s\n", i, n, valp->GetCharString(bf));
} // endif trace } // endif trace
...@@ -944,7 +945,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, ...@@ -944,7 +945,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
xbp->SetNval(n); xbp->SetNval(n);
if (trace) if (trace(1))
printf("xbp=%p Nval=%d i=%d incl=%d\n", xbp, n, i, incl[i]); printf("xbp=%p Nval=%d i=%d incl=%d\n", xbp, n, i, incl[i]);
k[i]= xbp->Range(g, i + 1, 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, ...@@ -953,7 +954,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
} // endfor i } // endfor i
if (trace) if (trace(1))
printf("k1=%d k0=%d\n", k[1], k[0]); printf("k1=%d k0=%d\n", k[1], k[0]);
return k[1] - k[0]; return k[1] - k[0];
......
...@@ -90,7 +90,7 @@ int MAPFAM::GetFileLength(PGLOBAL g) ...@@ -90,7 +90,7 @@ int MAPFAM::GetFileLength(PGLOBAL g)
len = (To_Fb && To_Fb->Count) ? To_Fb->Length : TXTFAM::GetFileLength(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); htrc("Mapped file length=%d\n", len);
return len; return len;
...@@ -128,7 +128,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g) ...@@ -128,7 +128,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
&& fp->Count && fp->Mode == mode) && fp->Count && fp->Mode == mode)
break; break;
if (trace) if (trace(1))
htrc("Mapping file, fp=%p\n", fp); htrc("Mapping file, fp=%p\n", fp);
} else } else
...@@ -166,7 +166,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g) ...@@ -166,7 +166,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
sprintf(g->Message, MSG(OPEN_MODE_ERROR), sprintf(g->Message, MSG(OPEN_MODE_ERROR),
"map", (int) rc, filename); "map", (int) rc, filename);
if (trace) if (trace(1))
htrc("CreateFileMap: %s\n", g->Message); htrc("CreateFileMap: %s\n", g->Message);
return (mode == MODE_READ && rc == ENOENT) return (mode == MODE_READ && rc == ENOENT)
...@@ -227,7 +227,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g) ...@@ -227,7 +227,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
Fpos = Mempos = Memory; Fpos = Mempos = Memory;
Top = Memory + len; Top = Memory + len;
if (trace) if (trace(1))
htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n", htrc("fp=%p count=%d MapView=%p len=%d Top=%p\n",
fp, fp->Count, Memory, len, Top); fp, fp->Count, Memory, len, Top);
...@@ -407,7 +407,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -407,7 +407,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
{ {
int n; int n;
if (trace) if (trace(1))
htrc("MAP DeleteDB: irc=%d mempos=%p tobuf=%p Tpos=%p Spos=%p\n", htrc("MAP DeleteDB: irc=%d mempos=%p tobuf=%p Tpos=%p Spos=%p\n",
irc, Mempos, To_Buf, Tpos, Spos); irc, Mempos, To_Buf, Tpos, Spos);
...@@ -417,7 +417,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -417,7 +417,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/*******************************************************************/ /*******************************************************************/
Fpos = Top; Fpos = Top;
if (trace) if (trace(1))
htrc("Fpos placed at file top=%p\n", Fpos); htrc("Fpos placed at file top=%p\n", Fpos);
} // endif irc } // endif irc
...@@ -435,7 +435,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -435,7 +435,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
memmove(Tpos, Spos, n); memmove(Tpos, Spos, n);
Tpos += n; Tpos += n;
if (trace) if (trace(1))
htrc("move %d bytes\n", n); htrc("move %d bytes\n", n);
} // endif n } // endif n
...@@ -443,7 +443,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -443,7 +443,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
if (irc == RC_OK) { if (irc == RC_OK) {
Spos = Mempos; // New start position Spos = Mempos; // New start position
if (trace) if (trace(1))
htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos); htrc("after: Tpos=%p Spos=%p\n", Tpos, Spos);
} else if (To_Fb) { // Can be NULL for deleted files } else if (To_Fb) { // Can be NULL for deleted files
...@@ -473,7 +473,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -473,7 +473,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
return RC_FX; return RC_FX;
} // endif } // endif
if (trace) if (trace(1))
htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc); htrc("done, Tpos=%p newsize=%d drc=%d\n", Tpos, n, drc);
if (!SetEndOfFile(fp->Handle)) { if (!SetEndOfFile(fp->Handle)) {
...@@ -511,7 +511,7 @@ void MAPFAM::CloseTableFile(PGLOBAL g, bool) ...@@ -511,7 +511,7 @@ void MAPFAM::CloseTableFile(PGLOBAL g, bool)
PlugCloseFile(g, To_Fb); PlugCloseFile(g, To_Fb);
//To_Fb = NULL; // To get correct file size in Cardinality //To_Fb = NULL; // To get correct file size in Cardinality
if (trace) if (trace(1))
htrc("MAP Close: closing %s count=%d\n", htrc("MAP Close: closing %s count=%d\n",
To_File, (To_Fb) ? To_Fb->Count : 0); To_File, (To_Fb) ? To_Fb->Count : 0);
......
...@@ -203,7 +203,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) ...@@ -203,7 +203,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
PQRYRES qrp; PQRYRES qrp;
PCOLRES crp; PCOLRES crp;
if (trace) if (trace(1))
htrc("DBFColumns: File %s\n", SVP(fn)); htrc("DBFColumns: File %s\n", SVP(fn));
if (!info) { if (!info) {
...@@ -245,7 +245,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) ...@@ -245,7 +245,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
return qrp; return qrp;
} // endif info } // endif info
if (trace) { if (trace(1)) {
htrc("Structure of %s\n", filename); htrc("Structure of %s\n", filename);
htrc("headlen=%hd reclen=%hd degree=%d\n", htrc("headlen=%hd reclen=%hd degree=%d\n",
mainhead.Headlen(), mainhead.Reclen(), fields); mainhead.Headlen(), mainhead.Reclen(), fields);
...@@ -271,7 +271,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) ...@@ -271,7 +271,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
} else } else
len = thisfield.Length; len = thisfield.Length;
if (trace) if (trace(1))
htrc("%-11s %c %6ld %3d %2d %3d %3d\n", htrc("%-11s %c %6ld %3d %2d %3d %3d\n",
thisfield.Name, thisfield.Type, thisfield.Offset, len, thisfield.Name, thisfield.Type, thisfield.Offset, len,
thisfield.Decimals, thisfield.Setfield, thisfield.Mdxfield); thisfield.Decimals, thisfield.Setfield, thisfield.Mdxfield);
...@@ -522,14 +522,14 @@ bool DBFFAM::OpenTableFile(PGLOBAL g) ...@@ -522,14 +522,14 @@ bool DBFFAM::OpenTableFile(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath()); PlugSetPath(filename, To_File, Tdbp->GetPath());
if (!(Stream = PlugOpenFile(g, filename, opmode))) { if (!(Stream = PlugOpenFile(g, filename, opmode))) {
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
return (mode == MODE_READ && errno == ENOENT) return (mode == MODE_READ && errno == ENOENT)
? PushWarning(g, Tdbp) : true; ? PushWarning(g, Tdbp) : true;
} // endif Stream } // endif Stream
if (trace) if (trace(1))
htrc("File %s is open in mode %s\n", filename, opmode); htrc("File %s is open in mode %s\n", filename, opmode);
To_Fb = dbuserp->Openlist; // Keep track of File block To_Fb = dbuserp->Openlist; // Keep track of File block
...@@ -938,7 +938,7 @@ void DBFFAM::CloseTableFile(PGLOBAL g, bool abort) ...@@ -938,7 +938,7 @@ void DBFFAM::CloseTableFile(PGLOBAL g, bool abort)
rc = PlugCloseFile(g, To_Fb); rc = PlugCloseFile(g, To_Fb);
fin: fin:
if (trace) if (trace(1))
htrc("DBF CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n", htrc("DBF CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
To_File, mode, wrc, rc); To_File, mode, wrc, rc);
......
...@@ -322,7 +322,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g) ...@@ -322,7 +322,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
return RC_FX; return RC_FX;
} // endif fseek } // endif fseek
if (trace > 1) if (trace(2))
htrc("File position is now %d\n", ftell(Stream)); htrc("File position is now %d\n", ftell(Stream));
if (Padded) if (Padded)
...@@ -344,7 +344,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g) ...@@ -344,7 +344,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#endif #endif
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
return RC_FX; return RC_FX;
...@@ -361,7 +361,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g) ...@@ -361,7 +361,7 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
int FIXFAM::WriteBuffer(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", 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); Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
...@@ -374,7 +374,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g) ...@@ -374,7 +374,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
return RC_OK; // We write only full blocks return RC_OK; // We write only full blocks
} // endif CurNum } // endif CurNum
if (trace > 1) if (trace(2))
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf); htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
// Now start the writing process. // Now start the writing process.
...@@ -388,7 +388,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g) ...@@ -388,7 +388,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
CurNum = 0; CurNum = 0;
Tdbp->SetLine(To_Buf); Tdbp->SetLine(To_Buf);
if (trace > 1) if (trace(2))
htrc("write done\n"); htrc("write done\n");
} else { // Mode == MODE_UPDATE } else { // Mode == MODE_UPDATE
...@@ -431,7 +431,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -431,7 +431,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
/* file, and at the end erase all trailing records. */ /* file, and at the end erase all trailing records. */
/* This will be experimented. */ /* This will be experimented. */
/*********************************************************************/ /*********************************************************************/
if (trace > 1) if (trace(2))
htrc("DOS DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n", htrc("DOS DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
irc, UseTemp, Fpos, Tpos, Spos); irc, UseTemp, Fpos, Tpos, Spos);
...@@ -441,7 +441,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -441,7 +441,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
/*******************************************************************/ /*******************************************************************/
Fpos = Tdbp->Cardinality(g); Fpos = Tdbp->Cardinality(g);
if (trace > 1) if (trace(2))
htrc("Fpos placed at file end=%d\n", Fpos); htrc("Fpos placed at file end=%d\n", Fpos);
} else // Fpos is the deleted line position } else // Fpos is the deleted line position
...@@ -491,7 +491,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -491,7 +491,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
OldBlk = -2; // To force fseek to be executed on next block OldBlk = -2; // To force fseek to be executed on next block
} // endif moved } // endif moved
if (trace > 1) if (trace(2))
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos); htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
} else { } else {
...@@ -540,7 +540,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -540,7 +540,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
close(h); close(h);
if (trace > 1) if (trace(2))
htrc("done, h=%d irc=%d\n", h, irc); htrc("done, h=%d irc=%d\n", h, irc);
} // endif UseTemp } // endif UseTemp
...@@ -572,7 +572,7 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b) ...@@ -572,7 +572,7 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
req = (size_t)MY_MIN(n, Dbflen); req = (size_t)MY_MIN(n, Dbflen);
len = fread(DelBuf, Lrecl, req, Stream); len = fread(DelBuf, Lrecl, req, Stream);
if (trace > 1) if (trace(2))
htrc("after read req=%d len=%d\n", req, len); htrc("after read req=%d len=%d\n", req, len);
if (len != req) { if (len != req) {
...@@ -591,13 +591,13 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b) ...@@ -591,13 +591,13 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
return true; return true;
} // endif } // endif
if (trace > 1) if (trace(2))
htrc("after write pos=%d\n", ftell(Stream)); htrc("after write pos=%d\n", ftell(Stream));
Tpos += (int)req; Tpos += (int)req;
Spos += (int)req; Spos += (int)req;
if (trace > 1) if (trace(2))
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos); htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
*b = true; *b = true;
...@@ -648,7 +648,7 @@ void FIXFAM::CloseTableFile(PGLOBAL g, bool abort) ...@@ -648,7 +648,7 @@ void FIXFAM::CloseTableFile(PGLOBAL g, bool abort)
rc = PlugCloseFile(g, To_Fb); rc = PlugCloseFile(g, To_Fb);
fin: fin:
if (trace) if (trace(1))
htrc("FIX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n", htrc("FIX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
To_File, mode, wrc, rc); To_File, mode, wrc, rc);
...@@ -718,7 +718,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)), ...@@ -718,7 +718,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)),
DWORD nbr, drc, len = (DWORD)req; DWORD nbr, drc, len = (DWORD)req;
bool brc = ReadFile(h, inbuf, len, &nbr, NULL); 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); htrc("after read req=%d brc=%d nbr=%d\n", req, brc, nbr);
if (!brc) { if (!brc) {
...@@ -730,7 +730,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)), ...@@ -730,7 +730,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)),
(LPTSTR)buf, sizeof(buf), NULL); (LPTSTR)buf, sizeof(buf), NULL);
sprintf(g->Message, MSG(READ_ERROR), To_File, buf); sprintf(g->Message, MSG(READ_ERROR), To_File, buf);
if (trace > 1) if (trace(2))
htrc("BIGREAD: %s\n", g->Message); htrc("BIGREAD: %s\n", g->Message);
rc = -1; rc = -1;
...@@ -757,7 +757,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) ...@@ -757,7 +757,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
DWORD nbw, drc, len = (DWORD)req; DWORD nbw, drc, len = (DWORD)req;
bool brc = WriteFile(h, inbuf, len, &nbw, NULL); 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); htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
if (!brc || nbw != len) { if (!brc || nbw != len) {
...@@ -775,7 +775,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) ...@@ -775,7 +775,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf); sprintf(g->Message, MSG(WRITE_STRERROR), fn, buf);
if (trace > 1) if (trace(2))
htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n", htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
nbw, len, drc, g->Message); nbw, len, drc, g->Message);
...@@ -790,7 +790,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) ...@@ -790,7 +790,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
sprintf(g->Message, MSG(WRITE_STRERROR), fn, strerror(errno)); 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", htrc("BIGWRITE: nbw=%d len=%d errno=%d %s\n",
nbw, len, errno, g->Message); nbw, len, errno, g->Message);
...@@ -828,7 +828,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) ...@@ -828,7 +828,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath()); PlugSetPath(filename, To_File, Tdbp->GetPath());
if (trace) if (trace(1))
htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode); htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode);
#if defined(__WIN__) #if defined(__WIN__)
...@@ -888,7 +888,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) ...@@ -888,7 +888,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
} else } else
rc = 0; rc = 0;
if (trace > 1) if (trace(2))
htrc(" rc=%d access=%p share=%p creation=%d handle=%p fn=%s\n", htrc(" rc=%d access=%p share=%p creation=%d handle=%p fn=%s\n",
rc, access, share, creation, Hfile, filename); rc, access, share, creation, Hfile, filename);
...@@ -942,7 +942,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) ...@@ -942,7 +942,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
} else } else
rc = 0; rc = 0;
if (trace > 1) if (trace(2))
htrc(" rc=%d oflag=%p tmode=%p handle=%p fn=%s\n", htrc(" rc=%d oflag=%p tmode=%p handle=%p fn=%s\n",
rc, oflag, tmode, Hfile, filename); rc, oflag, tmode, Hfile, filename);
...@@ -1026,11 +1026,11 @@ int BGXFAM::Cardinality(PGLOBAL g) ...@@ -1026,11 +1026,11 @@ int BGXFAM::Cardinality(PGLOBAL g)
if (Hfile == INVALID_HANDLE_VALUE) { if (Hfile == INVALID_HANDLE_VALUE) {
int h = open64(filename, O_RDONLY, 0); int h = open64(filename, O_RDONLY, 0);
if (trace) if (trace(1))
htrc(" h=%d\n", h); htrc(" h=%d\n", h);
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
if (trace) if (trace(1))
htrc(" errno=%d ENOENT=%d\n", errno, ENOENT); htrc(" errno=%d ENOENT=%d\n", errno, ENOENT);
if (errno != ENOENT) { if (errno != ENOENT) {
...@@ -1074,7 +1074,7 @@ int BGXFAM::Cardinality(PGLOBAL g) ...@@ -1074,7 +1074,7 @@ int BGXFAM::Cardinality(PGLOBAL g)
} else } else
card = (int)(fsize / (BIGINT)Lrecl); // Fixed length file card = (int)(fsize / (BIGINT)Lrecl); // Fixed length file
if (trace) if (trace(1))
htrc(" Computed max_K=%d fsize=%lf lrecl=%d\n", htrc(" Computed max_K=%d fsize=%lf lrecl=%d\n",
card, (double)fsize, Lrecl); card, (double)fsize, Lrecl);
...@@ -1181,7 +1181,7 @@ int BGXFAM::ReadBuffer(PGLOBAL g) ...@@ -1181,7 +1181,7 @@ int BGXFAM::ReadBuffer(PGLOBAL g)
if (BigSeek(g, Hfile, (BIGINT)Fpos * (BIGINT)Lrecl)) if (BigSeek(g, Hfile, (BIGINT)Fpos * (BIGINT)Lrecl))
return RC_FX; return RC_FX;
if (trace > 1) if (trace(2))
htrc("File position is now %d\n", Fpos); htrc("File position is now %d\n", Fpos);
nbr = BigRead(g, Hfile, To_Buf, (Padded) ? Blksize : Lrecl * Nrec); nbr = BigRead(g, Hfile, To_Buf, (Padded) ? Blksize : Lrecl * Nrec);
...@@ -1205,7 +1205,7 @@ int BGXFAM::ReadBuffer(PGLOBAL g) ...@@ -1205,7 +1205,7 @@ int BGXFAM::ReadBuffer(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
int BGXFAM::WriteBuffer(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", 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); Tdbp->GetMode(), To_Buf, Tdbp->GetLine(), Nrec, Rbuf, CurNum);
...@@ -1218,7 +1218,7 @@ int BGXFAM::WriteBuffer(PGLOBAL g) ...@@ -1218,7 +1218,7 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
return RC_OK; // We write only full blocks return RC_OK; // We write only full blocks
} // endif CurNum } // endif CurNum
if (trace > 1) if (trace(2))
htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf); htrc(" First line is '%.*s'\n", Lrecl - 2, To_Buf);
// Now start the writing process. // Now start the writing process.
...@@ -1229,7 +1229,7 @@ int BGXFAM::WriteBuffer(PGLOBAL g) ...@@ -1229,7 +1229,7 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
CurNum = 0; CurNum = 0;
Tdbp->SetLine(To_Buf); Tdbp->SetLine(To_Buf);
if (trace > 1) if (trace(2))
htrc("write done\n"); htrc("write done\n");
} else { // Mode == MODE_UPDATE } else { // Mode == MODE_UPDATE
...@@ -1270,7 +1270,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -1270,7 +1270,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
/* file, and at the end erase all trailing records. */ /* file, and at the end erase all trailing records. */
/* This will be experimented. */ /* This will be experimented. */
/*********************************************************************/ /*********************************************************************/
if (trace > 1) if (trace(2))
htrc("BGX DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n", htrc("BGX DeleteDB: rc=%d UseTemp=%d Fpos=%d Tpos=%d Spos=%d\n",
irc, UseTemp, Fpos, Tpos, Spos); irc, UseTemp, Fpos, Tpos, Spos);
...@@ -1280,7 +1280,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -1280,7 +1280,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
/*******************************************************************/ /*******************************************************************/
Fpos = Tdbp->Cardinality(g); Fpos = Tdbp->Cardinality(g);
if (trace > 1) if (trace(2))
htrc("Fpos placed at file end=%d\n", Fpos); htrc("Fpos placed at file end=%d\n", Fpos);
} else // Fpos is the deleted line position } else // Fpos is the deleted line position
...@@ -1318,7 +1318,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -1318,7 +1318,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
return RC_FX; return RC_FX;
if (irc == RC_OK) { if (irc == RC_OK) {
if (trace) if (trace(1))
assert(Spos == Fpos); assert(Spos == Fpos);
Spos++; // New start position is on next line Spos++; // New start position is on next line
...@@ -1330,7 +1330,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -1330,7 +1330,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
OldBlk = -2; // To force fseek to be executed on next block OldBlk = -2; // To force fseek to be executed on next block
} // endif moved } // endif moved
if (trace > 1) if (trace(2))
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos); htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
} else if (irc != RC_OK) { } else if (irc != RC_OK) {
...@@ -1459,7 +1459,7 @@ bool BGXFAM::MoveIntermediateLines(PGLOBAL g, bool *b) ...@@ -1459,7 +1459,7 @@ bool BGXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
Tpos += (int)req; Tpos += (int)req;
Spos += (int)req; Spos += (int)req;
if (trace > 1) if (trace(2))
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos); htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
*b = true; *b = true;
...@@ -1510,7 +1510,7 @@ void BGXFAM::CloseTableFile(PGLOBAL g, bool abort) ...@@ -1510,7 +1510,7 @@ void BGXFAM::CloseTableFile(PGLOBAL g, bool abort)
rc = PlugCloseFile(g, To_Fb); rc = PlugCloseFile(g, To_Fb);
fin: fin:
if (trace) if (trace(1))
htrc("BGX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n", htrc("BGX CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
To_File, mode, wrc, rc); To_File, mode, wrc, rc);
......
...@@ -203,7 +203,7 @@ bool GZFAM::AllocateBuffer(PGLOBAL g) ...@@ -203,7 +203,7 @@ bool GZFAM::AllocateBuffer(PGLOBAL g)
Buflen = Lrecl + 2; // Lrecl does not include CRLF Buflen = Lrecl + 2; // Lrecl does not include CRLF
//Buflen *= ((Mode == MODE_DELETE) ? DOS_BUFF_LEN : 1); NIY //Buflen *= ((Mode == MODE_DELETE) ? DOS_BUFF_LEN : 1); NIY
if (trace) if (trace(1))
htrc("SubAllocating a buffer of %d bytes\n", Buflen); htrc("SubAllocating a buffer of %d bytes\n", Buflen);
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen); To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
...@@ -347,7 +347,7 @@ int GZFAM::ReadBuffer(PGLOBAL g) ...@@ -347,7 +347,7 @@ int GZFAM::ReadBuffer(PGLOBAL g)
} else } else
rc = Zerror(g); rc = Zerror(g);
if (trace > 1) if (trace(2))
htrc(" Read: '%s' rc=%d\n", To_Buf, rc); htrc(" Read: '%s' rc=%d\n", To_Buf, rc);
return rc; return rc;
...@@ -389,7 +389,7 @@ void GZFAM::CloseTableFile(PGLOBAL, bool) ...@@ -389,7 +389,7 @@ void GZFAM::CloseTableFile(PGLOBAL, bool)
{ {
int rc = gzclose(Zfile); int rc = gzclose(Zfile);
if (trace) if (trace(1))
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc); htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
Zfile = NULL; // So we can know whether table is open Zfile = NULL; // So we can know whether table is open
...@@ -702,7 +702,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool) ...@@ -702,7 +702,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
} else } else
rc = gzclose(Zfile); rc = gzclose(Zfile);
if (trace) if (trace(1))
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc); htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
Zfile = NULL; // So we can know whether table is open Zfile = NULL; // So we can know whether table is open
...@@ -1382,7 +1382,7 @@ void ZLBFAM::CloseTableFile(PGLOBAL g, bool) ...@@ -1382,7 +1382,7 @@ void ZLBFAM::CloseTableFile(PGLOBAL g, bool)
} else } else
rc = fclose(Stream); rc = fclose(Stream);
if (trace) if (trace(1))
htrc("ZLB CloseTableFile: closing %s mode=%d rc=%d\n", htrc("ZLB CloseTableFile: closing %s mode=%d rc=%d\n",
To_File, Tdbp->GetMode(), rc); To_File, Tdbp->GetMode(), rc);
...@@ -1408,7 +1408,7 @@ void ZLBFAM::Rewind(void) ...@@ -1408,7 +1408,7 @@ void ZLBFAM::Rewind(void)
rewind(Stream); 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); htrc("fread error %d in Rewind", errno);
fseek(Stream, *Zlenp + sizeof(int), SEEK_SET); fseek(Stream, *Zlenp + sizeof(int), SEEK_SET);
......
...@@ -194,12 +194,12 @@ int TXTFAM::GetFileLength(PGLOBAL g) ...@@ -194,12 +194,12 @@ int TXTFAM::GetFileLength(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath()); PlugSetPath(filename, To_File, Tdbp->GetPath());
h= global_open(g, MSGID_OPEN_MODE_STRERROR, filename, _O_RDONLY); 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); htrc("GetFileLength: fn=%s h=%d\n", filename, h);
if (h == -1) { if (h == -1) {
if (errno != ENOENT) { if (errno != ENOENT) {
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
len = -1; len = -1;
...@@ -249,7 +249,7 @@ int TXTFAM::Cardinality(PGLOBAL g) ...@@ -249,7 +249,7 @@ int TXTFAM::Cardinality(PGLOBAL g)
} // endif Padded } // endif Padded
if (trace) if (trace(1))
htrc(" Computed max_K=%d Filen=%d lrecl=%d\n", htrc(" Computed max_K=%d Filen=%d lrecl=%d\n",
card, len, Lrecl); card, len, Lrecl);
...@@ -390,7 +390,7 @@ int TXTFAM::UpdateSortedRows(PGLOBAL g) ...@@ -390,7 +390,7 @@ int TXTFAM::UpdateSortedRows(PGLOBAL g)
return RC_OK; return RC_OK;
err: err:
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
return RC_FX; return RC_FX;
...@@ -439,7 +439,7 @@ int TXTFAM::DeleteSortedRows(PGLOBAL g) ...@@ -439,7 +439,7 @@ int TXTFAM::DeleteSortedRows(PGLOBAL g)
return RC_OK; return RC_OK;
err: err:
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
return RC_FX; return RC_FX;
...@@ -512,7 +512,7 @@ int DOSFAM::GetFileLength(PGLOBAL g) ...@@ -512,7 +512,7 @@ int DOSFAM::GetFileLength(PGLOBAL g)
if ((len = _filelength(_fileno(Stream))) < 0) if ((len = _filelength(_fileno(Stream))) < 0)
sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", To_File); sprintf(g->Message, MSG(FILELEN_ERROR), "_filelength", To_File);
if (trace) if (trace(1))
htrc("File length=%d\n", len); htrc("File length=%d\n", len);
return len; return len;
...@@ -598,14 +598,14 @@ bool DOSFAM::OpenTableFile(PGLOBAL g) ...@@ -598,14 +598,14 @@ bool DOSFAM::OpenTableFile(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath()); PlugSetPath(filename, To_File, Tdbp->GetPath());
if (!(Stream = PlugOpenFile(g, filename, opmode))) { if (!(Stream = PlugOpenFile(g, filename, opmode))) {
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
return (mode == MODE_READ && errno == ENOENT) return (mode == MODE_READ && errno == ENOENT)
? PushWarning(g, Tdbp) : true; ? PushWarning(g, Tdbp) : true;
} // endif Stream } // endif Stream
if (trace) if (trace(1))
htrc("File %s open Stream=%p mode=%s\n", filename, Stream, opmode); htrc("File %s open Stream=%p mode=%s\n", filename, Stream, opmode);
To_Fb = dbuserp->Openlist; // Keep track of File block To_Fb = dbuserp->Openlist; // Keep track of File block
...@@ -628,7 +628,7 @@ bool DOSFAM::AllocateBuffer(PGLOBAL g) ...@@ -628,7 +628,7 @@ bool DOSFAM::AllocateBuffer(PGLOBAL g)
// Lrecl does not include line ending // Lrecl does not include line ending
Buflen = Lrecl + Ending + ((Bin) ? 1 : 0) + 1; // Sergei Buflen = Lrecl + Ending + ((Bin) ? 1 : 0) + 1; // Sergei
if (trace) if (trace(1))
htrc("SubAllocating a buffer of %d bytes\n", Buflen); htrc("SubAllocating a buffer of %d bytes\n", Buflen);
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen); To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
...@@ -768,7 +768,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g) ...@@ -768,7 +768,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
if (!Stream) if (!Stream)
return RC_EF; return RC_EF;
if (trace > 1) if (trace(2))
htrc("ReadBuffer: Tdbp=%p To_Line=%p Placed=%d\n", htrc("ReadBuffer: Tdbp=%p To_Line=%p Placed=%d\n",
Tdbp, Tdbp->To_Line, Placed); Tdbp, Tdbp->To_Line, Placed);
...@@ -782,7 +782,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g) ...@@ -782,7 +782,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
CurBlk = (int)Rows++; CurBlk = (int)Rows++;
if (trace > 1) if (trace(2))
htrc("ReadBuffer: CurBlk=%d\n", CurBlk); htrc("ReadBuffer: CurBlk=%d\n", CurBlk);
/********************************************************************/ /********************************************************************/
...@@ -803,14 +803,14 @@ int DOSFAM::ReadBuffer(PGLOBAL g) ...@@ -803,14 +803,14 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
} else } else
Placed = false; Placed = false;
if (trace > 1) if (trace(2))
htrc(" About to read: stream=%p To_Buf=%p Buflen=%d\n", htrc(" About to read: stream=%p To_Buf=%p Buflen=%d\n",
Stream, To_Buf, Buflen); Stream, To_Buf, Buflen);
if (fgets(To_Buf, Buflen, Stream)) { if (fgets(To_Buf, Buflen, Stream)) {
p = To_Buf + strlen(To_Buf) - 1; 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); htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p);
#if defined(__WIN__) #if defined(__WIN__)
...@@ -838,7 +838,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g) ...@@ -838,7 +838,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
} else if (*p == '\n') } else if (*p == '\n')
*p = '\0'; // Eliminate ending new-line character *p = '\0'; // Eliminate ending new-line character
if (trace > 1) if (trace(2))
htrc(" To_Buf='%s'\n", To_Buf); htrc(" To_Buf='%s'\n", To_Buf);
strcpy(Tdbp->To_Line, To_Buf); strcpy(Tdbp->To_Line, To_Buf);
...@@ -853,13 +853,13 @@ int DOSFAM::ReadBuffer(PGLOBAL g) ...@@ -853,13 +853,13 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0)); sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
#endif #endif
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
rc = RC_FX; rc = RC_FX;
} // endif's fgets } // endif's fgets
if (trace > 1) if (trace(2))
htrc("ReadBuffer: rc=%d\n", rc); htrc("ReadBuffer: rc=%d\n", rc);
IsRead = true; IsRead = true;
...@@ -895,7 +895,7 @@ int DOSFAM::WriteBuffer(PGLOBAL g) ...@@ -895,7 +895,7 @@ int DOSFAM::WriteBuffer(PGLOBAL g)
/*******************************************************************/ /*******************************************************************/
curpos = ftell(Stream); curpos = ftell(Stream);
if (trace) if (trace(1))
htrc("Last : %d cur: %d\n", Fpos, curpos); htrc("Last : %d cur: %d\n", Fpos, curpos);
if (UseTemp) { if (UseTemp) {
...@@ -937,7 +937,7 @@ int DOSFAM::WriteBuffer(PGLOBAL g) ...@@ -937,7 +937,7 @@ int DOSFAM::WriteBuffer(PGLOBAL g)
return RC_FX; return RC_FX;
} // endif } // endif
if (trace) if (trace(1))
htrc("write done\n"); htrc("write done\n");
return RC_OK; return RC_OK;
...@@ -960,7 +960,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -960,7 +960,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
/* file, and at the end erase all trailing records. */ /* file, and at the end erase all trailing records. */
/* This will be experimented. */ /* This will be experimented. */
/*********************************************************************/ /*********************************************************************/
if (trace) if (trace(1))
htrc( htrc(
"DOS DeleteDB: rc=%d UseTemp=%d curpos=%d Fpos=%d Tpos=%d Spos=%d\n", "DOS DeleteDB: rc=%d UseTemp=%d curpos=%d Fpos=%d Tpos=%d Spos=%d\n",
irc, UseTemp, curpos, Fpos, Tpos, Spos); irc, UseTemp, curpos, Fpos, Tpos, Spos);
...@@ -972,7 +972,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -972,7 +972,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
fseek(Stream, 0, SEEK_END); fseek(Stream, 0, SEEK_END);
Fpos = ftell(Stream); Fpos = ftell(Stream);
if (trace) if (trace(1))
htrc("Fpos placed at file end=%d\n", Fpos); htrc("Fpos placed at file end=%d\n", Fpos);
} // endif irc } // endif irc
...@@ -1015,7 +1015,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -1015,7 +1015,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
Spos = GetNextPos(); // New start position Spos = GetNextPos(); // New start position
if (trace) if (trace(1))
htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos); htrc("after: Tpos=%d Spos=%d\n", Tpos, Spos);
} else { } else {
...@@ -1058,7 +1058,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -1058,7 +1058,7 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
close(h); close(h);
if (trace) if (trace(1))
htrc("done, h=%d irc=%d\n", h, irc); htrc("done, h=%d irc=%d\n", h, irc);
} // endif !UseTemp } // endif !UseTemp
...@@ -1083,7 +1083,7 @@ bool DOSFAM::OpenTempFile(PGLOBAL g) ...@@ -1083,7 +1083,7 @@ bool DOSFAM::OpenTempFile(PGLOBAL g)
strcat(PlugRemoveType(tempname, tempname), ".t"); strcat(PlugRemoveType(tempname, tempname), ".t");
if (!(T_Stream = PlugOpenFile(g, tempname, "wb"))) { if (!(T_Stream = PlugOpenFile(g, tempname, "wb"))) {
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
rc = true; rc = true;
...@@ -1112,7 +1112,7 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b) ...@@ -1112,7 +1112,7 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
req = (size_t)MY_MIN(n, Dbflen); req = (size_t)MY_MIN(n, Dbflen);
len = fread(DelBuf, 1, req, Stream); len = fread(DelBuf, 1, req, Stream);
if (trace) if (trace(1))
htrc("after read req=%d len=%d\n", req, len); htrc("after read req=%d len=%d\n", req, len);
if (len != req) { if (len != req) {
...@@ -1131,13 +1131,13 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b) ...@@ -1131,13 +1131,13 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
return true; return true;
} // endif } // endif
if (trace) if (trace(1))
htrc("after write pos=%d\n", ftell(Stream)); htrc("after write pos=%d\n", ftell(Stream));
Tpos += (int)req; Tpos += (int)req;
Spos += (int)req; Spos += (int)req;
if (trace) if (trace(1))
htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos); htrc("loop: Tpos=%d Spos=%d\n", Tpos, Spos);
*b = true; *b = true;
...@@ -1217,7 +1217,7 @@ void DOSFAM::CloseTableFile(PGLOBAL g, bool abort) ...@@ -1217,7 +1217,7 @@ void DOSFAM::CloseTableFile(PGLOBAL g, bool abort)
} else { } else {
rc = PlugCloseFile(g, To_Fb); rc = PlugCloseFile(g, To_Fb);
if (trace) if (trace(1))
htrc("DOS Close: closing %s rc=%d\n", To_File, rc); htrc("DOS Close: closing %s rc=%d\n", To_File, rc);
} // endif UseTemp } // endif UseTemp
...@@ -1453,7 +1453,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g) ...@@ -1453,7 +1453,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
// Calculate the length of block to read // Calculate the length of block to read
BlkLen = BlkPos[CurBlk + 1] - BlkPos[CurBlk]; BlkLen = BlkPos[CurBlk + 1] - BlkPos[CurBlk];
if (trace) if (trace(1))
htrc("File position is now %d\n", ftell(Stream)); htrc("File position is now %d\n", ftell(Stream));
// Read the entire next block // Read the entire next block
...@@ -1487,7 +1487,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g) ...@@ -1487,7 +1487,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#endif #endif
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
return RC_FX; return RC_FX;
...@@ -1637,7 +1637,7 @@ void BLKFAM::CloseTableFile(PGLOBAL g, bool abort) ...@@ -1637,7 +1637,7 @@ void BLKFAM::CloseTableFile(PGLOBAL g, bool abort)
rc = PlugCloseFile(g, To_Fb); rc = PlugCloseFile(g, To_Fb);
if (trace) if (trace(1))
htrc("BLK CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n", htrc("BLK CloseTableFile: closing %s mode=%d wrc=%d rc=%d\n",
To_File, Tdbp->GetMode(), wrc, rc); To_File, Tdbp->GetMode(), wrc, rc);
......
This diff is collapsed.
...@@ -699,7 +699,7 @@ bool UNZIPUTL::openEntry(PGLOBAL g) ...@@ -699,7 +699,7 @@ bool UNZIPUTL::openEntry(PGLOBAL g)
entryopen = true; entryopen = true;
} // endif rc } // endif rc
if (trace) if (trace(1))
htrc("Openning entry%s %s\n", fn, (entryopen) ? "oked" : "failed"); htrc("Openning entry%s %s\n", fn, (entryopen) ? "oked" : "failed");
return !entryopen; return !entryopen;
...@@ -751,7 +751,7 @@ int UNZFAM::GetFileLength(PGLOBAL g) ...@@ -751,7 +751,7 @@ int UNZFAM::GetFileLength(PGLOBAL g)
int len = (zutp && zutp->entryopen) ? (int)(Top - Memory) int len = (zutp && zutp->entryopen) ? (int)(Top - Memory)
: TXTFAM::GetFileLength(g) * 3; : TXTFAM::GetFileLength(g) * 3;
if (trace) if (trace(1))
htrc("Zipped file length=%d\n", len); htrc("Zipped file length=%d\n", len);
return len; return len;
......
...@@ -298,7 +298,7 @@ PFIL FILTER::Link(PGLOBAL g, PFIL fil2) ...@@ -298,7 +298,7 @@ PFIL FILTER::Link(PGLOBAL g, PFIL fil2)
{ {
PFIL fil1; PFIL fil1;
if (trace) if (trace(1))
htrc("Linking filter %p with op=%d... to filter %p with op=%d\n", htrc("Linking filter %p with op=%d... to filter %p with op=%d\n",
this, Opc, fil2, (fil2) ? fil2->Opc : 0); this, Opc, fil2, (fil2) ? fil2->Opc : 0);
...@@ -352,7 +352,7 @@ int FILTER::CheckColumn(PGLOBAL g, PSQL sqlp, PXOB &p, int &ag) ...@@ -352,7 +352,7 @@ int FILTER::CheckColumn(PGLOBAL g, PSQL sqlp, PXOB &p, int &ag)
char errmsg[MAX_STR] = ""; char errmsg[MAX_STR] = "";
int agg, k, n = 0; int agg, k, n = 0;
if (trace) if (trace(1))
htrc("FILTER CheckColumn: sqlp=%p ag=%d\n", sqlp, ag); htrc("FILTER CheckColumn: sqlp=%p ag=%d\n", sqlp, ag);
switch (Opc) { switch (Opc) {
...@@ -537,7 +537,7 @@ PFIL FILTER::SortJoin(PGLOBAL g) ...@@ -537,7 +537,7 @@ PFIL FILTER::SortJoin(PGLOBAL g)
bool FILTER::FindJoinFilter(POPJOIN opj, PFIL fprec, bool teq, bool tek, bool FILTER::FindJoinFilter(POPJOIN opj, PFIL fprec, bool teq, bool tek,
bool tk2, bool tc2, bool tix, bool thx) 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", htrc("FindJoinFilter: opj=%p fprec=%p tests=(%d,%d,%d,%d)\n",
opj, fprec, teq, tek, tk2, tc2); opj, fprec, teq, tek, tk2, tc2);
...@@ -864,7 +864,7 @@ bool FILTER::CheckLocal(PTDB tdbp) ...@@ -864,7 +864,7 @@ bool FILTER::CheckLocal(PTDB tdbp)
{ {
bool local = TRUE; bool local = TRUE;
if (trace) { if (trace(1)) {
if (tdbp) if (tdbp)
htrc("CheckLocal: filp=%p R%d\n", this, tdbp->GetTdb_No()); htrc("CheckLocal: filp=%p R%d\n", this, tdbp->GetTdb_No());
else else
...@@ -874,7 +874,7 @@ bool FILTER::CheckLocal(PTDB tdbp) ...@@ -874,7 +874,7 @@ bool FILTER::CheckLocal(PTDB tdbp)
for (int i = 0; local && i < 2; i++) for (int i = 0; local && i < 2; i++)
local = Arg(i)->CheckLocal(tdbp); local = Arg(i)->CheckLocal(tdbp);
if (trace) if (trace(1))
htrc("FCL: returning %d\n", local); htrc("FCL: returning %d\n", local);
return (local); return (local);
...@@ -980,7 +980,7 @@ bool FILTER::Convert(PGLOBAL g, bool having) ...@@ -980,7 +980,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
{ {
int i, comtype = TYPE_ERROR; int i, comtype = TYPE_ERROR;
if (trace) if (trace(1))
htrc("converting(?) %s %p opc=%d\n", htrc("converting(?) %s %p opc=%d\n",
(having) ? "having" : "filter", this, Opc); (having) ? "having" : "filter", this, Opc);
...@@ -1011,7 +1011,7 @@ bool FILTER::Convert(PGLOBAL g, bool having) ...@@ -1011,7 +1011,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
return TRUE; return TRUE;
} // endswitch } // endswitch
if (trace) if (trace(1))
htrc("Filter(%d): Arg type=%d\n", i, GetArgType(i)); htrc("Filter(%d): Arg type=%d\n", i, GetArgType(i));
// Set default values // Set default values
...@@ -1056,7 +1056,7 @@ bool FILTER::Convert(PGLOBAL g, bool having) ...@@ -1056,7 +1056,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
return TRUE; return TRUE;
} // endif } // endif
if (trace) if (trace(1))
htrc(" comtype=%d, B_T(%d)=%d Val(%d)=%p\n", htrc(" comtype=%d, B_T(%d)=%d Val(%d)=%p\n",
comtype, i, Test[i].B_T, i, Val(i)); comtype, i, Test[i].B_T, i, Val(i));
...@@ -1064,7 +1064,7 @@ bool FILTER::Convert(PGLOBAL g, bool having) ...@@ -1064,7 +1064,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
// Set or allocate the filter argument values and buffers // Set or allocate the filter argument values and buffers
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
if (trace) if (trace(1))
htrc(" conv type %d ? i=%d B_T=%d comtype=%d\n", htrc(" conv type %d ? i=%d B_T=%d comtype=%d\n",
GetArgType(i), i, Test[i].B_T, comtype); GetArgType(i), i, Test[i].B_T, comtype);
...@@ -1141,7 +1141,7 @@ bool FILTER::Convert(PGLOBAL g, bool having) ...@@ -1141,7 +1141,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
TEST: // Test for possible Eval optimization TEST: // Test for possible Eval optimization
if (trace) if (trace(1))
htrc("Filp %p op=%d argtypes=(%d,%d)\n", htrc("Filp %p op=%d argtypes=(%d,%d)\n",
this, Opc, GetArgType(0), GetArgType(1)); this, Opc, GetArgType(0), GetArgType(1));
...@@ -1230,7 +1230,7 @@ bool FILTER::Eval(PGLOBAL g) ...@@ -1230,7 +1230,7 @@ bool FILTER::Eval(PGLOBAL g)
else if (Test[i].Conv) else if (Test[i].Conv)
Val(i)->SetValue_pval(Arg(i)->GetValue()); 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", 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, Opc, GetArgType(0), GetArgType(1), Test[0].B_T, Test[1].B_T,
Val(0), Val(1)); Val(0), Val(1));
...@@ -1270,7 +1270,7 @@ bool FILTER::Eval(PGLOBAL g) ...@@ -1270,7 +1270,7 @@ bool FILTER::Eval(PGLOBAL g)
goto FilterError; goto FilterError;
} // endswitch Type } // endswitch Type
if (trace) { if (trace(1)) {
htrc(" IN filtering: ap=%p\n", ap); htrc(" IN filtering: ap=%p\n", ap);
if (ap) if (ap)
...@@ -1360,7 +1360,7 @@ bool FILTER::Eval(PGLOBAL g) ...@@ -1360,7 +1360,7 @@ bool FILTER::Eval(PGLOBAL g)
goto FilterError; goto FilterError;
} // endswitch Opc } // endswitch Opc
if (trace) if (trace(1))
htrc("Eval: filter %p Opc=%d result=%d\n", htrc("Eval: filter %p Opc=%d result=%d\n",
this, Opc, Value->GetIntValue()); this, Opc, Value->GetIntValue());
...@@ -1692,7 +1692,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having) ...@@ -1692,7 +1692,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
{ {
PFIL filp = NULL; PFIL filp = NULL;
if (trace) if (trace(1))
htrc("PrepareFilter: fp=%p having=%d\n", fp, having); htrc("PrepareFilter: fp=%p having=%d\n", fp, having);
while (fp) { while (fp) {
...@@ -1714,7 +1714,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having) ...@@ -1714,7 +1714,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
filp->Next = NULL; filp->Next = NULL;
} // endwhile } // endwhile
if (trace) if (trace(1))
htrc(" returning filp=%p\n", filp); htrc(" returning filp=%p\n", filp);
return filp; return filp;
...@@ -1740,7 +1740,7 @@ DllExport bool ApplyFilter(PGLOBAL g, PFIL filp) ...@@ -1740,7 +1740,7 @@ DllExport bool ApplyFilter(PGLOBAL g, PFIL filp)
if (filp->Eval(g)) if (filp->Eval(g))
throw (int)TYPE_FILTER; throw (int)TYPE_FILTER;
if (trace > 1) if (trace(2))
htrc("PlugFilter filp=%p result=%d\n", htrc("PlugFilter filp=%p result=%d\n",
filp, filp->GetResult()); filp, filp->GetResult());
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
/***********************************************************************/ /***********************************************************************/
/* Define access to the thread based trace value. */ /* Define access to the thread based trace value. */
/***********************************************************************/ /***********************************************************************/
#define trace GetTraceValue() #define trace(T) (bool)(GetTraceValue() & (uint)T)
/***********************************************************************/ /***********************************************************************/
/* Miscellaneous Constants */ /* Miscellaneous Constants */
...@@ -220,14 +220,19 @@ DllExport BOOL PlugIsAbsolutePath(LPCSTR path); ...@@ -220,14 +220,19 @@ DllExport BOOL PlugIsAbsolutePath(LPCSTR path);
DllExport bool AllocSarea(PGLOBAL, uint); DllExport bool AllocSarea(PGLOBAL, uint);
DllExport void FreeSarea(PGLOBAL); DllExport void FreeSarea(PGLOBAL);
DllExport BOOL PlugSubSet(PGLOBAL, void *, uint); DllExport BOOL PlugSubSet(PGLOBAL, void *, uint);
DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t);
DllExport char *PlugDup(PGLOBAL g, const char *str); DllExport char *PlugDup(PGLOBAL g, const char *str);
DllExport void *MakePtr(void *, OFFSET); DllExport void *MakePtr(void *, OFFSET);
DllExport void htrc(char const *fmt, ...); DllExport void htrc(char const *fmt, ...);
DllExport int GetTraceValue(void); //DllExport int GetTraceValue(void);
DllExport uint GetTraceValue(void);
#if defined(__cplusplus) #if defined(__cplusplus)
} // extern "C" } // extern "C"
#endif #endif
/***********************************************************************/
/* Non exported routine declarations. */
/***********************************************************************/
void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
/*-------------------------- End of Global.H --------------------------*/ /*-------------------------- End of Global.H --------------------------*/
This diff is collapsed.
...@@ -293,7 +293,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) ...@@ -293,7 +293,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
next_key = &section->key; next_key = &section->key;
prev_key = NULL; prev_key = NULL;
if (trace > 1) if (trace(2))
htrc("New section: '%s'\n",section->name); htrc("New section: '%s'\n",section->name);
continue; continue;
...@@ -336,7 +336,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) ...@@ -336,7 +336,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
next_key = &key->next; next_key = &key->next;
prev_key = key; prev_key = key;
if (trace > 1) if (trace(2))
htrc("New key: name='%s', value='%s'\n", htrc("New key: name='%s', value='%s'\n",
key->name,key->value?key->value:"(none)"); key->name,key->value?key->value:"(none)");
...@@ -359,7 +359,7 @@ static BOOL PROFILE_FlushFile(void) ...@@ -359,7 +359,7 @@ static BOOL PROFILE_FlushFile(void)
FILE *file = NULL; FILE *file = NULL;
struct stat buf; struct stat buf;
if (trace > 1) if (trace(2))
htrc("PROFILE_FlushFile: CurProfile=%p\n", CurProfile); htrc("PROFILE_FlushFile: CurProfile=%p\n", CurProfile);
if (!CurProfile) { if (!CurProfile) {
...@@ -398,7 +398,7 @@ static BOOL PROFILE_FlushFile(void) ...@@ -398,7 +398,7 @@ static BOOL PROFILE_FlushFile(void)
return FALSE; return FALSE;
} // endif !file } // endif !file
if (trace > 1) if (trace(2))
htrc("Saving '%s'\n", CurProfile->filename); htrc("Saving '%s'\n", CurProfile->filename);
PROFILE_Save(file, CurProfile->section); PROFILE_Save(file, CurProfile->section);
...@@ -447,7 +447,7 @@ static BOOL PROFILE_Open(LPCSTR filename) ...@@ -447,7 +447,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
struct stat buf; struct stat buf;
PROFILE *tempProfile; PROFILE *tempProfile;
if (trace > 1) if (trace(2))
htrc("PROFILE_Open: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES); htrc("PROFILE_Open: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
/* First time around */ /* First time around */
...@@ -468,7 +468,7 @@ static BOOL PROFILE_Open(LPCSTR filename) ...@@ -468,7 +468,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
/* Check for a match */ /* Check for a match */
for (i = 0; i < N_CACHED_PROFILES; i++) { 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); htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) { if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) {
...@@ -483,11 +483,11 @@ static BOOL PROFILE_Open(LPCSTR filename) ...@@ -483,11 +483,11 @@ static BOOL PROFILE_Open(LPCSTR filename)
} // endif i } // endif i
if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime) { 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); htrc("(%s): already opened (mru=%d)\n", filename, i);
} else { } else {
if (trace > 1) if (trace(2))
htrc("(%s): already opened, needs refreshing (mru=%d)\n", filename, i); htrc("(%s): already opened, needs refreshing (mru=%d)\n", filename, i);
} // endif stat } // endif stat
...@@ -535,11 +535,11 @@ static BOOL PROFILE_Open(LPCSTR filename) ...@@ -535,11 +535,11 @@ static BOOL PROFILE_Open(LPCSTR filename)
// strcpy(p, filename); // strcpy(p, filename);
// _strlwr(p); // _strlwr(p);
if (trace > 1) if (trace(2))
htrc("Opening %s\n", filename); htrc("Opening %s\n", filename);
if ((file = fopen(filename, "r"))) { if ((file = fopen(filename, "r"))) {
if (trace > 1) if (trace(2))
htrc("(%s): found it\n", filename); htrc("(%s): found it\n", filename);
// CurProfile->unix_name = malloc(strlen(buffer)+1); // CurProfile->unix_name = malloc(strlen(buffer)+1);
...@@ -574,12 +574,12 @@ void PROFILE_Close(LPCSTR filename) ...@@ -574,12 +574,12 @@ void PROFILE_Close(LPCSTR filename)
struct stat buf; struct stat buf;
PROFILE *tempProfile; PROFILE *tempProfile;
if (trace > 1) if (trace(2))
htrc("PROFILE_Close: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES); htrc("PROFILE_Close: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
/* Check for a match */ /* Check for a match */
for (i = 0; i < N_CACHED_PROFILES; i++) { 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); htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) { if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) {
...@@ -591,7 +591,7 @@ void PROFILE_Close(LPCSTR filename) ...@@ -591,7 +591,7 @@ void PROFILE_Close(LPCSTR filename)
CurProfile=tempProfile; CurProfile=tempProfile;
} // endif i } // endif i
if (trace > 1) { if (trace(2)) {
if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime) if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime)
htrc("(%s): already opened (mru=%d)\n", filename, i); htrc("(%s): already opened (mru=%d)\n", filename, i);
else else
...@@ -620,7 +620,7 @@ void PROFILE_End(void) ...@@ -620,7 +620,7 @@ void PROFILE_End(void)
{ {
int i; int i;
if (trace) if (trace(3))
htrc("PROFILE_End: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES); htrc("PROFILE_End: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
if (!CurProfile) // Sergey Vojtovich if (!CurProfile) // Sergey Vojtovich
...@@ -628,7 +628,7 @@ void PROFILE_End(void) ...@@ -628,7 +628,7 @@ void PROFILE_End(void)
/* Close all opened files and free the cache structure */ /* Close all opened files and free the cache structure */
for (i = 0; i < N_CACHED_PROFILES; i++) { for (i = 0; i < N_CACHED_PROFILES; i++) {
if (trace) if (trace(3))
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i); htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
// CurProfile = MRUProfile[i]; Sergey Vojtovich // CurProfile = MRUProfile[i]; Sergey Vojtovich
...@@ -894,7 +894,7 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len) ...@@ -894,7 +894,7 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len)
uint f,l; uint f,l;
PROFILESECTION *section; PROFILESECTION *section;
if (trace > 1) if (trace(2))
htrc("GetSectionNames: buffer=%p len=%u\n", buffer, len); htrc("GetSectionNames: buffer=%p len=%u\n", buffer, len);
if (!buffer || !len) if (!buffer || !len)
...@@ -909,17 +909,17 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len) ...@@ -909,17 +909,17 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len)
buf = buffer; buf = buffer;
section = CurProfile->section; section = CurProfile->section;
if (trace > 1) if (trace(2))
htrc("GetSectionNames: section=%p\n", section); htrc("GetSectionNames: section=%p\n", section);
while (section != NULL) { while (section != NULL) {
if (trace > 1) if (trace(2))
htrc("section=%s\n", section->name); htrc("section=%s\n", section->name);
if (section->name[0]) { if (section->name[0]) {
l = strlen(section->name) + 1; l = strlen(section->name) + 1;
if (trace > 1) if (trace(2))
htrc("l=%u f=%u\n", l, f); htrc("l=%u f=%u\n", l, f);
if (l > f) { if (l > f) {
...@@ -982,7 +982,7 @@ static int PROFILE_GetString(LPCSTR section, LPCSTR key_name, ...@@ -982,7 +982,7 @@ static int PROFILE_GetString(LPCSTR section, LPCSTR key_name,
key = PROFILE_Find(&CurProfile->section, section, key_name, FALSE, FALSE); key = PROFILE_Find(&CurProfile->section, section, key_name, FALSE, FALSE);
PROFILE_CopyEntry(buffer, (key && key->value) ? key->value : def_val, len, 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", htrc("('%s','%s','%s'): returning '%s'\n",
section, key_name, def_val, buffer ); section, key_name, def_val, buffer );
...@@ -1010,7 +1010,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name, ...@@ -1010,7 +1010,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
LPCSTR value, BOOL create_always) LPCSTR value, BOOL create_always)
{ {
if (!key_name) { /* Delete a whole section */ if (!key_name) { /* Delete a whole section */
if (trace > 1) if (trace(2))
htrc("Deleting('%s')\n", section_name); htrc("Deleting('%s')\n", section_name);
CurProfile->changed |= PROFILE_DeleteSection(&CurProfile->section, CurProfile->changed |= PROFILE_DeleteSection(&CurProfile->section,
...@@ -1018,7 +1018,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name, ...@@ -1018,7 +1018,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
return TRUE; /* Even if PROFILE_DeleteSection() has failed, return TRUE; /* Even if PROFILE_DeleteSection() has failed,
this is not an error on application's level.*/ this is not an error on application's level.*/
} else if (!value) { /* Delete a key */ } else if (!value) { /* Delete a key */
if (trace > 1) if (trace(2))
htrc("Deleting('%s','%s')\n", section_name, key_name); htrc("Deleting('%s','%s')\n", section_name, key_name);
CurProfile->changed |= PROFILE_DeleteKey(&CurProfile->section, CurProfile->changed |= PROFILE_DeleteKey(&CurProfile->section,
...@@ -1027,7 +1027,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name, ...@@ -1027,7 +1027,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
} else { /* Set the key value */ } else { /* Set the key value */
PROFILEKEY *key = PROFILE_Find(&CurProfile->section, section_name, PROFILEKEY *key = PROFILE_Find(&CurProfile->section, section_name,
key_name, TRUE, create_always); key_name, TRUE, create_always);
if (trace > 1) if (trace(2))
htrc("Setting('%s','%s','%s')\n", section_name, key_name, value); htrc("Setting('%s','%s','%s')\n", section_name, key_name, value);
if (!key) if (!key)
...@@ -1040,17 +1040,17 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name, ...@@ -1040,17 +1040,17 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
value++; value++;
if (!strcmp(key->value, value)) { if (!strcmp(key->value, value)) {
if (trace > 1) if (trace(2))
htrc(" no change needed\n" ); htrc(" no change needed\n" );
return TRUE; /* No change needed */ return TRUE; /* No change needed */
} // endif value } // endif value
if (trace > 1) if (trace(2))
htrc(" replacing '%s'\n", key->value); htrc(" replacing '%s'\n", key->value);
free(key->value); free(key->value);
} else if (trace > 1) } else if (trace(2))
htrc(" creating key\n" ); htrc(" creating key\n" );
key->value = (char*)malloc(strlen(value) + 1); key->value = (char*)malloc(strlen(value) + 1);
...@@ -1345,7 +1345,7 @@ GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename) ...@@ -1345,7 +1345,7 @@ GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
{ {
DWORD ret = 0; DWORD ret = 0;
if (trace > 1) if (trace(2))
htrc("GPPSN: filename=%s\n", filename); htrc("GPPSN: filename=%s\n", filename);
EnterCriticalSection(&PROFILE_CritSect); EnterCriticalSection(&PROFILE_CritSect);
......
...@@ -363,7 +363,7 @@ bool JAVAConn::GetJVM(PGLOBAL g) ...@@ -363,7 +363,7 @@ bool JAVAConn::GetJVM(PGLOBAL g)
bool JAVAConn::Open(PGLOBAL g) bool JAVAConn::Open(PGLOBAL g)
{ {
bool brc = true, err = false; bool brc = true, err = false;
jboolean jt = (trace > 0); jboolean jt = (trace(1));
// Link or check whether jvm library was linked // Link or check whether jvm library was linked
if (GetJVM(g)) if (GetJVM(g))
...@@ -430,7 +430,7 @@ bool JAVAConn::Open(PGLOBAL g) ...@@ -430,7 +430,7 @@ bool JAVAConn::Open(PGLOBAL g)
jpop->Append(cp); jpop->Append(cp);
} // endif cp } // endif cp
if (trace) { if (trace(1)) {
htrc("ClassPath=%s\n", ClassPath); htrc("ClassPath=%s\n", ClassPath);
htrc("CLASSPATH=%s\n", cp); htrc("CLASSPATH=%s\n", cp);
htrc("%s\n", jpop->GetStr()); htrc("%s\n", jpop->GetStr());
...@@ -486,7 +486,7 @@ bool JAVAConn::Open(PGLOBAL g) ...@@ -486,7 +486,7 @@ bool JAVAConn::Open(PGLOBAL g)
break; break;
} // endswitch rc } // endswitch rc
if (trace) if (trace(1))
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
if (brc) if (brc)
......
This diff is collapsed.
...@@ -29,6 +29,7 @@ class JDBConn : public JAVAConn { ...@@ -29,6 +29,7 @@ class JDBConn : public JAVAConn {
// Attributes // Attributes
public: public:
char *GetQuoteChar(void) { return m_IDQuoteChar; } char *GetQuoteChar(void) { return m_IDQuoteChar; }
bool SetUUID(PGLOBAL g, PTDBJDBC tjp);
virtual int GetMaxValue(int infotype); virtual int GetMaxValue(int infotype);
public: public:
...@@ -58,13 +59,6 @@ class JDBConn : public JAVAConn { ...@@ -58,13 +59,6 @@ class JDBConn : public JAVAConn {
protected: protected:
// Members // 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 xqid; // The ExecuteQuery method ID
jmethodID xuid; // The ExecuteUpdate method ID jmethodID xuid; // The ExecuteUpdate method ID
jmethodID xid; // The Execute method ID jmethodID xid; // The Execute method ID
...@@ -84,8 +78,7 @@ class JDBConn : public JAVAConn { ...@@ -84,8 +78,7 @@ class JDBConn : public JAVAConn {
jmethodID timfldid; // The TimeField method ID jmethodID timfldid; // The TimeField method ID
jmethodID tspfldid; // The TimestampField method ID jmethodID tspfldid; // The TimestampField method ID
jmethodID bigfldid; // The BigintField method ID jmethodID bigfldid; // The BigintField method ID
// PCSZ Msg; jmethodID uidfldid; // The UuidField method ID
// PCSZ m_Wrap;
char m_IDQuoteChar[2]; char m_IDQuoteChar[2];
PCSZ m_Pwd; PCSZ m_Pwd;
int m_Ncol; int m_Ncol;
......
...@@ -298,7 +298,7 @@ int JMGFAM::ReadBuffer(PGLOBAL g) ...@@ -298,7 +298,7 @@ int JMGFAM::ReadBuffer(PGLOBAL g)
PSZ str = Jcp->GetDocument(); PSZ str = Jcp->GetDocument();
if (str) { if (str) {
if (trace == 1) if (trace(1))
htrc("%s\n", str); htrc("%s\n", str);
strncpy(Tdbp->GetLine(), str, Lrecl); strncpy(Tdbp->GetLine(), str, Lrecl);
......
...@@ -254,7 +254,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, ...@@ -254,7 +254,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
all = true; all = true;
if (pipe && Options) { if (pipe && Options) {
if (trace) if (trace(1))
htrc("Pipeline: %s\n", Options); htrc("Pipeline: %s\n", Options);
p = strrchr(Options, ']'); p = strrchr(Options, ']');
...@@ -312,13 +312,13 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, ...@@ -312,13 +312,13 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
*(char*)p = ']'; // Restore Colist for discovery *(char*)p = ']'; // Restore Colist for discovery
p = s->GetStr(); p = s->GetStr();
if (trace) if (trace(33))
htrc("New Pipeline: %s\n", p); htrc("New Pipeline: %s\n", p);
return AggregateCollection(p); return AggregateCollection(p);
} else { } else {
if (filter || filp) { if (filter || filp) {
if (trace) { if (trace(1)) {
if (filter) if (filter)
htrc("Filter: %s\n", filter); htrc("Filter: %s\n", filter);
...@@ -346,7 +346,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, ...@@ -346,7 +346,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
tdbp->SetFilter(NULL); // Not needed anymore tdbp->SetFilter(NULL); // Not needed anymore
} // endif To_Filter } // endif To_Filter
if (trace) if (trace(33))
htrc("selector: %s\n", s->GetStr()); htrc("selector: %s\n", s->GetStr());
s->Resize(s->GetLength() + 1); s->Resize(s->GetLength() + 1);
...@@ -355,7 +355,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, ...@@ -355,7 +355,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
if (!all) { if (!all) {
if (Options && *Options) { if (Options && *Options) {
if (trace) if (trace(1))
htrc("options=%s\n", Options); htrc("options=%s\n", Options);
op = Options; op = Options;
...@@ -751,7 +751,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp) ...@@ -751,7 +751,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp)
jlong ar = env->CallLongMethod(job, updateid, upd); jlong ar = env->CallLongMethod(job, updateid, upd);
if (trace) if (trace(1))
htrc("DocUpdate: ar = %ld\n", ar); htrc("DocUpdate: ar = %ld\n", ar);
if (Check((int)ar)) { if (Check((int)ar)) {
...@@ -770,7 +770,7 @@ int JMgoConn::DocDelete(PGLOBAL g, bool all) ...@@ -770,7 +770,7 @@ int JMgoConn::DocDelete(PGLOBAL g, bool all)
int rc = RC_OK; int rc = RC_OK;
jlong ar = env->CallLongMethod(job, deleteid, all); jlong ar = env->CallLongMethod(job, deleteid, all);
if (trace) if (trace(1))
htrc("DocDelete: ar = %ld\n", ar); htrc("DocDelete: ar = %ld\n", ar);
if (Check((int)ar)) { if (Check((int)ar)) {
......
...@@ -97,7 +97,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma) ...@@ -97,7 +97,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
PJSON jsp = NULL; PJSON jsp = NULL;
STRG src; STRG src;
if (trace) if (trace(1))
htrc("ParseJson: s=%.10s len=%d\n", s, len); htrc("ParseJson: s=%.10s len=%d\n", s, len);
if (!s || !len) { if (!s || !len) {
...@@ -165,7 +165,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma) ...@@ -165,7 +165,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
}; // endswitch s[i] }; // endswitch s[i]
if (!jsp) 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) { else if (ptyp && pretty == 3) {
*ptyp = 3; // Not recognized pretty *ptyp = 3; // Not recognized pretty
...@@ -178,7 +178,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma) ...@@ -178,7 +178,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
} // endif ptyp } // endif ptyp
} catch (int n) { } catch (int n) {
if (trace) if (trace(1))
htrc("Exception %d: %s\n", n, g->Message); htrc("Exception %d: %s\n", n, g->Message);
jsp = NULL; jsp = NULL;
} catch (const char *msg) { } catch (const char *msg) {
...@@ -652,7 +652,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty) ...@@ -652,7 +652,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty)
} // endif's } // endif's
} catch (int n) { } catch (int n) {
if (trace) if (trace(1))
htrc("Exception %d: %s\n", n, g->Message); htrc("Exception %d: %s\n", n, g->Message);
str = NULL; str = NULL;
} catch (const char *msg) { } catch (const char *msg) {
...@@ -1015,6 +1015,20 @@ PJAR JOBJECT::GetKeyList(PGLOBAL g) ...@@ -1015,6 +1015,20 @@ PJAR JOBJECT::GetKeyList(PGLOBAL g)
return jarp; return jarp;
} // end of GetKeyList } // 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. */ /* Get the value corresponding to the given key. */
/***********************************************************************/ /***********************************************************************/
...@@ -1224,6 +1238,7 @@ PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x) ...@@ -1224,6 +1238,7 @@ PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x)
Last->Next = jvp; Last->Next = jvp;
Last = jvp; Last = jvp;
Last->Next = NULL;
} // endif x } // endif x
return jvp; return jvp;
...@@ -1318,6 +1333,24 @@ bool JARRAY::IsNull(void) ...@@ -1318,6 +1333,24 @@ bool JARRAY::IsNull(void)
/* -------------------------- Class JVALUE- -------------------------- */ /* -------------------------- 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. */ /* Constructor for a Value with a given string or numeric value. */
/***********************************************************************/ /***********************************************************************/
......
...@@ -20,7 +20,8 @@ enum JTYP {TYPE_NULL = TYPE_VOID, ...@@ -20,7 +20,8 @@ enum JTYP {TYPE_NULL = TYPE_VOID,
TYPE_BINT = TYPE_BIGINT, TYPE_BINT = TYPE_BIGINT,
TYPE_DTM = TYPE_DATE, TYPE_DTM = TYPE_DATE,
TYPE_INTG = TYPE_INT, TYPE_INTG = TYPE_INT,
TYPE_JSON = 12, TYPE_VAL = 12,
TYPE_JSON,
TYPE_JAR, TYPE_JAR,
TYPE_JOB, TYPE_JOB,
TYPE_JVAL}; TYPE_JVAL};
...@@ -160,6 +161,7 @@ class JSON : public BLOCK { ...@@ -160,6 +161,7 @@ class JSON : public BLOCK {
//virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;} //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 PJPR AddPair(PGLOBAL g, PCSZ key) {X return NULL;}
virtual PJAR GetKeyList(PGLOBAL g) {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 PJVAL GetValue(const char *key) {X return NULL;}
virtual PJOB GetObject(void) {return NULL;} virtual PJOB GetObject(void) {return NULL;}
virtual PJAR GetArray(void) {return NULL;} virtual PJAR GetArray(void) {return NULL;}
...@@ -208,6 +210,7 @@ class JOBJECT : public JSON { ...@@ -208,6 +210,7 @@ class JOBJECT : public JSON {
virtual PJOB GetObject(void) {return this;} virtual PJOB GetObject(void) {return this;}
virtual PJVAL GetValue(const char* key); virtual PJVAL GetValue(const char* key);
virtual PJAR GetKeyList(PGLOBAL g); virtual PJAR GetKeyList(PGLOBAL g);
virtual PJAR GetValList(PGLOBAL g);
virtual PSZ GetText(PGLOBAL g, PSZ text); virtual PSZ GetText(PGLOBAL g, PSZ text);
virtual bool Merge(PGLOBAL g, PJSON jsp); virtual bool Merge(PGLOBAL g, PJSON jsp);
virtual void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key); virtual void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key);
...@@ -261,8 +264,7 @@ class JVALUE : public JSON { ...@@ -261,8 +264,7 @@ class JVALUE : public JSON {
friend bool SerializeValue(JOUT *, PJVAL); friend bool SerializeValue(JOUT *, PJVAL);
public: public:
JVALUE(void) : JSON() {Clear();} JVALUE(void) : JSON() {Clear();}
JVALUE(PJSON jsp) : JSON() JVALUE(PJSON jsp);
{Jsp = jsp; Value = NULL; Next = NULL; Del = false; Size = 1;}
JVALUE(PGLOBAL g, PVAL valp); JVALUE(PGLOBAL g, PVAL valp);
JVALUE(PGLOBAL g, PCSZ strp); JVALUE(PGLOBAL g, PCSZ strp);
......
This diff is collapsed.
...@@ -89,6 +89,10 @@ extern "C" { ...@@ -89,6 +89,10 @@ extern "C" {
DllExport char *json_object_list(UDF_EXEC_ARGS); DllExport char *json_object_list(UDF_EXEC_ARGS);
DllExport void json_object_list_deinit(UDF_INIT*); 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 my_bool jsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport long long jsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, 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) ...@@ -172,7 +172,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info)
goto err; goto err;
skipit: skipit:
if (trace) if (trace(1))
htrc("MGOColumns: n=%d len=%d\n", n, length[0]); 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) ...@@ -276,7 +276,7 @@ int MGODISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt)
tdp->Wrapname = (PSZ)GetStringTableOption(g, topt, "Wrapper", tdp->Wrapname = (PSZ)GetStringTableOption(g, topt, "Wrapper",
(tdp->Version == 2) ? "Mongo2Interface" : "Mongo3Interface"); (tdp->Version == 2) ? "Mongo2Interface" : "Mongo3Interface");
if (trace) if (trace(1))
htrc("Uri %s coll=%s db=%s colist=%s filter=%s lvl=%d\n", 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); tdp->Uri, tdp->Tabname, tdp->Tabschema, tdp->Colist, tdp->Filter, lvl);
......
...@@ -94,9 +94,9 @@ ...@@ -94,9 +94,9 @@
#if defined(XML_SUPPORT) #if defined(XML_SUPPORT)
#include "tabxml.h" #include "tabxml.h"
#endif // XML_SUPPORT #endif // XML_SUPPORT
#if defined(JAVA_SUPPORT) #if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
#include "mongo.h" #include "mongo.h"
#endif // JAVA_SUPPORT #endif // JAVA_SUPPORT || CMGO_SUPPORT
#if defined(ZIP_SUPPORT) #if defined(ZIP_SUPPORT)
#include "tabzip.h" #include "tabzip.h"
#endif // ZIP_SUPPORT #endif // ZIP_SUPPORT
...@@ -109,9 +109,10 @@ ...@@ -109,9 +109,10 @@
extern "C" HINSTANCE s_hModule; // Saved module handle extern "C" HINSTANCE s_hModule; // Saved module handle
#endif // !__WIN__ #endif // !__WIN__
#if defined(JAVA_SUPPORT) #if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
//bool MongoEnabled(void); bool MongoEnabled(void);
#endif // JAVA_SUPPORT #endif // JAVA_SUPPORT || CMGO_SUPPORT
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
/***********************************************************************/ /***********************************************************************/
...@@ -144,7 +145,9 @@ TABTYPE GetTypeID(const char *type) ...@@ -144,7 +145,9 @@ TABTYPE GetTypeID(const char *type)
#endif #endif
#if defined(JAVA_SUPPORT) #if defined(JAVA_SUPPORT)
: (!stricmp(type, "JDBC")) ? TAB_JDBC : (!stricmp(type, "JDBC")) ? TAB_JDBC
: (!stricmp(type, "MONGO")) ? TAB_MONGO #endif
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
: (!stricmp(type, "MONGO") && MongoEnabled()) ? TAB_MONGO
#endif #endif
: (!stricmp(type, "MYSQL")) ? TAB_MYSQL : (!stricmp(type, "MYSQL")) ? TAB_MYSQL
: (!stricmp(type, "MYPRX")) ? TAB_MYSQL : (!stricmp(type, "MYPRX")) ? TAB_MYSQL
...@@ -488,7 +491,7 @@ void MYCAT::Reset(void) ...@@ -488,7 +491,7 @@ void MYCAT::Reset(void)
PRELDEF MYCAT::GetTableDesc(PGLOBAL g, PTABLE tablep, PRELDEF MYCAT::GetTableDesc(PGLOBAL g, PTABLE tablep,
LPCSTR type, PRELDEF *) LPCSTR type, PRELDEF *)
{ {
if (trace) if (trace(1))
printf("GetTableDesc: name=%s am=%s\n", tablep->GetName(), SVP(type)); printf("GetTableDesc: name=%s am=%s\n", tablep->GetName(), SVP(type));
// If not specified get the type of this table // If not specified get the type of this table
...@@ -509,7 +512,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) ...@@ -509,7 +512,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
LPCSTR schema = (PSZ)PlugDup(g, tablep->GetSchema()); LPCSTR schema = (PSZ)PlugDup(g, tablep->GetSchema());
PRELDEF tdp= NULL; PRELDEF tdp= NULL;
if (trace) if (trace(1))
printf("MakeTableDesc: name=%s schema=%s am=%s\n", printf("MakeTableDesc: name=%s schema=%s am=%s\n",
name, SVP(schema), SVP(am)); name, SVP(schema), SVP(am));
...@@ -552,18 +555,17 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) ...@@ -552,18 +555,17 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
case TAB_PIVOT: tdp= new(g) PIVOTDEF; break; case TAB_PIVOT: tdp= new(g) PIVOTDEF; break;
case TAB_VIR: tdp= new(g) VIRDEF; break; case TAB_VIR: tdp= new(g) VIRDEF; break;
case TAB_JSON: tdp= new(g) JSONDEF; break; case TAB_JSON: tdp= new(g) JSONDEF; break;
#if defined(MONGO_SUPPORT)
case TAB_MONGO:
// if (MongoEnabled())
tdp = new(g) MGODEF;
// else
// strcpy(g->Message, "MONGO type not enabled");
break;
#endif // MONGO_SUPPORT
#if defined(ZIP_SUPPORT) #if defined(ZIP_SUPPORT)
case TAB_ZIP: tdp= new(g) ZIPDEF; break; case TAB_ZIP: tdp = new(g) ZIPDEF; break;
#endif // ZIP_SUPPORT #endif // ZIP_SUPPORT
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
case TAB_MONGO:
if (MongoEnabled()) {
tdp = new(g) MGODEF;
break;
} // endif enabled
// fall through
#endif // JAVA_SUPPORT || CMGO_SUPPORT
default: default:
sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name); sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name);
} // endswitch } // endswitch
...@@ -584,14 +586,14 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type) ...@@ -584,14 +586,14 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
PTDB tdbp= NULL; PTDB tdbp= NULL;
// LPCSTR name= tablep->GetName(); // LPCSTR name= tablep->GetName();
if (trace) if (trace(1))
printf("GetTableDB: name=%s\n", tablep->GetName()); printf("GetTableDB: name=%s\n", tablep->GetName());
// Look for the description of the requested table // Look for the description of the requested table
tdp= GetTableDesc(g, tablep, type); tdp= GetTableDesc(g, tablep, type);
if (tdp) { if (tdp) {
if (trace) if (trace(1))
printf("tdb=%p type=%s\n", tdp, tdp->GetType()); printf("tdb=%p type=%s\n", tdp, tdp->GetType());
if (tablep->GetSchema()) if (tablep->GetSchema())
...@@ -601,7 +603,7 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type) ...@@ -601,7 +603,7 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
} // endif tdp } // endif tdp
if (tdbp) { if (tdbp) {
if (trace) if (trace(1))
printf("tdbp=%p name=%s amtype=%d\n", tdbp, tdbp->GetName(), printf("tdbp=%p name=%s amtype=%d\n", tdbp, tdbp->GetName(),
tdbp->GetAmType()); tdbp->GetAmType());
tablep->SetTo_Tdb(tdbp); tablep->SetTo_Tdb(tdbp);
......
...@@ -177,7 +177,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, ...@@ -177,7 +177,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
return NULL; return NULL;
} // endif b } // endif b
if (trace) if (trace(1))
htrc("MyColumns: cmd='%s'\n", cmd.GetStr()); htrc("MyColumns: cmd='%s'\n", cmd.GetStr());
if ((n = myc.GetResultSize(g, cmd.GetStr())) < 0) { if ((n = myc.GetResultSize(g, cmd.GetStr())) < 0) {
...@@ -482,7 +482,7 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db, ...@@ -482,7 +482,7 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db,
return RC_FX; return RC_FX;
} // endif m_DB } // endif m_DB
if (trace) if (trace(1))
htrc("MYSQLC Open: m_DB=%.4X size=%d\n", m_DB, (int)sizeof(*m_DB)); htrc("MYSQLC Open: m_DB=%.4X size=%d\n", m_DB, (int)sizeof(*m_DB));
// Removed to do like FEDERATED do // Removed to do like FEDERATED do
...@@ -744,7 +744,7 @@ int MYSQLC::ExecSQL(PGLOBAL g, const char *query, int *w) ...@@ -744,7 +744,7 @@ int MYSQLC::ExecSQL(PGLOBAL g, const char *query, int *w)
m_Fields = mysql_num_fields(m_Res); m_Fields = mysql_num_fields(m_Res);
m_Rows = (!m_Use) ? (int)mysql_num_rows(m_Res) : 0; 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", htrc("ExecSQL: m_Res=%.4X size=%d m_Fields=%d m_Rows=%d\n",
m_Res, sizeof(*m_Res), m_Fields, m_Rows); m_Res, sizeof(*m_Res), m_Fields, m_Rows);
...@@ -1068,7 +1068,7 @@ void MYSQLC::Close(void) ...@@ -1068,7 +1068,7 @@ void MYSQLC::Close(void)
{ {
FreeResult(); FreeResult();
if (trace) if (trace(1))
htrc("MYSQLC Close: m_DB=%.4X\n", m_DB); htrc("MYSQLC Close: m_DB=%.4X\n", m_DB);
mysql_close(m_DB); mysql_close(m_DB);
......
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar';
CREATE TABLE t2 ( CREATE TABLE t2 (
command varchar(128) not null, command varchar(128) not null,
number int(5) not null flag=1, number int(5) not null flag=1,
message varchar(255) flag=2) message varchar(255) flag=2)
ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:postgresql://localhost/mtr' ENGINE=CONNECT TABLE_TYPE=JDBC
OPTION_LIST='User=mtr,Password=mtr,Schema=public,Execsrc=1'; CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
OPTION_LIST='Execsrc=1';
SELECT * FROM t2 WHERE command='drop table employee'; SELECT * FROM t2 WHERE command='drop table employee';
command number message command number message
drop table employee 0 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas drop table employee 0 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas
...@@ -14,17 +16,18 @@ SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'E ...@@ -14,17 +16,18 @@ SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'E
command number message command number message
insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
CONNECTION='jdbc:postgresql://localhost/mtr' CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
OPTION_LIST='User=mtr,Password=mtr,Schema=public,Tabtype=TABLE,Maxres=10'; OPTION_LIST='Tabtype=TABLE,Maxres=10';
SELECT * FROM t1; SELECT * FROM t1;
Table_Cat Table_Schema Table_Name Table_Type Remark Table_Cat Table_Schema Table_Name Table_Type Remark
public employee TABLE NULL NULL public employee TABLE NULL
public t1 TABLE NULL NULL public t1 TABLE NULL
public t2 TABLE NULL NULL public t2 TABLE NULL
NULL public tchar TABLE NULL
NULL public testuuid TABLE NULL
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=columns CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC tabname=employee CATFUNC=columns
CONNECTION='jdbc:postgresql://localhost/mtr' tabname=employee CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono';
OPTION_LIST='User=mtr,Password=mtr,Maxres=10';
SELECT * FROM t1; SELECT * FROM t1;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
NULL public employee id 4 int4 10 0 0 10 0 NULL NULL public employee id 4 int4 10 0 0 10 0 NULL
...@@ -34,13 +37,14 @@ NULL public employee salary 2 numeric 8 0 2 10 1 NULL ...@@ -34,13 +37,14 @@ NULL public employee salary 2 numeric 8 0 2 10 1 NULL
DROP TABLE t1; DROP TABLE t1;
CREATE SERVER 'postgresql' FOREIGN DATA WRAPPER 'postgresql' OPTIONS ( CREATE SERVER 'postgresql' FOREIGN DATA WRAPPER 'postgresql' OPTIONS (
HOST 'localhost', HOST 'localhost',
DATABASE 'mtr', DATABASE 'test',
USER 'mtr', USER 'postgres',
PASSWORD 'mtr', PASSWORD 'tinono',
PORT 0, PORT 0,
SOCKET '', SOCKET '',
OWNER 'root'); OWNER 'root');
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='postgresql/public.employee'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='postgresql/public.employee';
SELECT * FROM t1; SELECT * FROM t1;
id name title salary id name title salary
4567 Johnson Engineer 12560.50 4567 Johnson Engineer 12560.50
...@@ -60,6 +64,3 @@ SELECT * FROM t2 WHERE command='drop table employee'; ...@@ -60,6 +64,3 @@ SELECT * FROM t2 WHERE command='drop table employee';
command number message command number message
drop table employee 0 Affected rows drop table employee 0 Affected rows
DROP TABLE t2; DROP TABLE t2;
SET GLOBAL connect_jvm_path=NULL;
SET GLOBAL connect_class_path=NULL;
SET GLOBAL time_zone = SYSTEM;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar'; 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 # Test the MONGO table type
# #
...@@ -381,3 +382,4 @@ planner 167 41.75 ...@@ -381,3 +382,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true 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 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 # Test the MONGO table type
# #
...@@ -381,3 +382,4 @@ planner 167 41.75 ...@@ -381,3 +382,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
set connect_enable_mongo=1;
# #
# Test the MONGO table type # Test the MONGO table type
# #
...@@ -380,3 +381,4 @@ planner 167 41.75 ...@@ -380,3 +381,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
...@@ -50,17 +50,19 @@ SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL), 'One more') Arra ...@@ -50,17 +50,19 @@ SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL), 'One more') Arra
Array Array
[56,3.141600,"foo",null,"One more"] [56,3.141600,"foo",null,"One more"]
SELECT Json_Array_Add(JsonValue('one value'), 'One more'); SELECT Json_Array_Add(JsonValue('one value'), 'One more');
ERROR HY000: Can't initialize function 'json_array_add'; First argument must be a json item Json_Array_Add(JsonValue('one value'), 'One more')
["\"one value\"","One more"]
SELECT Json_Array_Add('one value', 'One more'); SELECT Json_Array_Add('one value', 'One more');
ERROR HY000: Can't initialize function 'json_array_add'; First argument must be a json item Json_Array_Add('one value', 'One more')
["one value","One more"]
SELECT Json_Array_Add('one value' json_, 'One more'); SELECT Json_Array_Add('one value' json_, 'One more');
Json_Array_Add('one value' json_, 'One more') Json_Array_Add('one value' json_, 'One more')
one value one value
Warnings: Warnings:
Warning 1105 Error 2 opening one value Warning 1105 Error 2 opening one value
Warning 1105 First argument target is not an array
SELECT Json_Array_Add(5 json_, 'One more'); SELECT Json_Array_Add(5 json_, 'One more');
ERROR HY000: Can't initialize function 'json_array_add'; First argument must be a json item Json_Array_Add(5 json_, 'One more')
[5,"One more"]
SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 0); SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 0);
Json_Array_Add('[5,3,8,7,9]' json_, 4, 0) Json_Array_Add('[5,3,8,7,9]' json_, 4, 0)
[4,5,3,8,7,9] [4,5,3,8,7,9]
......
...@@ -272,10 +272,9 @@ Json_Serialize(Jbin_Array('a','b','c')) ...@@ -272,10 +272,9 @@ Json_Serialize(Jbin_Array('a','b','c'))
["a","b","c"] ["a","b","c"]
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd')); SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd'));
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: Warnings:
Warning 1105 Open(map) error 2 on not_exist.json Warning 1105 Open(map) error 2 on not_exist.json
Warning 1105 First argument is not an array
# This does not modify the file # This does not modify the file
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd')); SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'));
Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd')) Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'))
......
set connect_enable_mongo=1;
# #
# Test the MONGO table type # Test the MONGO table type
# #
...@@ -376,3 +377,4 @@ planner 167 41.750000 ...@@ -376,3 +377,4 @@ planner 167 41.750000
postcard 23 5.750000 postcard 23 5.750000
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar'; 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 # Test the MONGO table type
# #
...@@ -377,3 +378,4 @@ planner 167 41.75 ...@@ -377,3 +378,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true 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 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 # Test the MONGO table type
# #
...@@ -377,3 +378,4 @@ planner 167 41.75 ...@@ -377,3 +378,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
...@@ -87,7 +87,7 @@ a b ...@@ -87,7 +87,7 @@ a b
CREATE TABLE total (a int, b char(10)) CREATE TABLE total (a int, b char(10))
ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5' ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5'
OPTION_LIST='thread=yes,port=PORT'; OPTION_LIST='thread=yes,port=PORT';
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by a desc; SELECT * FROM total order by a desc;
a b a b
19 test19 19 test19
...@@ -129,7 +129,7 @@ SELECT * FROM t2; ...@@ -129,7 +129,7 @@ SELECT * FROM t2;
v v
22 22
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';; CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by v desc; SELECT * FROM total order by v desc;
v v
22 22
...@@ -148,7 +148,7 @@ SELECT * FROM t2; ...@@ -148,7 +148,7 @@ SELECT * FROM t2;
v v
22 22
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';; CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by v desc; SELECT * FROM total order by v desc;
v v
22 22
......
...@@ -6,7 +6,7 @@ birth date not null date_format='DD/MM/YYYY', ...@@ -6,7 +6,7 @@ birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36, hired date not null date_format='DD/MM/YYYY' flag=36,
agehired int(3) as (floor(datediff(hired,birth)/365.25)) agehired int(3) as (floor(datediff(hired,birth)/365.25))
) )
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47; engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
select * from t1; select * from t1;
name city birth hired agehired name city birth hired agehired
John Boston 1986-01-25 2010-06-02 24 John Boston 1986-01-25 2010-06-02 24
...@@ -25,5 +25,5 @@ hired date not null date_format='DD/MM/YYYY' flag=36, ...@@ -25,5 +25,5 @@ hired date not null date_format='DD/MM/YYYY' flag=36,
agehired int(3) as (floor(datediff(hired,birth)/365.25)), agehired int(3) as (floor(datediff(hired,birth)/365.25)),
index (agehired) index (agehired)
) )
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47; engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
ERROR 42000: Table handler doesn't support NULL in given index. Please change column 'agehired' to be NOT NULL or use another handler ERROR 42000: Table handler doesn't support NULL in given index. Please change column 'agehired' to be NOT NULL or use another handler
This diff was suppressed by a .gitattributes entry.
...@@ -3,25 +3,32 @@ ...@@ -3,25 +3,32 @@
# #
# This test is run against Postgresql driver # This test is run against Postgresql driver
# #
eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar';
CREATE TABLE t2 ( CREATE TABLE t2 (
command varchar(128) not null, command varchar(128) not null,
number int(5) not null flag=1, number int(5) not null flag=1,
message varchar(255) flag=2) message varchar(255) flag=2)
ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:postgresql://localhost/mtr' ENGINE=CONNECT TABLE_TYPE=JDBC
OPTION_LIST='User=mtr,Password=mtr,Schema=public,Execsrc=1'; CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
OPTION_LIST='Execsrc=1';
#CONNECTION='jdbc:postgresql://localhost/mtr'
#OPTION_LIST='User=mtr,Password=mtr,Schema=public,Execsrc=1';
SELECT * FROM t2 WHERE command='drop table employee'; SELECT * FROM t2 WHERE command='drop table employee';
SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2))'; SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2))';
SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)"; SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)";
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
CONNECTION='jdbc:postgresql://localhost/mtr' CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
OPTION_LIST='User=mtr,Password=mtr,Schema=public,Tabtype=TABLE,Maxres=10'; OPTION_LIST='Tabtype=TABLE,Maxres=10';
#CONNECTION='jdbc:postgresql://localhost/mtr'
#OPTION_LIST='User=mtr,Password=mtr,Schema=public,Tabtype=TABLE,Maxres=10';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=columns CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC tabname=employee CATFUNC=columns
CONNECTION='jdbc:postgresql://localhost/mtr' tabname=employee CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono';
OPTION_LIST='User=mtr,Password=mtr,Maxres=10'; #CONNECTION='jdbc:postgresql://localhost/mtr' tabname=employee;
#OPTION_LIST='User=mtr,Password=mtr,Maxres=10';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -30,14 +37,18 @@ DROP TABLE t1; ...@@ -30,14 +37,18 @@ DROP TABLE t1;
# #
CREATE SERVER 'postgresql' FOREIGN DATA WRAPPER 'postgresql' OPTIONS ( CREATE SERVER 'postgresql' FOREIGN DATA WRAPPER 'postgresql' OPTIONS (
HOST 'localhost', HOST 'localhost',
DATABASE 'mtr', DATABASE 'test',
USER 'mtr', USER 'postgres',
PASSWORD 'mtr', PASSWORD 'tinono',
PORT 0, PORT 0,
SOCKET '', SOCKET '',
OWNER 'root'); OWNER 'root');
#DATABASE 'mtr',
#USER 'mtr',
#PASSWORD 'mtr',
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='postgresql/public.employee'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='postgresql/public.employee';
SELECT * FROM t1; SELECT * FROM t1;
INSERT INTO t1 VALUES(3126,'Smith', 'Clerk', 5230.00); INSERT INTO t1 VALUES(3126,'Smith', 'Clerk', 5230.00);
UPDATE t1 SET salary = salary + 100.00; UPDATE t1 SET salary = salary + 100.00;
......
...@@ -22,10 +22,11 @@ DROP TABLE t1; ...@@ -22,10 +22,11 @@ DROP TABLE t1;
# 1 - The current directory. # 1 - The current directory.
# 2 - The paths of the connect_class_path global variable. # 2 - The paths of the connect_class_path global variable.
# 3 - The paths of the CLASSPATH environment variable. # 3 - The paths of the CLASSPATH environment variable.
# In this test we use an executable jar file that contains all what is needed. # In this test we use an executable jar file that contains all the eisting wrappers.
eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/JdbcMariaDB.jar'; #eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/JdbcMariaDB.jar';
eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/JavaWrappers.jar';
# Paths to the JDK classes and to the MySQL and MariaDB drivers can be defined in the CLASSPATH environment variable # Paths to the JDK classes and to the JDBC drivers should be defined in the CLASSPATH environment variable
#CREATE FUNCTION envar RETURNS STRING SONAME 'ha_connect.dll'; #CREATE FUNCTION envar RETURNS STRING SONAME 'ha_connect.dll';
#SELECT envar('CLASSPATH'); #SELECT envar('CLASSPATH');
......
...@@ -29,12 +29,12 @@ SELECT Json_Make_Array(Json_Make_Array(56, 3.1416, 'foo'), TRUE); ...@@ -29,12 +29,12 @@ SELECT Json_Make_Array(Json_Make_Array(56, 3.1416, 'foo'), TRUE);
--error ER_CANT_INITIALIZE_UDF --error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL)) Array; SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL)) Array;
SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL), 'One more') Array; SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL), 'One more') Array;
--error ER_CANT_INITIALIZE_UDF #--error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add(JsonValue('one value'), 'One more'); SELECT Json_Array_Add(JsonValue('one value'), 'One more');
--error ER_CANT_INITIALIZE_UDF #--error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add('one value', 'One more'); SELECT Json_Array_Add('one value', 'One more');
SELECT Json_Array_Add('one value' json_, 'One more'); SELECT Json_Array_Add('one value' json_, 'One more');
--error ER_CANT_INITIALIZE_UDF #--error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add(5 json_, 'One more'); SELECT Json_Array_Add(5 json_, 'One more');
SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 0); SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 0);
SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 2) Array; SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 2) Array;
......
let $MONGO= C:/PROGRA~1/MongoDB/Server/3.4/bin/mongo; let $MONGO= C:/Applic/MongoDB/Server/3.6/bin/mongo;
let $MONGOIMPORT= C:/PROGRA~1/MongoDB/Server/3.4/bin/mongoimport; let $MONGOIMPORT= C:/Applic/MongoDB/Server/3.6/bin/mongoimport;
#set connect_enable_mongo=1; set connect_enable_mongo=1;
--echo # --echo #
--echo # Test the MONGO table type --echo # Test the MONGO table type
...@@ -130,7 +130,9 @@ DROP TABLE t1; ...@@ -130,7 +130,9 @@ DROP TABLE t1;
--echo # --echo #
--echo # try CRUD operations --echo # try CRUD operations
--echo # --echo #
--disable_query_log
--exec $MONGO --eval "db.testcoll.drop()" --quiet --exec $MONGO --eval "db.testcoll.drop()" --quiet
--enable_query_log
eval CREATE TABLE t1 (_id INT(4) NOT NULL, msg CHAR(64)) eval CREATE TABLE t1 (_id INT(4) NOT NULL, msg CHAR(64))
ENGINE=CONNECT TABLE_TYPE=$TYPE TABNAME='testcoll' ENGINE=CONNECT TABLE_TYPE=$TYPE TABNAME='testcoll'
OPTION_LIST='Driver=$DRV,Version=$VERS' $CONN; OPTION_LIST='Driver=$DRV,Version=$VERS' $CONN;
...@@ -147,7 +149,9 @@ DROP TABLE t1; ...@@ -147,7 +149,9 @@ DROP TABLE t1;
--echo # --echo #
--echo # List states whose population is equal or more than 10 millions --echo # List states whose population is equal or more than 10 millions
--echo # --echo #
--disable_query_log
--exec $MONGO --eval "db.cities.drop()" --quiet --exec $MONGO --eval "db.cities.drop()" --quiet
--enable_query_log
--exec $MONGOIMPORT --quiet $MTR_SUITE_DIR/std_data/cities.json --exec $MONGOIMPORT --quiet $MTR_SUITE_DIR/std_data/cities.json
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
_id char(5) NOT NULL, _id char(5) NOT NULL,
...@@ -204,4 +208,4 @@ SELECT * FROM t1; ...@@ -204,4 +208,4 @@ SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--exec $MONGO --eval "db.testcoll.drop()" --quiet --exec $MONGO --eval "db.testcoll.drop()" --quiet
#set connect_enable_mongo=0; set connect_enable_mongo=0;
...@@ -56,7 +56,7 @@ SELECT * FROM t5; ...@@ -56,7 +56,7 @@ SELECT * FROM t5;
eval CREATE TABLE total (a int, b char(10)) eval CREATE TABLE total (a int, b char(10))
ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5' ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5'
OPTION_LIST='thread=yes,port=$PORT'; OPTION_LIST='thread=yes,port=$PORT';
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by a desc; SELECT * FROM total order by a desc;
set connect_xtrace=0; set connect_xtrace=0;
...@@ -85,7 +85,7 @@ SELECT * FROM t2; ...@@ -85,7 +85,7 @@ SELECT * FROM t2;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT'; --eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by v desc; SELECT * FROM total order by v desc;
set connect_xtrace=0; set connect_xtrace=0;
DROP TABLE t1,t2,total; DROP TABLE t1,t2,total;
...@@ -101,7 +101,7 @@ SELECT * FROM t2; ...@@ -101,7 +101,7 @@ SELECT * FROM t2;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT'; --eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by v desc; SELECT * FROM total order by v desc;
set connect_xtrace=0; set connect_xtrace=0;
......
...@@ -9,7 +9,7 @@ create table t1 ( ...@@ -9,7 +9,7 @@ create table t1 (
hired date not null date_format='DD/MM/YYYY' flag=36, hired date not null date_format='DD/MM/YYYY' flag=36,
agehired int(3) as (floor(datediff(hired,birth)/365.25)) agehired int(3) as (floor(datediff(hired,birth)/365.25))
) )
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47; engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
select * from t1; select * from t1;
drop table t1; drop table t1;
...@@ -23,4 +23,9 @@ create table t1 ( ...@@ -23,4 +23,9 @@ create table t1 (
agehired int(3) as (floor(datediff(hired,birth)/365.25)), agehired int(3) as (floor(datediff(hired,birth)/365.25)),
index (agehired) index (agehired)
) )
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47; engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
#
# Clean up
#
--remove_file $datadir/test/boys.txt
This diff is collapsed.
...@@ -362,7 +362,8 @@ enum COLUSE {U_P = 0x01, /* the projection list. */ ...@@ -362,7 +362,8 @@ enum COLUSE {U_P = 0x01, /* the projection list. */
U_IS_NULL = 0x80, /* The column has a null value */ U_IS_NULL = 0x80, /* The column has a null value */
U_SPECIAL = 0x100, /* The column is special */ U_SPECIAL = 0x100, /* The column is special */
U_UNSIGNED = 0x200, /* The column type is unsigned */ U_UNSIGNED = 0x200, /* The column type is unsigned */
U_ZEROFILL = 0x400}; /* The column is zero filled */ U_ZEROFILL = 0x400, /* The column is zero filled */
U_UUID = 0x800}; /* The column is a UUID */
/***********************************************************************/ /***********************************************************************/
/* DB description class and block pointer definitions. */ /* DB description class and block pointer definitions. */
......
This diff is collapsed.
This diff is collapsed.
...@@ -450,7 +450,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g) ...@@ -450,7 +450,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g)
} // endswitch tc } // endswitch tc
// lrecl must be at least recln to avoid buffer overflow // lrecl must be at least recln to avoid buffer overflow
if (trace) if (trace(1))
htrc("Lrecl: Calculated=%d defined=%d\n", htrc("Lrecl: Calculated=%d defined=%d\n",
recln, Hc->GetIntegerOption("Lrecl")); recln, Hc->GetIntegerOption("Lrecl"));
......
This diff is collapsed.
This diff is collapsed.
...@@ -29,6 +29,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ ...@@ -29,6 +29,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
friend class TXTFAM; friend class TXTFAM;
friend class DBFBASE; friend class DBFBASE;
friend class UNZIPUTL; friend class UNZIPUTL;
friend class JSONCOL;
public: public:
// Constructor // Constructor
DOSDEF(void); DOSDEF(void);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -101,6 +101,7 @@ class TDBJDBC : public TDBEXT { ...@@ -101,6 +101,7 @@ class TDBJDBC : public TDBEXT {
/***********************************************************************/ /***********************************************************************/
class JDBCCOL : public EXTCOL { class JDBCCOL : public EXTCOL {
friend class TDBJDBC; friend class TDBJDBC;
friend class JDBConn;
public: public:
// Constructors // Constructors
JDBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "JDBC"); JDBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "JDBC");
...@@ -119,6 +120,7 @@ class JDBCCOL : public EXTCOL { ...@@ -119,6 +120,7 @@ class JDBCCOL : public EXTCOL {
JDBCCOL(void); JDBCCOL(void);
// Members // Members
bool uuid; // For PostgreSQL
}; // end of class JDBCCOL }; // end of class JDBCCOL
/***********************************************************************/ /***********************************************************************/
......
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