rm_jvinterpreter_dbtables.pas

来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 2,412 行 · 第 1/5 页

PAS
2,412
字号
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.

The Original Code is: JvInterpreter_DBTables.PAS, released on 2002-07-04.

The Initial Developers of the Original Code are: Andrei Prygounkov <a.prygounkov@gmx.de>
Copyright (c) 1999, 2002 Andrei Prygounkov
All Rights Reserved.

Contributor(s):

Last Modified: 2002-07-04

You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net

Description : adapter unit - converts JvInterpreter calls to delphi calls

Known Issues:
-----------------------------------------------------------------------------}

{$I rm_JVCL.INC}

unit rm_JvInterpreter_DBTables;

interface

uses
  rm_JvInterpreter;

procedure RegisterJvInterpreterAdapter(JvInterpreterAdapter: TJvInterpreterAdapter);

implementation

uses
  BDE, Classes, Db, DbTables;

{ EDBEngineError }

{ constructor Create(ErrorCode: DBIResult) }

procedure EDBEngineError_Create(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := O2V(EDBEngineError.Create(Args.Values[0]));
end;

{ property Read ErrorCount: Integer }

procedure EDBEngineError_Read_ErrorCount(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := EDBEngineError(Args.Obj).ErrorCount;
end;

{ property Read Errors[Integer]: TDBError }

procedure EDBEngineError_Read_Errors(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := O2V(EDBEngineError(Args.Obj).Errors[Args.Values[0]]);
end;

{ ENoResultSet }

{ TSession }

{ constructor Create(AOwner: TComponent) }

procedure TSession_Create(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := O2V(TSession.Create(V2O(Args.Values[0]) as TComponent));
end;

{ procedure AddAlias(const Name, Driver: string; List: TStrings); }

procedure TSession_AddAlias(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).AddAlias(Args.Values[0], Args.Values[1], V2O(Args.Values[2]) as TStrings);
end;

{ procedure AddDriver(const Name: string; List: TStrings); }

{$IFDEF COMPILER3_UP}
procedure TSession_AddDriver(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).AddDriver(Args.Values[0], V2O(Args.Values[1]) as TStrings);
end;
{$ENDIF COMPILER3_UP}

{ procedure AddStandardAlias(const Name, Path, DefaultDriver: string); }

procedure TSession_AddStandardAlias(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).AddStandardAlias(Args.Values[0], Args.Values[1], Args.Values[2]);
end;

{ property Read ConfigMode: TConfigMode }

procedure TSession_Read_ConfigMode(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := S2V(Byte(TSession(Args.Obj).ConfigMode));
end;

{ property Write ConfigMode(Value: TConfigMode) }

procedure TSession_Write_ConfigMode(const Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).ConfigMode := TConfigMode(Byte(V2S(Value)));
end;

{ procedure AddPassword(const Password: string); }

procedure TSession_AddPassword(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).AddPassword(Args.Values[0]);
end;

{ procedure Close; }

procedure TSession_Close(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).Close;
end;

{ procedure CloseDatabase(Database: TDatabase); }

procedure TSession_CloseDatabase(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).CloseDatabase(V2O(Args.Values[0]) as TDatabase);
end;

{ procedure DeleteAlias(const Name: string); }

procedure TSession_DeleteAlias(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).DeleteAlias(Args.Values[0]);
end;

{ procedure DeleteDriver(const Name: string); }

{$IFDEF COMPILER3_UP}
procedure TSession_DeleteDriver(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).DeleteDriver(Args.Values[0]);
end;
{$ENDIF COMPILER3_UP}

{ procedure DropConnections; }

procedure TSession_DropConnections(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).DropConnections;
end;

{ function FindDatabase(const DatabaseName: string): TDatabase; }

procedure TSession_FindDatabase(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := O2V(TSession(Args.Obj).FindDatabase(Args.Values[0]));
end;

{ procedure GetAliasNames(List: TStrings); }

procedure TSession_GetAliasNames(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).GetAliasNames(V2O(Args.Values[0]) as TStrings);
end;

{ procedure GetAliasParams(const AliasName: string; List: TStrings); }

procedure TSession_GetAliasParams(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).GetAliasParams(Args.Values[0], V2O(Args.Values[1]) as TStrings);
end;

{ function GetAliasDriverName(const AliasName: string): string; }

procedure TSession_GetAliasDriverName(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).GetAliasDriverName(Args.Values[0]);
end;

{ procedure GetConfigParams(const Path, Section: string; List: TStrings); }

procedure TSession_GetConfigParams(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).GetConfigParams(Args.Values[0], Args.Values[1], V2O(Args.Values[2]) as TStrings);
end;

{ procedure GetDatabaseNames(List: TStrings); }

procedure TSession_GetDatabaseNames(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).GetDatabaseNames(V2O(Args.Values[0]) as TStrings);
end;

{ procedure GetDriverNames(List: TStrings); }

procedure TSession_GetDriverNames(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).GetDriverNames(V2O(Args.Values[0]) as TStrings);
end;

{ procedure GetDriverParams(const DriverName: string; List: TStrings); }

procedure TSession_GetDriverParams(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).GetDriverParams(Args.Values[0], V2O(Args.Values[1]) as TStrings);
end;

{ function GetPassword: Boolean; }

procedure TSession_GetPassword(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).GetPassword;
end;

{ procedure GetTableNames(const DatabaseName, Pattern: string; Extensions, SystemTables: Boolean; List: TStrings); }

procedure TSession_GetTableNames(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).GetTableNames(Args.Values[0], Args.Values[1], Args.Values[2], Args.Values[3], V2O(Args.Values[4]) as
    TStrings);
end;

{ procedure GetStoredProcNames(const DatabaseName: string; List: TStrings); }

procedure TSession_GetStoredProcNames(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).GetStoredProcNames(Args.Values[0], V2O(Args.Values[1]) as TStrings);
end;

{ function IsAlias(const Name: string): Boolean; }

procedure TSession_IsAlias(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).IsAlias(Args.Values[0]);
end;

{ procedure ModifyAlias(Name: string; List: TStrings); }

procedure TSession_ModifyAlias(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).ModifyAlias(Args.Values[0], V2O(Args.Values[1]) as TStrings);
end;

{ procedure ModifyDriver(Name: string; List: TStrings); }

{$IFDEF COMPILER3_UP}
procedure TSession_ModifyDriver(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).ModifyDriver(Args.Values[0], V2O(Args.Values[1]) as TStrings);
end;
{$ENDIF COMPILER3_UP}

{ procedure Open; }

procedure TSession_Open(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).Open;
end;

{ function OpenDatabase(const DatabaseName: string): TDatabase; }

procedure TSession_OpenDatabase(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := O2V(TSession(Args.Obj).OpenDatabase(Args.Values[0]));
end;

{ procedure RemoveAllPasswords; }

procedure TSession_RemoveAllPasswords(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).RemoveAllPasswords;
end;

{ procedure RemovePassword(const Password: string); }

procedure TSession_RemovePassword(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).RemovePassword(Args.Values[0]);
end;

{ procedure SaveConfigFile; }

procedure TSession_SaveConfigFile(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).SaveConfigFile;
end;

{ property Read DatabaseCount: Integer }

procedure TSession_Read_DatabaseCount(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).DatabaseCount;
end;

{ property Read Databases[Integer]: TDatabase }

procedure TSession_Read_Databases(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := O2V(TSession(Args.Obj).Databases[Args.Values[0]]);
end;

{ property Read Handle: HDBISES }

procedure TSession_Read_Handle(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := Integer(TSession(Args.Obj).Handle);
end;

{ property Read Locale: TLocale }

procedure TSession_Read_Locale(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := P2V(TSession(Args.Obj).Locale);
end;

{ property Read TraceFlags: TTraceFlags }

procedure TSession_Read_TraceFlags(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := S2V(Word(TSession(Args.Obj).TraceFlags));
end;

{ property Write TraceFlags(Value: TTraceFlags) }

procedure TSession_Write_TraceFlags(const Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).TraceFlags := TTraceFlags(Word(V2S(Value)));
end;

{ property Read Active: Boolean }

procedure TSession_Read_Active(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).Active;
end;

{ property Write Active(Value: Boolean) }

procedure TSession_Write_Active(const Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).Active := Value;
end;

{$IFDEF COMPILER3_UP}

{ property Read AutoSessionName: Boolean }

procedure TSession_Read_AutoSessionName(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).AutoSessionName;
end;

{ property Write AutoSessionName(Value: Boolean) }

procedure TSession_Write_AutoSessionName(const Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).AutoSessionName := Value;
end;

{$ENDIF COMPILER3_UP}

{ property Read KeepConnections: Boolean }

procedure TSession_Read_KeepConnections(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).KeepConnections;
end;

{ property Write KeepConnections(Value: Boolean) }

procedure TSession_Write_KeepConnections(const Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).KeepConnections := Value;
end;

{ property Read NetFileDir: string }

procedure TSession_Read_NetFileDir(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).NetFileDir;
end;

{ property Write NetFileDir(Value: string) }

procedure TSession_Write_NetFileDir(const Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).NetFileDir := Value;
end;

{ property Read PrivateDir: string }

procedure TSession_Read_PrivateDir(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).PrivateDir;
end;

{ property Write PrivateDir(Value: string) }

procedure TSession_Write_PrivateDir(const Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).PrivateDir := Value;
end;

{ property Read SessionName: string }

procedure TSession_Read_SessionName(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).SessionName;
end;

{ property Write SessionName(Value: string) }

procedure TSession_Write_SessionName(const Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).SessionName := Value;
end;

{$IFDEF COMPILER3_UP}

{ property Read SQLHourGlass: Boolean }

procedure TSession_Read_SQLHourGlass(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := TSession(Args.Obj).SQLHourGlass;
end;

{ property Write SQLHourGlass(Value: Boolean) }

procedure TSession_Write_SQLHourGlass(const Value: Variant; Args: TJvInterpreterArgs);
begin
  TSession(Args.Obj).SQLHourGlass := Value;
end;

{$ENDIF COMPILER3_UP}

{ TDatabase }

{ constructor Create(AOwner: TComponent) }

procedure TDatabase_Create(var Value: Variant; Args: TJvInterpreterArgs);
begin
  Value := O2V(TDatabase.Create(V2O(Args.Values[0]) as TComponent));
end;

(*
{ procedure ApplyUpdates(const DataSets: array of TDBDataSet); }
procedure TDatabase_ApplyUpdates(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TDatabase(Args.Obj).ApplyUpdates(Args.Values[0]);
end;
*)

{ procedure Close; }

procedure TDatabase_Close(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TDatabase(Args.Obj).Close;
end;

{ procedure CloseDataSets; }

procedure TDatabase_CloseDataSets(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TDatabase(Args.Obj).CloseDataSets;
end;

{ procedure Commit; }

procedure TDatabase_Commit(var Value: Variant; Args: TJvInterpreterArgs);
begin
  TDatabase(Args.Obj).Commit;
end;

{ procedure FlushSchemaCache(const TableName: string); }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?