|
@@ -1486,8 +1486,8 @@ uses
|
|
{$endif}
|
|
{$endif}
|
|
|
|
|
|
{$IFDEF LinkDynamically}
|
|
{$IFDEF LinkDynamically}
|
|
-Function InitialiseMysql(Const LibraryName : String) : Integer;
|
|
|
|
-Function InitialiseMysql : Integer;
|
|
|
|
|
|
+Function InitialiseMysql(Const LibraryName : String; argc:cint = 0; argv:PPchar = nil; groups:PPchar = nil) : Integer;
|
|
|
|
+Function InitialiseMysql(argc:cint = 0; argv:PPchar = nil; groups:PPchar = nil) : Integer;
|
|
Procedure ReleaseMysql;
|
|
Procedure ReleaseMysql;
|
|
|
|
|
|
var MysqlLibraryHandle : TLibHandle;
|
|
var MysqlLibraryHandle : TLibHandle;
|
|
@@ -1506,7 +1506,7 @@ var
|
|
RefCount : integer;
|
|
RefCount : integer;
|
|
LoadedLibrary : String;
|
|
LoadedLibrary : String;
|
|
|
|
|
|
-Function TryInitialiseMysql(Const LibraryName : String) : Integer;
|
|
|
|
|
|
+Function TryInitialiseMysql(Const LibraryName : String; argc:cint = 0; argv:PPchar = nil; groups:PPchar = nil) : Integer;
|
|
|
|
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -1619,26 +1619,28 @@ begin
|
|
pointer(mysql_stmt_affected_rows) := GetProcedureAddress(MysqlLibraryHandle,'mysql_stmt_affected_rows');
|
|
pointer(mysql_stmt_affected_rows) := GetProcedureAddress(MysqlLibraryHandle,'mysql_stmt_affected_rows');
|
|
pointer(mysql_stmt_insert_id) := GetProcedureAddress(MysqlLibraryHandle,'mysql_stmt_insert_id');
|
|
pointer(mysql_stmt_insert_id) := GetProcedureAddress(MysqlLibraryHandle,'mysql_stmt_insert_id');
|
|
pointer(mysql_stmt_field_count) := GetProcedureAddress(MysqlLibraryHandle,'mysql_stmt_field_count');
|
|
pointer(mysql_stmt_field_count) := GetProcedureAddress(MysqlLibraryHandle,'mysql_stmt_field_count');
|
|
|
|
+
|
|
|
|
+ mysql_library_init(0,nil,nil);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
inc(RefCount);
|
|
inc(RefCount);
|
|
Result:=RefCount;
|
|
Result:=RefCount;
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function InitialiseMysql : Integer;
|
|
|
|
|
|
+Function InitialiseMysql(argc:cint = 0; argv:PPchar = nil; groups:PPchar = nil) : Integer;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result := 0;
|
|
Result := 0;
|
|
- If (TryInitialiseMysql(mysqlvlib) = 0) and
|
|
|
|
- (TryInitialiseMysql(mysqllib) = 0) then
|
|
|
|
|
|
+ If (TryInitialiseMysql(mysqlvlib,argc,argv,groups) = 0) and
|
|
|
|
+ (TryInitialiseMysql(mysqllib,argc,argv,groups) = 0) then
|
|
Raise EInOutError.CreateFmt(SErrDefaultsFailed,[mysqlvlib,mysqllib]);
|
|
Raise EInOutError.CreateFmt(SErrDefaultsFailed,[mysqlvlib,mysqllib]);
|
|
Result := RefCount;
|
|
Result := RefCount;
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function InitialiseMysql(Const LibraryName : String) : Integer;
|
|
|
|
|
|
+Function InitialiseMysql(Const LibraryName : String; argc:cint = 0; argv:PPchar = nil; groups:PPchar = nil) : Integer;
|
|
|
|
|
|
begin
|
|
begin
|
|
- Result := TryInitialiseMysql(LibraryName);
|
|
|
|
|
|
+ Result := TryInitialiseMysql(LibraryName,argc,argv,groups);
|
|
If Result = 0 then
|
|
If Result = 0 then
|
|
Raise EInOutError.CreateFmt(SErrLoadFailed,[LibraryName])
|
|
Raise EInOutError.CreateFmt(SErrLoadFailed,[LibraryName])
|
|
else If (LibraryName<>LoadedLibrary) then
|
|
else If (LibraryName<>LoadedLibrary) then
|
|
@@ -1654,12 +1656,16 @@ Procedure ReleaseMysql;
|
|
begin
|
|
begin
|
|
if RefCount> 1 then
|
|
if RefCount> 1 then
|
|
Dec(RefCount)
|
|
Dec(RefCount)
|
|
- else if UnloadLibrary(MysqlLibraryHandle) then
|
|
|
|
|
|
+ else if RefCount = 1 then
|
|
begin
|
|
begin
|
|
- Dec(RefCount);
|
|
|
|
- MysqlLibraryHandle := NilHandle;
|
|
|
|
- LoadedLibrary:='';
|
|
|
|
- end;
|
|
|
|
|
|
+ mysql_library_end;
|
|
|
|
+ if UnloadLibrary(MysqlLibraryHandle) then
|
|
|
|
+ begin
|
|
|
|
+ Dec(RefCount);
|
|
|
|
+ MysqlLibraryHandle := NilHandle;
|
|
|
|
+ LoadedLibrary:='';
|
|
|
|
+ end
|
|
|
|
+ end
|
|
end;
|
|
end;
|
|
|
|
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
@@ -1715,5 +1721,8 @@ end;
|
|
result := -1;
|
|
result := -1;
|
|
end;
|
|
end;
|
|
|
|
|
|
-
|
|
|
|
|
|
+{$IFDEF LinkDynamically}
|
|
|
|
+initialization
|
|
|
|
+ Refcount := 0;
|
|
|
|
+{$ENDIF}
|
|
end.
|
|
end.
|