Skip to content
Permalink
Browse files
Merge remote-tracking branch 'connect/10.2' into 10.2
  • Loading branch information
cvicentiu committed Mar 18, 2018
2 parents 6d1d5c3 + f9cf2df commit a0f9cbc
Show file tree
Hide file tree
Showing 85 changed files with 2,304 additions and 1,582 deletions.
@@ -326,6 +326,30 @@ IF(NOT TARGET connect)
RETURN()
ENDIF()

IF(WIN32)
IF (libmongoc-1.0_FOUND)
SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS
"/DELAYLOAD:libbson-1.0.dll /DELAYLOAD:libmongoc-1.0.dll")
ENDIF(libmongoc-1.0_FOUND)
ENDIF(WIN32)

# Install some extra files that belong to connect engine
IF(WIN32)
# install ha_connect.lib
GET_TARGET_PROPERTY(CONNECT_LOCATION connect LOCATION)
STRING(REPLACE "dll" "lib" CONNECT_LIB ${CONNECT_LOCATION})
IF(CMAKE_CONFIGURATION_TYPES)
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
CONNECT_LIB ${CONNECT_LIB})
ENDIF()
INSTALL(FILES ${CONNECT_LIB}
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
ENDIF(WIN32)

IF(NOT TARGET connect)
RETURN()
ENDIF()

# Install some extra files that belong to connect engine
IF(WIN32)
# install ha_connect.lib
@@ -1,9 +1,13 @@

package wrappers;

import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;

public class Client {
static boolean DEBUG = true;
@@ -58,6 +62,9 @@ public static void main(String[] args) {
String query;
System.out.println("Successfully connected to " + parms[1]);

s = jdi.GetQuoteString();
System.out.println("Qstr = '" + s + "'");

while ((query = getLine("Query: ", false)) != null) {
n = jdi.Execute(query);
System.out.println("Returned n = " + n);
@@ -79,7 +86,11 @@ public static void main(String[] args) {
private static void PrintResult(int ncol) {
// Get result set meta data
int i;
Date date = new Date(0);
Time time = new Time(0);
Timestamp tsp = new Timestamp(0);
String columnName;
Object job;

// Get the column names; column indices start from 1
for (i = 1; i <= ncol; i++) {
@@ -112,6 +123,7 @@ private static void PrintResult(int ncol) {
case java.sql.Types.VARCHAR:
case java.sql.Types.LONGVARCHAR:
case java.sql.Types.CHAR:
case 1111:
System.out.print(jdi.StringField(i, null));
break;
case java.sql.Types.INTEGER:
@@ -120,14 +132,17 @@ private static void PrintResult(int ncol) {
case java.sql.Types.BIGINT:
System.out.print(jdi.BigintField(i, null));
break;
case java.sql.Types.TIMESTAMP:
System.out.print(jdi.TimestampField(i, null));
break;
case java.sql.Types.TIME:
System.out.print(jdi.TimeField(i, null));
time.setTime((long)jdi.TimeField(i, null) * 1000);
System.out.print(time);
break;
case java.sql.Types.DATE:
System.out.print(jdi.DateField(i, null));
date.setTime((long)jdi.DateField(i, null) * 1000);
System.out.print(date);
break;
case java.sql.Types.TIMESTAMP:
tsp.setTime((long)jdi.TimestampField(i, null) * 1000);
System.out.print(tsp);
break;
case java.sql.Types.SMALLINT:
System.out.print(jdi.IntField(i, null));
@@ -141,6 +156,8 @@ private static void PrintResult(int ncol) {
case java.sql.Types.BOOLEAN:
System.out.print(jdi.BooleanField(i, null));
default:
job = jdi.ObjectField(i, null);
System.out.print(job.toString());
break;
} // endswitch Type

Binary file not shown.
@@ -1,10 +1,22 @@
package wrappers;

import java.math.*;
import java.sql.*;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Date;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;
import java.util.UUID;

import javax.sql.DataSource;

@@ -223,6 +235,24 @@ public void SetTimestampParm(int i, Timestamp t) {

} // end of SetTimestampParm

public void SetUuidParm(int i, String s) {
try {
UUID uuid;

if (s == null)
uuid = null;
else if (s.isEmpty())
uuid = UUID.randomUUID();
else
uuid = UUID.fromString(s);

pstmt.setObject(i, uuid);
} catch (Exception e) {
SetErrmsg(e);
} // end try/catch

} // end of SetUuidParm

public int SetNullParm(int i, int typ) {
int rc = 0;

@@ -481,6 +511,8 @@ public int ExecuteQuery(String query) {
System.out.println("Executing query '" + query + "'");

try {
if (rs != null)
rs.close();
rs = stmt.executeQuery(query);
rsmd = rs.getMetaData();
ncol = rsmd.getColumnCount();
@@ -708,7 +740,7 @@ public int TimestampField(int n, String name) {
return 0;
} // end of TimestampField

public Object ObjectField(int n, String name) {
public Object ObjectField(int n, String name) {
if (rs == null) {
System.out.println("No result set");
} else try {
@@ -720,6 +752,22 @@ public Object ObjectField(int n, String name) {
return null;
} // end of ObjectField

public String UuidField(int n, String name) {
Object job;

if (rs == null) {
System.out.println("No result set");
} else
try {
job = (n > 0) ? rs.getObject(n) : rs.getObject(name);
return job.toString();
} catch (SQLException se) {
SetErrmsg(se);
} // end try/catch

return null;
} // end of UuidField

public int GetDrivers(String[] s, int mxs) {
int n = 0;
List<Driver> drivers = Collections.list(DriverManager.getDrivers());
@@ -1,9 +1,10 @@
package wrappers;

import java.sql.*;
import java.sql.SQLException;
import java.util.Hashtable;

import javax.sql.DataSource;

import org.postgresql.jdbc2.optional.PoolingDataSource;

public class PostgresqlInterface extends JdbcInterface {
@@ -19,7 +20,7 @@ public PostgresqlInterface(boolean b) {

} // end of constructor

@Override
@Override
public int JdbcConnect(String[] parms, int fsize, boolean scrollable) {
int rc = 0;
String url = parms[1];
@@ -82,7 +82,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp)
if ((valtyp = pp->Type) != TYPE_STRING)
len = 1;

if (trace)
if (trace(1))
htrc("valtyp=%d len=%d\n", valtyp, len);

/*********************************************************************/
@@ -287,7 +287,7 @@ bool ARRAY::AddValue(PGLOBAL g, PSZ strp)
return true;
} // endif Type

if (trace)
if (trace(1))
htrc(" adding string(%d): '%s'\n", Nval, strp);

//Value->SetValue_psz(strp);
@@ -306,7 +306,7 @@ bool ARRAY::AddValue(PGLOBAL g, void *p)
return true;
} // endif Type

if (trace)
if (trace(1))
htrc(" adding pointer(%d): %p\n", Nval, p);

Vblp->SetValue((PSZ)p, Nval++);
@@ -323,7 +323,7 @@ bool ARRAY::AddValue(PGLOBAL g, short n)
return true;
} // endif Type

if (trace)
if (trace(1))
htrc(" adding SHORT(%d): %hd\n", Nval, n);

//Value->SetValue(n);
@@ -342,7 +342,7 @@ bool ARRAY::AddValue(PGLOBAL g, int n)
return true;
} // endif Type

if (trace)
if (trace(1))
htrc(" adding int(%d): %d\n", Nval, n);

//Value->SetValue(n);
@@ -361,7 +361,7 @@ bool ARRAY::AddValue(PGLOBAL g, double d)
return true;
} // endif Type

if (trace)
if (trace(1))
htrc(" adding float(%d): %lf\n", Nval, d);

Value->SetValue(d);
@@ -380,7 +380,7 @@ bool ARRAY::AddValue(PGLOBAL g, PXOB xp)
return true;
} // endif Type

if (trace)
if (trace(1))
htrc(" adding (%d) from xp=%p\n", Nval, xp);

//AddValue(xp->GetValue());
@@ -399,7 +399,7 @@ bool ARRAY::AddValue(PGLOBAL g, PVAL vp)
return true;
} // endif Type

if (trace)
if (trace(1))
htrc(" adding (%d) from vp=%p\n", Nval, vp);

Vblp->SetValue(vp, Nval++);
@@ -990,7 +990,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
len += strlen(tp);
} // enfor i

if (trace)
if (trace(1))
htrc("Arraylist: len=%d\n", len);

p = (char *)PlugSubAlloc(g, NULL, len);
@@ -1003,7 +1003,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
strcat(p, (++i == Nval) ? ")" : ",");
} // enfor i

if (trace)
if (trace(1))
htrc("Arraylist: newlen=%d\n", strlen(p));

return p;
@@ -241,7 +241,7 @@ int BLKFILARI::BlockEval(PGLOBAL)
break;
} // endswitch Opc

if (trace)
if (trace(1))
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);

return Result;
@@ -338,7 +338,7 @@ int BLKFILAR2::BlockEval(PGLOBAL)
break;
} // endswitch Opc

if (trace)
if (trace(1))
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);

return Result;
@@ -474,7 +474,7 @@ int BLKFILMR2::BlockEval(PGLOBAL)
break;
} // endswitch Opc

if (trace)
if (trace(1))
htrc("BlockEval2: op=%d n=%d rc=%d\n", Opc, n, Result);

return Result;
@@ -567,7 +567,7 @@ int BLKSPCARI::BlockEval(PGLOBAL)
break;
} // endswitch Opc

if (trace)
if (trace(1))
htrc("BlockEval: op=%d n=%d rc=%d\n", Opc, n, Result);

return Result;
@@ -38,8 +38,8 @@ typedef class BLOCK *PBLOCK;
class DllExport BLOCK {
public:
void * operator new(size_t size, PGLOBAL g, void *p = NULL) {
// if (trace > 3)
// htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);
if (trace(256))
htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);

return (PlugSubAlloc(g, p, size));
} // end of new
@@ -45,6 +45,7 @@ enum USETEMP {TMP_NO = 0, /* Never */
/***********************************************************************/
enum TYPCONV {TPC_NO = 0, /* Never */
TPC_YES = 1, /* Always */
TPC_SKIP = 2}; /* Skip TEXT columns */
TPC_FORCE = 2, /* Also convert BLOBs */
TPC_SKIP = 3}; /* Skip TEXT columns */

#endif // _CHKLVL_DEFINED_

0 comments on commit a0f9cbc

Please sign in to comment.