def test_oracle_clobfunc(): e = oraclecode() tmpl = e.conv().string(encoding="ascii") sql = toxicc.compile(tmpl) assert "dbms_lob.createtemporary" in sql assert "procedure write" in sql assert "return clob\n" in sql
def test_sqlserver_clobfunc(): e = sqlservercode() tmpl = e.conv().string(encoding="ascii") sql = toxicc.compile(tmpl, mode="sqlserver") assert "declare @c_out varchar(max)" in sql assert "returns varchar(max)\n" in sql assert "set @c_out = @c_out +" in sql
def test_oracle_clobproc(): e = xsc.Frag(toxic.proc(), toxic.args("c_out out clob"), oraclecode()) tmpl = e.conv().string(encoding="ascii") sql = toxicc.compile(tmpl) print(sql) assert "dbms_lob.createtemporary" in sql assert "procedure write" in sql assert "c_out out clob" in sql
def test_sqlserver_clobproc(): e = xsc.Frag( toxic.proc(), toxic.args("@c_out varchar(max) output"), sqlservercode(), ) tmpl = e.conv().string(encoding="ascii") sql = toxicc.compile(tmpl, mode="sqlserver") assert "@c_out varchar(max) output" in sql assert "set @c_out = @c_out +" in sql
def test_sqlserver_varcharfunc(): e = xsc.Frag( toxic.type("varchar(20000)"), sqlservercode(), ) tmpl = e.conv().string(encoding="ascii") sql = toxicc.compile(tmpl, mode="sqlserver") assert "declare @c_out varchar(20000)" in sql assert "returns varchar(20000)\n" in sql assert "set @c_out = @c_out +" in sql
def test_oracle_varcharfunc(): e = xsc.Frag( toxic.type("varchar2(20000)"), oraclecode(), ) tmpl = e.conv().string(encoding="ascii") sql = toxicc.compile(tmpl) assert "dbms_lob.createtemporary" not in sql assert "procedure write" not in sql assert "c_out := c_out ||" in sql assert "return varchar2\n" in sql
def test_oracle_clobproc(): e = xsc.Frag( toxic.proc(), toxic.args("c_out out clob"), oraclecode() ) tmpl = e.conv().string(encoding="ascii") sql = toxicc.compile(tmpl) print(sql) assert "dbms_lob.createtemporary" in sql assert "procedure write" in sql assert "c_out out clob" in sql