Ну типа Java 8 SE
PHP Code:
import java.io.*;
import java.sql.*;
import java.util.*;
public class Hello {
public static void connect() {
Connection conn = null;
try {
String url = "jdbc:sqlite:./pro.db";
conn = DriverManager.getConnection(url);
System.out.println("Connection to SQLite has been established.");
Statement st = conn.createStatement();
ResultSet r = st.executeQuery("SELECT xtime,brief FROM pro ORDER BY xtime");
while(r.next()) {
String t = r.getString("xtime");
String s = r.getString("brief");
System.out.println(t+" "+s);
};
r.close();
st.close();
} catch (SQLException e) {
System.out.println(e.getMessage());
};
try {
if (conn != null) conn.close();
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
static public void main(String[] v) {
System.out.println("Hello!"); connect();
}
}
ну типа C#: ( под Mono на Linux )
PHP Code:
using System;
using Mono.Data.Sqlite;
using SQLiteCommand = Mono.Data.Sqlite.SqliteCommand;
using SQLiteDataReader = Mono.Data.Sqlite.SqliteDataReader;
using SQLiteConnection = Mono.Data.Sqlite.SqliteConnection;
using SQLiteException = Mono.Data.Sqlite.SqliteException;
using SQLiteParameter = Mono.Data.Sqlite.SqliteParameter;
using SQLiteTransaction = Mono.Data.Sqlite.SqliteTransaction;
class Baby {
static void Main() {
Console.WriteLine("SQLite Example");
SQLiteConnection m=new SQLiteConnection("Data Source=pro.db;Version=3;");
m.Open();
string sql="select brief from pro";
SQLiteCommand cmd = new SQLiteCommand(sql, m);
SQLiteDataReader reader = cmd.ExecuteReader();
bool rr=reader.Read();
while (rr) {
String z=reader.GetString(0);
rr=reader.Read();
Console.WriteLine(z);
};
m.Close();
}
}
Ну типа Python 2
PHP Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3
conn = sqlite3.connect('pro.db')
c = conn.cursor()
for row in c.execute("select brief,xtime from pro order by xtime desc"):
brief = row[0]
xtime = row[1]
print xtime+" "+brief
c.close()
conn.close()
Но за что боролись-то ?
C# придумали , чтобы писать вместо "string" вместо "String" ?
А Python придумали чтобы вообще ни "string" ни "String" не писать ?????
Правда в Python ту дурь ещё короче можно написать:
PHP Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3
conn = sqlite3.connect('pro.db')
for row in conn.execute("select brief,xtime from pro order by xtime desc"):
brief = row[0]
xtime = row[1]
print xtime+" "+brief
conn.close()