Skip to content

Modified the solutions of the HoL for Collaborate #170

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 19 commits into from
Apr 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e591f92
Modified samples and instructions to import common connection informa…
OsBlaineOra Apr 20, 2018
0043381
fixed to create a pool instead of a regular connection.
OsBlaineOra Apr 20, 2018
aa75fc9
added connect line
OsBlaineOra Apr 20, 2018
91ab21b
removed extra crlf
OsBlaineOra Apr 20, 2018
6d86adc
Cleaned up text, fixed some errors, fixed table of contents
OsBlaineOra Apr 20, 2018
1c6555d
removed generatemany file. Fixed indent in connect_pool2. Fixed user…
OsBlaineOra Apr 20, 2018
5ab03e7
attempting to reset the file
OsBlaineOra Apr 20, 2018
9a019de
Modified samples and instructions to import common connection informa…
OsBlaineOra Apr 20, 2018
3264adf
fixed to create a pool instead of a regular connection.
OsBlaineOra Apr 20, 2018
cecd7d4
added connect line
OsBlaineOra Apr 20, 2018
535d9e9
removed extra crlf
OsBlaineOra Apr 20, 2018
bd6e2c1
Cleaned up text, fixed some errors, fixed table of contents
OsBlaineOra Apr 20, 2018
720989d
removed generatemany file. Fixed indent in connect_pool2. Fixed user…
OsBlaineOra Apr 20, 2018
d6475a5
attempting to reset the file
OsBlaineOra Apr 20, 2018
05253ce
Merge branch 'master' of github.com:OsBlaineOra/python-cx_Oracle
OsBlaineOra Apr 20, 2018
7ab667b
Revert "attempting to reset the file"
OsBlaineOra Apr 20, 2018
552b299
fixed some formatting errors and referenced the config values
OsBlaineOra Apr 20, 2018
51365d1
added db_config and made changes to solutions to use db_config values
OsBlaineOra Apr 21, 2018
215998c
removed extra variables
OsBlaineOra Apr 21, 2018
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/solutions/aq-dequeue.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/solutions/aq-enqueue.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/solutions/aq-queuestart.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/solutions/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
3 changes: 2 additions & 1 deletion samples/tutorial/solutions/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
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/solutions/connect_pool2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
import cx_Oracle
import threading
import time
import db_config

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

def Query():
Expand Down
4 changes: 4 additions & 0 deletions samples/tutorial/solutions/db_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import os

dirName = os.path.dirname(os.path.dirname(__file__))
exec(open(os.path.join(dirName, "db_config.py"), "r").read())
3 changes: 2 additions & 1 deletion samples/tutorial/solutions/query-2.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/solutions/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.execute("select * from dept order by deptno")
Expand Down
3 changes: 2 additions & 1 deletion samples/tutorial/solutions/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/solutions/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()

Expand Down
Loading