Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fxjs/db-driver

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fxjs/db-driver - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

15

lib/built-ins/driver-postgresql.js

@@ -6,2 +6,3 @@ /// <reference types="fib-pool" />

const utils_1 = require("../utils");
const win32CpInfo = utils_1.detectWindowsCodePoints();
class PostgreSQLDriver extends base_class_1.SQLDriver {

@@ -23,3 +24,15 @@ constructor(conn) {

}
open() { return super.open(); }
open() {
if (!win32CpInfo.codepoints)
return super.open();
const conn = super.open();
// TODO: support common codepoints -> postgresql-encoding
if (conn.codec && win32CpInfo.codepoints === '936') {
conn.codec = 'GBK';
}
else if (conn.codec === 'utf8' && win32CpInfo.codepoints !== '65001') {
console.error(`system default code points is '${win32CpInfo.codepoints}', but odbc try to use codec UTF8 with codepoints 65001, refer to https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers to set connection.codec as UTF8`);
}
return conn;
}
close() {

@@ -26,0 +39,0 @@ if (this.connection)

/// <reference types="@fibjs/types" />
Object.defineProperty(exports, "__esModule", { value: true });
exports.logDebugSQL = exports.arraify = exports.mountPoolToDriver = exports.parsePoolConfig = exports.parseConnectionString = exports.ensureSuffix = exports.castQueryStringToBoolean = exports.forceInteger = exports.filterDriverType = exports.driverUUid = void 0;
exports.detectWindowsCodePoints = exports.logDebugSQL = exports.arraify = exports.mountPoolToDriver = exports.parsePoolConfig = exports.parseConnectionString = exports.ensureSuffix = exports.castQueryStringToBoolean = exports.forceInteger = exports.filterDriverType = exports.driverUUid = void 0;
const url = require("url");

@@ -9,2 +9,4 @@ const util = require("util");

const uuid = require("uuid");
const io = require("io");
const child_process = require("child_process");
const ParseQSDotKey = require("parse-querystring-dotkey");

@@ -182,1 +184,21 @@ const FibPool = require("fib-pool");

;
function detectWindowsCodePoints() {
let codepoints = '';
const isWindows = process.platform === 'win32';
if (isWindows) {
try {
const p = child_process.spawn('cmd', "/c chcp".split(' '));
const stdout = new io.BufferedStream(p.stdout);
const output = stdout.readLines().join(' ');
const matches = output.match(/\d+/g);
codepoints = matches === null || matches === void 0 ? void 0 : matches[0];
}
catch (error) {
}
}
return {
isWindows,
codepoints
};
}
exports.detectWindowsCodePoints = detectWindowsCodePoints;

4

package.json
{
"name": "@fxjs/db-driver",
"version": "0.4.1",
"version": "0.4.2",
"description": "",

@@ -60,3 +60,3 @@ "keywords": [

},
"gitHead": "69f661603b0536b59c87bdf74460ac0f32cac3d1"
"gitHead": "aa96b7ba2cd225e462b3192104a2a150b448fda7"
}

@@ -12,1 +12,5 @@ import { FxDbDriverNS } from './Typo';

export declare function logDebugSQL(dbtype: string, sql: string, is_sync?: boolean): void;
export declare function detectWindowsCodePoints(): {
isWindows: boolean;
codepoints: string;
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc