Autor Beitrag
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Mi 18.06.03 11:59 
Hi,

ich hab ein riesen problem mit dem Advance Database SQL System...

wenn ich mit:
ausblenden Delphi-Quelltext
1:
Query.SQL.Text:='UPDATE Bla SET Mem='''xxxxxxxx...xxxxxxxx''' WHERE ID=11					


mache, und für xxx einen Text mit etwas mehr als 1000 Zeichen einsetze, bekomme ich folgende Fehlermeldung:

user defined image

Am Text inhalt liegt es nicht, ich hab es auch schon mit 1000 X'en versucht, klappt genausowenig... (Der FeldTyp in der DB ist Memo)

Hat irgendwer ne ahnung woran das liegt???

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Mi 18.06.03 12:03 
Hallo,

ja, das problem ist bekannt. Du kannst in einer normalen Updateanweisung halt nicht beliebig viele Zeichen übergeben. Meistens steht das auch irgendwo, wieviele zeichen das sind....

Als ein recht gutes workaraound empfiehlt sich eine stored procedure..
Gruß
Ken
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Mi 18.06.03 12:08 
Hi,

CenBells hat folgendes geschrieben:
Als ein recht gutes workaraound empfiehlt sich eine stored procedure..

Was ist das???

Aber es muß doch gehen das man in ne DB mehr als 1000 Zeichen packt... :roll:

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Mi 18.06.03 12:26 
Aya hat folgendes geschrieben:
Hi,

CenBells hat folgendes geschrieben:
Als ein recht gutes workaraound empfiehlt sich eine stored procedure..

Was ist das???

Aber es muß doch gehen das man in ne DB mehr als 1000 Zeichen packt... :roll:

Au'revoir,
Aya~

Klar geht das. Du kannst nen haufen zeichen in eine spalte eines records packen. Das problem ist nicht daß die DB das nicht kann, sondern, daß du das updatestatement nicht beliebig lang gestalten kannst. Mach es wie gesagt lieber mit einer Stored Procedure (Eine Prozedur die in der Datenbank angelegt wird). Da kannst du die parameter übergabe solang wie du sie benötigst machen.

Gruß
Ken
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Mi 18.06.03 12:30 
Hi,

ich hab ehrlichgesagt noch nich sehr viel ahnung von Datenbanken... = hab Keine ahnung was eine Stored Procedure is (Ok, nu schon nachdem du es erklärt hast *g*) bzw wie ich sowas mache... *guckt hilflos*

Au'revoir,
Aya~

PS: Bitte sei so lieb und antworte so schnell wie möglich.. ist super dringend :?

_________________
Aya
I aim for my endless dreams and I know they will come true!
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Mi 18.06.03 12:37 
also... ich versuche es
eine stored procedure legst du wie gesagt direkt in der Datenbank an. Der BEfehl ist Create Procedure
Such mal danach in der Hilfe zu deiner DB.
Und der Code, der in der stored procedure ausgeführt wird, ist das update statement, welches Du eh in deinem Prog ausführst. Allerdings benötigst du 2 parameter für die stored Procedure und dann kannst du aus deinem Programm mittels komponenten wie TStoredProcedure die Prozedur ausführen.

Gruß
Ken
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Mi 18.06.03 12:51 
Hi,

mh... ok... aber der will da beim CREATE PROCEDURE am ende einen Dateinamen von einer *.AEP Datei in welcher die Procedure drin ist... wie erstelle ich die datei???

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Mi 18.06.03 12:54 
huhu nochma ;)

ok.. hab nun sone Stored Procedure angelegt.. aber was bringt mir das jetzt???

Ich hab als Input Name "Text" und als Typ "Memo" genommen...
und wie mach ich das jetzt, das er da was in die DB schreibt??? *guckt verwirrt*

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Mi 18.06.03 13:22 
ok, du musst in der procedure ganz normal ein SQL Update Statement ausführen. Du wirst auch noch einen identifier übergeben müssen
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
begin
  Update Bla 
  SET Mem = :Text
  WHERE identifier = :uebergebeneridentifier;
end;



Gruß
Ken

Moderiert von user profile iconMarc: Code-Tag durch Delphi-Tag ersetzt.
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Mi 18.06.03 13:32 
Hi,

mh... ich glaub ich bin blöd... :roll:

Kannst du mir mal erklären was genau ich in der StoredProcedure machen muß???

Ich hab das bisjetzt soweit:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
{* Sample exported Advantage Extended Procedure. If you change the name of this
 * procedure remember to also change the name in the exports list at the bottom
 * of this file. *}

function MyProcedure( ulConnectionID: UNSIGNED32;
                    pusUserName: PChar;
                    pucPassword: PChar;
                    pucProcName: PChar;
                    ulRecNum: UNSIGNED32;
                    pucTable1: PChar;
                    pucTable2: PChar ): UNSIGNED32;
                    {$IFDEF WIN32}stdcall;{$ENDIF}{$IFDEF LINUX}cdecl;{$ENDIF} // Do not change prototype
var
   DM1 : TDM1;
   strTable1 : string;
   strTable2 : string;
   Texte: Array[1..7] of String;
begin

   try
      Result := AE_SUCCESS;

      {* Get this connection's data module from the session manager. *}
      DM1 := TDM1( AEPSessionMgr.GetDM( ulConnectionID ) );

      {* Use the ParamsConn connection to retrieve any input parameters passed
       * to this procedure. ExtractFileName and ExtractFileDir expect the
       * input to be in a native format, so convert if necessary. *}

      {$IFDEF LINUX}
      strTable1 := DosPathToUnixPath( StrPas( pucTable1 ) );
      strTable2 := DosPathToUnixPath( StrPas( pucTable2 ) );
      {$ELSE}
         {$IFDEF ADSDELPHI6_OR_NEWER}
         strTable1 := UnixPathToDosPath( StrPas( pucTable1 ) );
         strTable2 := UnixPathToDosPath( StrPas( pucTable2 ) );
         {$ELSE}
         strTable1 := StrPas( pucTable1 );
         strTable2 := StrPas( pucTable2 );
         {$ENDIF}
      {$ENDIF}

      DM1.ParamsConn.Disconnect;
      if ( Length( strTable1 ) > 0 ) then
         DM1.ParamsConn.ConnectPath := ExtractFileDir( strTable1 )
      else
         DM1.ParamsConn.ConnectPath := ExtractFileDir( strTable2 );

      with DM1 do
      begin
         tblInput.tablename  := ExtractFileName( strTable1 );
         tblOutput.tablename := ExtractFileName( strTable2 );

         {* The code commented out below shows how input parameters may be
          * read. *}

         // tblInput.open;
         // strManufacturer := tblInput.FieldByName( 'mfr' ).Value;
         // strProduct      := tblInput.FieldByName( 'product' ).Value;
         // tblInput.close;
         Texte[1]:=tblInput.FieldByName('Text1').AsString;
         Texte[2]:=tblInput.FieldByName('Text2').AsString;
         Texte[3]:=tblInput.FieldByName('Text3').AsString;
         Texte[4]:=tblInput.FieldByName('Text4').AsString;
         Texte[5]:=tblInput.FieldByName('Text5').AsString;
         Texte[6]:=tblInput.FieldByName('Text6').AsString;
         Texte[7]:=tblInput.FieldByName('Text7').AsString;


         {* Place to business logic of your procedure here. *}
         tblTexte.FieldByName('T1').Value:=Texte[1];
         tblTexte.FieldByName('T2').Value:=Texte[2];
         tblTexte.FieldByName('T3').Value:=Texte[3];
         tblTexte.FieldByName('T4').Value:=Texte[4];
         tblTexte.FieldByName('T5').Value:=Texte[5];
         tblTexte.FieldByName('T6').Value:=Texte[6];
         tblTexte.FieldByName('T7').Value:=Texte[7];

         {* Finally return any output parameters. *}
         // tblOutput.open;
         // tblOutput.append;
         // tblOutput.FieldByName( 'total_price' ).Value := 68.99;
         // tblOutput.post;
         // tblOutput.close;

      end;   {* with DM1 *}

   except
      on E : EADSDatabaseError do
         Result := E.ACEErrorCode;
      on E : Exception do
         {* other error *}
         Result := 1;
   end;

end;


tblTexte ist meine DB wo die 7 Texte reinsollen...
Nur woher weiß der jetzt in welcher Zeile das ganze passieren soll etc bla bla... hab keine ahnung *seufzt*


Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Mi 18.06.03 14:30 
Hat sich erledigt...

hab es hinbekommen ;)

ausblenden Delphi-Quelltext
1:
2:
3:
  Query.SQL.Text:='UPDATE test SET Memo=:T1 WHERE ID=1';
  Query.ParamByName('T1').Value:=Memo.Text;
  Query.ExecSQL;


Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!