![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 3 of 3 total |
![]() |
Sun, Feb 23 2014 11:08 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | Hi
Can't work out why the following code fails. I first drop a temporary table in a memory database then I try to create another table with the same name. First time through it works OK presumably because there is no table to drop. The code is as below my signature. ElevateDB v2.14 Build 2, Delphi XE. Cheers Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz ------------------------------------------------------------------ ASLEDBUtils.TableDrop(apmDM.EDBMemory, sTempFileName); apmDM.EDBMemory.Execute('CREATE TABLE "' + sTempFileName + '" ' + '( "TransNo" VARCHAR(6))'); //<<<<<<<<<<<<<<<<<<< ERROR HERE! where apmDM.EDBMemory is a TEDBDatabase pointing to a memorydatabase. sTempFileName is string containing a "unique" tablename. ------------------------------------------------------------------- // This code thanks to Peter Evans on the ElevateDB newsgroups // with mods by me. procedure TableDrop(const ThisDatabase: TEDBDatabase; const ThisTable: String; Temporary: Boolean = True); begin if TableExists(ThisDatabase, ThisTable, Temporary) then ThisDatabase.Execute('DROP TABLE "' + ThisTable + '"'); end; function TableExists(const ThisDatabase: TEDBDatabase; const ThisTable: String; Temporary: Boolean = True): Boolean; begin Result := False; if Temporary then begin if (ThisDatabase.Execute('SELECT * FROM Information.TemporaryTables ' + 'WHERE "Name" = ' + Engine.QuotedSQLStr(ThisTable))) = 1 then Result := True end else if (ThisDatabase.Execute('SELECT * FROM Information.Tables ' + 'WHERE "Name" = ' + Engine.QuotedSQLStr(ThisTable))) = 1 then Result := True; end; --------------------------- Debugger Exception Notification --------------------------- Project apm.exe raised exception class EEDBException with message 'ElevateDB Error #400 The table TEMP00001086 already exists in the schema Default'. --------------------------- Break Continue Help --------------------------- |
Mon, Feb 24 2014 3:15 PM | Permanent Link |
Barry | Jeff,
I think you are confusing Memory tables with Temporary tables. As of v2.13, C/S Memory tables can be seen by all sessions using the same memory database. Temporary tables can only be seen by the session that created them. There are also TEMPORARY MEMORY tables, which I think you are trying to use. But you are forgetting to use "Create TEMPORARY Table <Name>" when using your memory database. (You forgot to use "TEMPORARY" and as a result, you are creating shareable memory tables.) Then you check check the Information.TemporaryTables and of course the table will not appear there because it is not a temporary table. Barry |
Mon, Feb 24 2014 4:01 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | <Barry> wrote in message
news:A613F220-3E49-4BE4-86FE-2078D919168C@news.elevatesoft.com... > > But you are forgetting to use "Create TEMPORARY Table <Name>" when using > your memory database. (You forgot to use "TEMPORARY" and as a result, you > are creating shareable memory tables.) Then you check check the > Information.TemporaryTables and of course the table will not appear there > because it is not a temporary table. > Hi Barry Many thanks! That was it. When I read your reply it was "YES! Of course!" ![]() wasted hours staring at and stepping through _almost_ correct code! Cheers Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz |
This web page was last updated on Monday, July 15, 2024 at 07:03 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |