Skip to content

Modified the HoL for Collaborate #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Apr 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion samples/tutorial/aq.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

import cx_Oracle
import decimal
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

BOOK_TYPE_NAME = "UDT_BOOK"
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/bind_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

rows = [ (1, "First" ), (2, "Second" ),
Expand Down
13 changes: 11 additions & 2 deletions samples/tutorial/bind_insert.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@

set echo on

connect pythonhol/welcome@localhost/orclpdb
@@db_config.sql
connect &user/&pw@&connect_string

drop table mytab;
begin
execute immediate 'drop table mytab';
exception
when others then
if sqlcode not in (-00942) then
raise;
end if;
end;
/

create table mytab (id number, data varchar2(20), constraint my_pk primary key (id));

Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/bind_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

cur.prepare("select * from dept where deptno = :id order by deptno")
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/bind_sdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
import db_config

con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

# Create table
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/clob.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

print("Inserting data...")
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/clob_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

print("Inserting data...")
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
print("Database version:", con.version)
3 changes: 2 additions & 1 deletion samples/tutorial/connect_drcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb:pooled",
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn + ":pooled",
cclass="PYTHONHOL", purity=cx_Oracle.ATTR_PURITY_SELF)
print("Database version:", con.version)
3 changes: 2 additions & 1 deletion samples/tutorial/connect_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

import cx_Oracle
import threading
import db_config

pool = cx_Oracle.SessionPool("pythonhol", "welcome", "localhost/orclpdb",
pool = cx_Oracle.SessionPool(db_config.user, db_config.pw, db_config.dsn,
min = 2, max = 5, increment = 1, threaded = True)

def Query():
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/connect_pool2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

import cx_Oracle
import threading
import db_config

pool = cx_Oracle.SessionPool("pythonhol", "welcome", "localhost/orclpdb",
pool = cx_Oracle.SessionPool(db_config.user, db_config.pw, db_config.dsn,
min = 2, max = 5, increment = 1, threaded = True)

def Query():
Expand Down
3 changes: 3 additions & 0 deletions samples/tutorial/db_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
user = "pythonhol"
pw = "welcome"
dsn = "localhost/orclpdb"
3 changes: 3 additions & 0 deletions samples/tutorial/db_config.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def user = "pythonhol"
def pw = "welcome"
def connect_string = "localhost/orclpdb"
3 changes: 2 additions & 1 deletion samples/tutorial/plsql_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

res = cur.callfunc('myfunc', int, ('abc', 2))
Expand Down
13 changes: 12 additions & 1 deletion samples/tutorial/plsql_func.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@

set echo on

connect pythonhol/welcome@localhost/orclpdb
@@db_config.sql
connect &user/&pw@&connect_string

begin
execute immediate 'drop table ptab';
exception
when others then
if sqlcode not in (-00942) then
raise;
end if;
end;
/

create table ptab (mydata varchar(20), myid number);

Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/plsql_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

myvar = cur.var(int)
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/plsql_proc.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

set echo on

connect pythonhol/welcome@localhost/orclpdb
@@db_config.sql
connect &user/&pw@&connect_string

create or replace procedure myproc(v1_p in number, v2_p out number) as
begin
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
3 changes: 2 additions & 1 deletion samples/tutorial/query2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)

cur = con.cursor()
cur.execute('select * from dept order by deptno')
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/query_arraysize.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

import cx_Oracle
import time
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)

start = time.time()

Expand Down
13 changes: 11 additions & 2 deletions samples/tutorial/query_arraysize.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@

set echo on

connect pythonhol/welcome@localhost/orclpdb
@@db_config.sql
connect &user/&pw@&connect_string

drop table bigtab;
begin
execute immediate 'drop table bigtab';
exception
when others then
if sqlcode not in (-00942) then
raise;
end if;
end;
/

create table bigtab (mycol varchar2(20));
begin
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/query_many.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

cur.execute("select * from dept order by deptno")
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/query_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

cur.execute("select * from dept order by deptno")
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/query_scroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor(scrollable = True)

cur.execute("select * from dept order by deptno")
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/rowfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

import collections
import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

cur.execute("select deptno, dname from dept")
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/subclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
from __future__ import print_function

import cx_Oracle
import db_config

class MyConnection(cx_Oracle.Connection):

def __init__(self):
print("Connecting to database")
return super(MyConnection, self).__init__("pythonhol", "welcome", "localhost/orclpdb")
return super(MyConnection, self).__init__(db_config.user, db_config.pw, db_config.dsn)

con = MyConnection()
cur = con.cursor()
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/type_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

for value, in cur.execute("select 0.1 from dual"):
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/type_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

# Create table
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/type_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
cur = con.cursor()

print("Standard output...")
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from __future__ import print_function

import cx_Oracle
import db_config

con = cx_Oracle.connect('pythonhol/welcome@localhost/orclpdb')
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)

print(cx_Oracle.version)