Editor pairs Posted August 18, 2012 Editor Share Posted August 18, 2012 (edited) [center][img]http://img834.imageshack.us/img834/20/sqlitep.png[/img] Öncelikle veritabanını sqlite3 olarak seçiyoruz daha sonrasında bu kodları global functions a yapıştırıyoruz.[/center] [codebox]sqlite = { baglan = function(path) SQLite3Connection, err = SQLite3:connect(path); end, degergir = function(query) SQLite3Cursor, err = SQLite3Connection:execute(query); end, tekdegercek = function(query) SQLite3Cursor, err = SQLite3Connection:execute(query); data = SQLite3Cursor:fetch(); return data; end, tabloisimlerinigetir = function() SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM sqlite_master WHERE type='table'"); deger = SQLite3Cursor:fetch({},"a"); data = {} index = 0; while deger do data[index] = deger.name; deger = SQLite3Cursor:fetch(deger,"a"); index = index + 1; end return data; end, topluvericek = function(table) SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM "..table); al = SQLite3Cursor:fetch({},"a"); tables = {} index = 0; while al do tables[index] = al; index = index + 1; al = SQLite3Cursor:fetch(al,"a"); end return tables; end, rowcount = function(table,column) SQLite3Cursor, err = SQLite3Connection:execute("SELECT count("..column..") FROM "..table); data = SQLite3Cursor:fetch(); return data; end }[/codebox] [center] Kullanımı : Bağlanmak için. [code]sqlite.baglan(dosyayolu);[/code] Değer girmek yada silmek için [code]sqlite.degergir(select & delete & Create & Drop gibi komutlar);[/code] Veritabanından tek bir değer çekecekseniz [code]sqlite.tekdegercek(select komutu);[/code] Veritabanındaki Tablo isimlerini getirmek için. [code]sqlite.tabloisimlerinigetir();[/code] Çoklu veri çekmek için Bu komutta çekilen değerler çoklu geleceği için. data değişkeninden sonra hangi kolondan veri çekecekseniz onu yazmanız lazım örn:data.name gibi. [code]sqlite.topluvericek(tablo ismi);[/code] Kolondaki değer sayısını öğrenmek. [code]sqlite.rowcount(tabloadı,kolonadı);[/code] Arkadaşlar eğer eksik gördüğünüz hatalı buldugunuz.Daha stabil kod bu olabilir dediğiniz kodlar olursa konuya ekleyebiliriz aklıma bu kadar seçenek geldi gayetde geniş oldu.[/center] [center][color=#ff0000][size=5][b].:Download:.[/b][/size][/color][/center] [center][quote]http://yadi.sk/d/sCparL2pKYLp[/quote][/center] Edited August 23, 2012 by pairs Quote Link to comment Share on other sites More sharing options...
ihsansalih Posted August 23, 2012 Share Posted August 23, 2012 (edited) Bununlan ne yapılabilir bir örnek apz verebilrmisin Edited August 23, 2012 by ihsansalih Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted August 23, 2012 Author Editor Share Posted August 23, 2012 Örnek proje eklenmiştir. Quote Link to comment Share on other sites More sharing options...
ihsansalih Posted August 24, 2012 Share Posted August 24, 2012 teşekkürler Quote Link to comment Share on other sites More sharing options...
ihsansalih Posted August 24, 2012 Share Posted August 24, 2012 hocam malesef hata veriyo çalışmıyo acaba neden Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted August 24, 2012 Author Editor Share Posted August 24, 2012 Örnek projeyi kullandınızmı.Birde database bölümünden sqlite3 ü seçmeyi unutmayın. Quote Link to comment Share on other sites More sharing options...
ihsansalih Posted August 25, 2012 Share Posted August 25, 2012 [sub]kullandım dediğiniz bölüm bende zaten işaretli geliyor ama gine hata veriyor[/sub] Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted August 25, 2012 Author Editor Share Posted August 25, 2012 Valla aklıma birşey gelmiyor şuanlık neden hata verdiğine dair.Bende çalışlıyordu başka arkadaşlar varsa deneyen sonuçlarını yazarsa daha iyi olur. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.