Jump to content

Sqlite3 Hazır Function


pairs
 Share

Recommended Posts

  • Editor
[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 by pairs
Link to comment
Share on other sites

  • Editor

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...