Skip to content

Instantly share code, notes, and snippets.

View toronya's full-sized avatar

toronya toronya

View GitHub Profile
@toronya
toronya / BuildUpsertSql.vb
Created July 24, 2017 04:04
Build UPSERT (INSERT OR UPDATE ) SQL for PostgreSQL
Sub test___BuildUpsertSql()
Dim res As String
res = BuildUpsertSql("sample_table", _
"sample_pkey", _
"user_name, user_email, user_address", _
"test_user, test@example.jp, Tokyo")
Debug.Print res
'# INSERT INTO sample_table(
'# user_name, user_email, user_address
@toronya
toronya / ValidFileName.bas
Last active August 29, 2015 14:03
Replace Illegal Windows filename characters
'# convert Illegal Windows filename characters
'# ex. Sheet<1> => Sheet_1_
'# sample1
Function ValidFileName(invalidFileName As Variant) As Variant
Dim invalidArray
invalidArray = Array("*", """", ":", ";", "\", "/", "<", ">", "[", "]", "|", ",", "?", ".")
Dim c As Variant
For Each c In invalidArray
@toronya
toronya / Lotus Notes View Download as csv agent.vb
Last active December 11, 2015 12:38
Lotus Notes View Download as csv. Lotus Notes Agent Script.
Option Declare
'#-------------------------------------------------------#
'# http://example.com/test.nsf/exportcsv?openagent #=> CSV File Download
'#-------------------------------------------------------#
Sub Initialize
'====================
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
@toronya
toronya / oracle_to_csv.rb
Last active December 29, 2015 22:20
simple example of DB table to csv (oracle)
# coding:utf-8
# usage: ruby oracle_to_csv.rb > sample.csv
require 'rubygems'
require 'oci8' # before you need install : gem install ruby-oci8
def csvout(user, pass, world, sql)
begin
ora = OCI8.new(user,pass,world)
c = ora.exec(sql)
@toronya
toronya / Decoding URL Query String Parameters by Lotus Notes Agent Script.vb
Last active May 27, 2022 19:35
Decoding URL Query String Parameters by Lotus Notes Agent Script.
Option Declare
'#-------------------------------------------------------#
'# Decode URL Query String Parameters by Lotus Notes Agent Script.
'#
'# ex. http://example.com/test.nsf/agentname?openagent&title=%E3%83%88%E3%83%83%E3%83%97%E3%83%9A%E3%83%BC%E3%82%B8
'# => arg_decoded = "トップページ"
'#-------------------------------------------------------#
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase