Arsip: Temporary Table

 
user image
more 18 years ago

Manz

Dewa, Mbah n sajabana lah ... nanya deui yeuhh Kan di MySQL 5 itu ada create table temporary... dan kata MySQL documentation itu, katanya bakal autoremove pada saat koneksi terputus. Nah, sekarang gimana caranya kita akses table itu sebagai design di delphi. Soalnya udah aku coba, ternyata dibuat di memory, jadi pada saat create dia ada dimemory dan seteleh disconnect dia menghilang... Secara fisik dilihat dari db-table-listnya gak muntjul ... Soalnya, aku mau buat report yang menggunakan table based, bukan query-based, karena banyak itu ini ini itu nya... dan juga dipergunakan untuk buanyak users. Mungkin yang laen pernah embuat kayak begieu ??? Kalo pernah, sharing donk kumaha carana ... tararengkiu ... :mrgreen: ... ide-ku gak kepikiran soale lampunya petjah dan listriknya mateee, jadi gak punya ide :mrgreen:
user image
more 18 years ago

Manz

Angkat lagiiii.... Dolong Tong ... eh Tolong Dong ..... :mrgreen:
user image
more 18 years ago

zieborg

Nah, sekarang gimana caranya kita akses table itu sebagai design di delphi. Soalnya udah aku coba, ternyata dibuat di memory, jadi pada saat create dia ada dimemory dan seteleh disconnect dia menghilang... Secara fisik dilihat dari db-table-listnya gak muntjul ...
@manz_delphi: emang yang namanya temporary table itu begono dari pabriknya, ni kutipan dari mysql help: You can use the TEMPORARY keyword when creating a table. A TEMPORARY table is visible only to the current connection, and is dropped automatically when the connection is closed. This means that two different connections can use the same temporary table name without conflicting with each other or with an existing non-TEMPORARY table of the same name. (The existing table is hidden until the temporary table is dropped.) To create temporary tables, you must have the CREATE TEMPORARY TABLES privilege jadi yan ga bisa dipake saat design time, bisanya saat run time. kebetulan saya juga banyak pake temporary table (MSSQL), baik utk proses laporan ataupun yg lain, prinsipnya juga sama dg MySQL. Untuk design ada beberapa caranaya : 1. Place Table component, set connection properties, open fields editor, add new field, choose data on field type radio button. (field name and other properties must exactly the same with the temporary table that we want to create in the future) After this you can do the report designer based on this table. 2. Create an empty table that exactly have the same structure with our future temporary tables, use this table for the design time. Kedua cara di atas, pada saat run time nama tablenya kita ganti dengan table temporary yang kita buat. contoh kode :

procedure TForm1.Button1Click(Sender: TObject);
var
  qry : TADOQuery;
begin
  qry := TAdoquery.Create(nil);
  qry.Connection := ADOConnection1;
  try
    qry.SQL.Add('CREATE TEMPORARY TABLE MyTmpTable SELECT * FROM Table1;');
    qry.ExecSQL ;
  finally
    qry.Free ;
  end;
  ADOTable1.close;
  ADOTable1.TableName := 'MyTmpTable';
  ADOTable1.Open;
  ADOTable1.Append ;
  ADOTable1.Fields[0].AsString :='001'; //nip
  ADOTable1.Fields[1].AsString :='Arjuna'; //name
  ADOTable1.post;
end;
3. Atau pake komponen Memory table (kbmMemtable is the best IMO). good luck
user image
more 18 years ago

cyber_hecker

whew.. baru tau nih. selama ini aku gak menyadari kalo ada fasilitas yang begitu powerful di mySQL. sebagai tambahan untuk referensi. untuk membuat tabel temporary dan memasukkan datanya langsung ke tabel temporary berdasarkan query :
CREATE TEMPORARY TABLE IF NOT EXISTS tmpTest (UNIQUE (ID))
IGNORE SELECT * FROM tb_harga
perintah diatas berfungsi untuk membuat tabel dan memindahkan datanya. jika data udah ada, dan perintah kita jalankan kembali tidak akan terjadi duplikasi lagi. sip.. sip.. ;) besok kalo mbikin laporan pake cara ini aja ah.. lebih keren :D
more ...
  • Pages:
  • 1
Share to

AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com