This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO SCOTT.DEPT (DNAME, LOC, DEPTNO) | |
VALUES (:DNAME, :LOC, SCOTT.DEPT_SEQ.nextval); | |
SELECT SCOTT.DEPT_SEQ.currval FROM DUAL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO dbo.Categories (CategoryName, Description) | |
VALUES (@CategoryName, @Description) | |
SELECT SCOPE_IDENTITY() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// passing a cursor parameter between calls in Mighty | |
var res1 = db.ExecuteWithParams( | |
"begin open :p_rc for select * from emp " + | |
"where deptno = 10; end;", | |
outParams: new { p_rc = new Cursor() }, | |
connection: conn); | |
db.ExecuteProcedure( | |
"cursor_in_out.process_cursor", | |
inParams: new { p_cursor = res1.p_rc }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var results = db.ExecuteProcedure("TestProc", | |
inParams: new { a = 1, b = 2 }, | |
outParams: new { c = (int?)null }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db = new MightyOrm(connectionSting); | |
var results = db.ExecuteProcedure("TestSumProc", | |
inParams: new { a = 1, b = 2 }, | |
outParams: new { c = 0 }); | |
// passes! | |
Assert.AreEqual(3, results.c); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db = new MightyOrm<Employee>(connectionString); | |
// the rest of the previous code sample stays exactly the same, | |
// though each employee value will now be strongly typed | |
var smiths = db.Query("SELECT * FROM Employees WHERE FamilyName = @0", "Smith"); | |
foreach (var employee in smiths) | |
{ | |
Console.WriteLine($"ID={employee.ID} GivenName={employee.GivenName}"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use DynamicModel instead of MightyOrm for original Massive code | |
var db = new MightyOrm(connectionString); | |
var smiths = db.Query("SELECT * FROM Employees WHERE FamilyName = @0", "Smith"); | |
foreach (var employee in smiths) | |
{ | |
Console.WriteLine($"ID={employee.ID} GivenName={employee.GivenName}"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db = new MightyOrm(tableName: "Employee", primaryKey: "EmployeeID"); | |
db.Update(new {EmployeeID = 42, Salary = 100000}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db = new MightyOrm(connectionString); | |
var smiths = db.Query("SELECT * FROM Employees WHERE FamilyName = @0", "Smith"); | |
foreach (var employee in smiths) | |
{ | |
Console.WriteLine($"ID={employee.ID} GivenName={employee.GivenName}"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if (@X)==(@Y) @end /* JScript comment | |
@echo off | |
setlocal | |
for /f "tokens=2" %%i in ('tasklist /FI "IMAGENAME eq Fork.exe" ^| find /I "Fork.exe"') do set pid=%%i | |
if "%pid%" == "" ( | |
%localappdata%\Fork\Fork.exe | |
) else ( | |
cscript //E:JScript //nologo "%~f0" "%~nx0" "%pid%" | |
) |