Skip to content

Instantly share code, notes, and snippets.

@cyshallchan
cyshallchan / mysq-export.sql
Created July 16, 2020 03:08
mysql export data with coloumn name
SET @table_name = "user";
SET @schema_name = "test_db";
SET @output_name = CONCAT("/var/lib/mysql-files/",@table_name,".txt");
SET @cols = NULL;
select GROUP_CONCAT(CONCAT("'",COLUMN_NAME,"'")) INTO @cols
from INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @table_name AND TABLE_SCHEMA = @schema_name;
SET @sql = CONCAT(" SELECT * FROM (SELECT ", @cols, " UNION ALL SELECT * FROM ", @table_name, ") as r ",
@cyshallchan
cyshallchan / oradb.cpp
Created June 9, 2020 06:05
Simple example to connect to oracle database with occi
/*------------------------------------------
Name: oradb.cpp
Date: 2015
Auth: Sun Dro
Desc: Simple example to connect to oracle
database with occi.
------------------------------------------*/
#include <iostream>
#include <occi.h>