浏览代码

* Patch from Luiz Americo to fix a double pathdelim in filename, bug #16737

git-svn-id: trunk@15499 -
joost 15 年之前
父节点
当前提交
f016c79d7a

+ 2 - 2
packages/fcl-db/tests/dbftoolsunit.pas

@@ -112,12 +112,12 @@ procedure TDBFDBConnector.DropNDatasets;
 var n : integer;
 begin
   for n := 0 to MaxDataSet do
-    DeleteFile(ExtractFilePath(dbname)+PathDelim+'fpdev_'+inttostr(n)+'.db');
+    DeleteFile(ExtractFilePath(dbname)+'fpdev_'+inttostr(n)+'.db');
 end;
 
 procedure TDBFDBConnector.DropFieldDataset;
 begin
-  DeleteFile(ExtractFilePath(dbname)+PathDelim+'fpdev_field.db');
+  DeleteFile(ExtractFilePath(dbname)+'fpdev_field.db');
 end;
 
 function TDBFDBConnector.InternalGetNDataset(n: integer): TDataset;

+ 5 - 0
packages/fcl-db/tests/sqldbtoolsunit.pas

@@ -147,6 +147,11 @@ begin
     UserName := dbuser;
     Password := dbpassword;
     HostName := dbhostname;
+    if length(dbQuoteChars)>1 then
+      begin
+      FieldNameQuoteChars[0] := dbQuoteChars[1];
+      FieldNameQuoteChars[1] := dbQuoteChars[2];
+      end;
     open;
     end;
 end;

+ 10 - 19
packages/fcl-db/tests/testfieldtypes.pas

@@ -770,6 +770,10 @@ begin
 
     ShortDateFormat := 'yyyy-mm-dd';
 
+    // There is no Param.AsFixedChar, so the datatype has to be set manually
+    if ADatatype=ftFixedChar then
+      Params.ParamByName('field1').DataType := ftFixedChar;
+
     for i := 0 to testValuesCount -1 do
       begin
       Params.ParamByName('id').AsInteger := i;
@@ -801,13 +805,7 @@ begin
         ftInteger: AssertEquals(testIntValues[i],FieldByName('FIELD1').AsInteger);
         ftFloat  : AssertEquals(testFloatValues[i],FieldByName('FIELD1').AsFloat);
         ftBCD    : AssertEquals(testBCDValues[i],FieldByName('FIELD1').AsCurrency);
-        ftFixedChar :
-                   begin
-                   if FieldByName('FIELD1').isnull then
-                     AssertEquals(testStringValues[i],FieldByName('FIELD1').AsString)
-                   else
-                     AssertEquals(PadRight(testStringValues[i],10),FieldByName('FIELD1').AsString);
-                   end;
+        ftFixedChar : AssertEquals(PadRight(testStringValues[i],10),FieldByName('FIELD1').AsString);
         ftString : AssertEquals(testStringValues[i],FieldByName('FIELD1').AsString);
         ftdate   : AssertEquals(testDateValues[i],FormatDateTime('yyyy/mm/dd',FieldByName('FIELD1').AsDateTime));
       else
@@ -1320,18 +1318,11 @@ procedure TTestFieldTypes.TestNumericNames;
 begin
   with TSQLDBConnector(DBConnector) do
     begin
-    if not (SQLDbType in MySQLdbTypes) then
-      Connection.ExecuteDirect('create table FPDEV2 (         ' +
-                                '  "2ID" INT NOT NULL            , ' +
-                                '  "3TEST" VARCHAR(10),     ' +
-                                '  PRIMARY KEY ("2ID")           ' +
-                                ')                            ')
-    else
-      Connection.ExecuteDirect('create table FPDEV2 (         ' +
-                                '  2ID INT NOT NULL            , ' +
-                                '  3TEST VARCHAR(10),     ' +
-                                '  PRIMARY KEY (2ID)           ' +
-                                ')                            ');
+    Connection.ExecuteDirect('create table FPDEV2 (         ' +
+                              '  '+connection.FieldNameQuoteChars[0]+'2ID'+connection.FieldNameQuoteChars[1]+' INT NOT NULL, ' +
+                              '  '+connection.FieldNameQuoteChars[0]+'3TEST'+connection.FieldNameQuoteChars[1]+' VARCHAR(10), ' +
+                              '  PRIMARY KEY ('+connection.FieldNameQuoteChars[0]+'2ID'+connection.FieldNameQuoteChars[0]+') ' +
+                              ')                            ');
 // Firebird/Interbase need a commit after a DDL statement. Not necessary for the other connections
     TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
     with query do

+ 4 - 2
packages/fcl-db/tests/toolsunit.pas

@@ -162,7 +162,8 @@ var dbtype,
     dbname,
     dbuser,
     dbhostname,
-    dbpassword     : string;
+    dbpassword,
+    dbQuoteChars   : string;
     DataEvents     : string;
     DBConnector    : TDBConnector;
     testValues     : Array [TFieldType,0..testvaluescount -1] of string;
@@ -242,6 +243,7 @@ begin
   dbhostname := IniFile.ReadString(dbtype,'Hostname','');
   dbpassword := IniFile.ReadString(dbtype,'Password','');
   dbconnectorparams := IniFile.ReadString(dbtype,'ConnectorParams','');
+  dbquotechars := IniFile.ReadString(dbtype,'QuoteChars','');
 
   IniFile.Free;
 end;
@@ -253,6 +255,7 @@ begin
   if DBConnectorRefCount>0 then exit;
   testValues[ftString] := testStringValues;
   testValues[ftFixedChar] := testStringValues;
+  testValues[ftDate] := testDateValues;
   for i := 0 to testValuesCount-1 do
     begin
     testValues[ftFloat,i] := FloatToStr(testFloatValues[i]);
@@ -266,7 +269,6 @@ begin
     testValues[ftCurrency,i] := CurrToStr(testCurrencyValues[i]);
     // DecimalSeparator:='.';
     testValues[ftBCD,i] := CurrToStr(testCurrencyValues[i]);
-    testValues[ftDate,i] := DateToStr(StrToDate(testDateValues[i], 'yyyy/mm/dd', '-'));
     end;
 
   if dbconnectorname = '' then raise Exception.Create('There is no db-connector specified');