فهرست منبع

Merged revisions 11687,11689-11692,11694-11696,11698,11701-11702,11705-11707,11712-11718,11723-11726,11728-11729,11733-11737,11748-11749,11778,11780-11781,11785,11810,11822,11831,11836,11848,11872,11876-11878,11881-11883,11889,11891-11895,11899-11902,11920-11925,11931-11932,11935,11938,11941,11986,11992,12005,12014,12018,12041-12042,12044,12046,12051-12053,12055,12058,12063,12067-12072,12074,12076,12079-12082 via svnmerge from
svn+ssh://svn.freepascal.org/FPC/svn/fpc/trunk

........
r11687 | michael | 2008-09-01 18:54:05 +0200 (Mon, 01 Sep 2008) | 2 lines

* Fixed default value for floats (mantis #9183)
........
r11748 | michael | 2008-09-11 21:04:26 +0200 (Thu, 11 Sep 2008) | 1 line

* Fixed writing of default float values
........
r11749 | michael | 2008-09-11 21:37:18 +0200 (Thu, 11 Sep 2008) | 1 line

* Fixed writing of default boolean values
........
r12005 | michael | 2008-11-01 12:05:21 +0100 (Sat, 01 Nov 2008) | 1 line

* Fixed strtotime. Last character was never taken into account
........
r12082 | michael | 2008-11-14 11:25:59 +0100 (Fri, 14 Nov 2008) | 1 line

* Patch from Mattias gaertner to remove the use of macros
........

git-svn-id: branches/fixes_2_2@12084 -

michael 17 سال پیش
والد
کامیت
b2f2460019
2فایلهای تغییر یافته به همراه80 افزوده شده و 24 حذف شده
  1. 79 23
      packages/fcl-db/src/sqldb/mysql/mysqlconn.inc
  2. 1 1
      rtl/objpas/sysutils/dati.inc

+ 79 - 23
packages/fcl-db/src/sqldb/mysql/mysqlconn.inc

@@ -1,6 +1,5 @@
 
 {$mode objfpc}{$H+}
-{$MACRO on}
 
 interface
 
@@ -8,30 +7,14 @@ uses
   Classes, SysUtils,bufdataset,sqldb,db,dynlibs,
 {$IfDef mysql50}
   mysql50dyn;
-  {$DEFINE TConnectionName:=TMySQL50Connection}
-  {$DEFINE TMySQLConnectionDef:=TMySQL50ConnectionDef}
-  {$DEFINE TTransactionName:=TMySQL50Transaction}
-  {$DEFINE TCursorName:=TMySQL50Cursor}
 {$ELSE}
   {$IfDef mysql41}
     mysql41dyn;
-    {$DEFINE TConnectionName:=TMySQL41Connection}
-    {$DEFINE TMySQLConnectionDef:=TMySQL41ConnectionDef}
-    {$DEFINE TTransactionName:=TMySQL41Transaction}
-    {$DEFINE TCursorName:=TMySQL41Cursor}
   {$ELSE}
     {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
       mysql40dyn;
-      {$DEFINE TConnectionName:=TMySQLConnection}
-      {$DEFINE TMySQLConnectionDef:=TMySQL40ConnectionDef}
-      {$DEFINE TTransactionName:=TMySQLTransaction}
-      {$DEFINE TCursorName:=TMySQLCursor}
     {$ELSE}
       mysql40dyn;
-      {$DEFINE TConnectionName:=TMySQL40Connection}
-      {$DEFINE TMySQLConnectionDef:=TMySQL40ConnectionDef}
-      {$DEFINE TTransactionName:=TMySQL40Transaction}
-      {$DEFINE TCursorName:=TMySQL40Cursor}
     {$EndIf}
   {$EndIf}
 {$EndIf}
@@ -149,6 +132,33 @@ Type
 
   EMySQLError = Class(Exception);
 
+{$IfDef mysql50}
+  TMySQL50Connection = TConnectionName;
+  TMySQL50ConnectionDef = TMySQLConnectionDef;
+  TMySQL50Transaction = TTransactionName;
+  TMySQL50Cursor = TCursorName;
+{$ELSE}
+  {$IfDef mysql41}
+    TMySQL41Connection = TConnectionName;
+    TMySQL41ConnectionDef = TMySQLConnectionDef;
+    TMySQL41Transaction = TTransactionName;
+    TMySQL41Cursor = TCursorName;
+  {$ELSE}
+    {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
+      TMySQLConnection = TConnectionName;
+      TMySQL40ConnectionDef = TMySQLConnectionDef;
+      TMySQLTransaction = TTransactionName;
+      TMySQLCursor = TCursorName;
+    {$ELSE}
+      TMySQL40Connection = TConnectionName;
+      TMySQL40ConnectionDef = TMySQLConnectionDef;
+      TMySQL40Transaction = TTransactionName;
+      TMySQL40Cursor = TCursorName;
+    {$EndIf}
+  {$EndIf}
+{$EndIf}
+
+
 implementation
 
 uses dbconst,ctypes,strutils;
@@ -349,7 +359,19 @@ end;
 
 function TConnectionName.AllocateCursorHandle: TSQLCursor;
 begin
-  Result:=TCursorName.Create;
+  {$IfDef mysql50}
+    Result:=TMySQL50Cursor.Create;
+  {$ELSE}
+    {$IfDef mysql41}
+      Result:=TMySQL41Cursor.Create;
+    {$ELSE}
+      {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
+        Result:=TMySQLCursor.Create;
+      {$ELSE}
+        Result:=TMySQL40Cursor.Create;
+      {$EndIf}
+    {$EndIf}
+  {$EndIf}
 end;
 
 Procedure TConnectionName.DeAllocateCursorHandle(var cursor : TSQLCursor);
@@ -957,7 +979,19 @@ end;
 
 class function TMySQLConnectionDef.ConnectionClass: TSQLConnectionClass;
 begin
-  Result:=TConnectionName;
+  {$IfDef mysql50}
+    Result:=TMySQL50Connection;
+  {$ELSE}
+    {$IfDef mysql41}
+      Result:=TMySQL41Connection;
+    {$ELSE}
+      {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
+        Result:=TMySQLConnection;
+      {$ELSE}
+        Result:=TMySQL40Connection;
+      {$EndIf}
+    {$EndIf}
+  {$EndIf}
 end;
 
 class function TMySQLConnectionDef.Description: String;
@@ -965,8 +999,30 @@ begin
   Result:='Connect to a MySQL '+MySQLVersion+'database directly via the client library';
 end;
 
-initialization
-  RegisterConnection(TMySQLConnectionDef);
-finalization
-  UnRegisterConnection(TMySQLConnectionDef);
+{$IfDef mysql50}
+  initialization
+    RegisterConnection(TMySQL50ConnectionDef);
+  finalization
+    UnRegisterConnection(TMySQL50ConnectionDef);
+{$ELSE}
+  {$IfDef mysql41}
+    initialization
+      RegisterConnection(TMySQL41ConnectionDef);
+    finalization
+      UnRegisterConnection(TMySQL41ConnectionDef);
+  {$ELSE}
+    {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
+      initialization
+        RegisterConnection(TMySQL40ConnectionDef);
+      finalization
+        UnRegisterConnection(TMySQL40ConnectionDef);
+    {$ELSE}
+      initialization
+        RegisterConnection(TMySQL40ConnectionDef);
+      finalization
+        UnRegisterConnection(TMySQL40ConnectionDef);
+    {$EndIf}
+  {$EndIf}
+{$EndIf}
+
 end.

+ 1 - 1
rtl/objpas/sysutils/dati.inc

@@ -457,7 +457,7 @@ var
    begin
    result := -1;
    Inc(Current);
-   while (result = -1) and (Current < Len) do 
+   while (result = -1) and (Current <= Len) do
      begin
        if S[Current] in ['0'..'9'] then 
           begin