Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package VB;
- import VBA.Interaction;
- import VBA.Strings;
- import java.sql.*;
- // Referenced classes of package VB:
- // IJabacoClass
- public class DataBase
- implements IJabacoClass
- {
- private void Class_Initialize()
- {
- Throwable Err = null;
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- _L1:
- return;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public boolean Connect(String url)
- {
- boolean Connect;
- Throwable Err;
- Connect = false;
- Err = null;
- myCon = null;
- _L5:
- myCon = DriverManager.getConnection(url);
- _L6:
- if(myCon == null) goto _L2; else goto _L1
- _L2:
- _L7:
- Connect = false;
- goto _L3
- _L1:
- _L8:
- Connect = true;
- _L3:
- _L4:
- return Connect;
- Err;
- goto _L4
- goto _L5
- goto _L6
- goto _L7
- goto _L3
- goto _L8
- goto _L3
- }
- public boolean Connect(String url, String user, String password)
- {
- boolean Connect;
- Throwable Err;
- Connect = false;
- Err = null;
- myCon = null;
- _L5:
- myCon = DriverManager.getConnection(url, user, password);
- _L6:
- if(myCon == null) goto _L2; else goto _L1
- _L2:
- _L7:
- Connect = false;
- goto _L3
- _L1:
- _L8:
- Connect = true;
- _L3:
- _L4:
- return Connect;
- Err;
- goto _L4
- goto _L5
- goto _L6
- goto _L7
- goto _L3
- goto _L8
- goto _L3
- }
- public boolean ConnectMDB(String path)
- {
- boolean ConnectMDB;
- Throwable Err;
- ConnectMDB = false;
- Err = null;
- ConnectMDB = Connect(Strings.StrCat("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=", path));
- _L1:
- return ConnectMDB;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public boolean ConnectMDB(String path, String user, String password)
- {
- boolean ConnectMDB;
- Throwable Err;
- ConnectMDB = false;
- Err = null;
- ConnectMDB = Connect(Strings.StrCat("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=", path), user, password);
- _L1:
- return ConnectMDB;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public boolean ConnectDSN(String dsn)
- {
- boolean ConnectDSN;
- Throwable Err;
- ConnectDSN = false;
- Err = null;
- ConnectDSN = Connect(Strings.StrCat("jdbc:odbc:", dsn));
- _L1:
- return ConnectDSN;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public boolean ConnectDSN(String dsn, String user, String password)
- {
- boolean ConnectDSN;
- Throwable Err;
- ConnectDSN = false;
- Err = null;
- ConnectDSN = Connect(Strings.StrCat("jdbc:odbc:", dsn), user, password);
- _L1:
- return ConnectDSN;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public ResultSet ExecuteStatement(String sql)
- {
- ResultSet ExecuteStatement;
- Throwable Err;
- Statement myStmt;
- ExecuteStatement = null;
- Err = null;
- myStmt = myCon.createStatement();
- ExecuteStatement = myStmt.executeQuery(sql);
- _L1:
- return ExecuteStatement;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public boolean Execute(String sql)
- {
- boolean Execute;
- Throwable Err;
- Statement myStmt;
- Execute = false;
- Err = null;
- myStmt = myCon.createStatement();
- Execute = myStmt.execute(sql);
- _L1:
- return Execute;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public int ExecuteUpdate(String sql)
- {
- int ExecuteUpdate;
- Throwable Err;
- Statement myStmt;
- ExecuteUpdate = 0;
- Err = null;
- myStmt = myCon.createStatement();
- ExecuteUpdate = myStmt.executeUpdate(sql);
- _L1:
- return ExecuteUpdate;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public Connection $Connection()
- {
- Connection $Connection;
- Throwable Err;
- $Connection = null;
- Err = null;
- $Connection = myCon;
- _L1:
- return $Connection;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public Connection $Parent()
- {
- Connection $Parent;
- Throwable Err;
- $Parent = null;
- Err = null;
- $Parent = myCon;
- _L1:
- return $Parent;
- _L2:
- Interaction.MsgBox((Throwable)Err);
- goto _L1
- Err;
- goto _L2
- }
- public DataBase()
- {
- initVars();
- Class_Initialize();
- }
- private void initVars()
- {
- myCon = null;
- }
- private Connection myCon;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement