提交 1850771e authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 31cd70c4
......@@ -2657,7 +2657,7 @@ In addition to the settings already described (cipher, file_lock, ifexists, user
Custom File Access Mode
@features_1271_p
Usually, the database opens log, data and index files with the access mode 'rw', meaning read-write (except for read only databases, where the mode 'r' is used). Also supported are 'rws' and 'rwd'. The access mode used for log files is set via ACCESS_MODE_LOG; for data and index files use ACCESS_MODE_DATA. These settings must be specified in the database URL:
Usually, the database opens log, data and index files with the access mode 'rw', meaning read-write (except for read only databases, where the mode 'r' is used). To open a database in read-only mode if the files are not read-only, use ACCESS_MODE_DATA=r. Also supported are 'rws' and 'rwd'. The access mode used for log files is set via ACCESS_MODE_LOG; for data and index files use ACCESS_MODE_DATA. These settings must be specified in the database URL:
@features_1272_p
For more information see <a href="advanced.html#durability_problems">Durability Problems</a> . On many operating systems the access mode 'rws' does not guarantee that the data is written to the disk.
......
......@@ -2659,7 +2659,7 @@ VMが終了した時、データベースを終了しない
カスタムファイル アクセスモード
@features_1271_p
通常、データベースはログ、データとインデックスファイルを、アクセスモード "rw" で開きます。read-write (モード "r" が使われている読み取り専用データベースは除く) という意味です。"rws" と "rwd" もサポートしています。ログファイルに使用されるアクセスモードは、ACCESS_MODE_LOG を通して設定されます; データとインデックスファイルには、ACCESS_MODE_DATA を使用してください。これらの設定は、データベースURLで指定されなくてはいけません:
#Usually, the database opens log, data and index files with the access mode 'rw', meaning read-write (except for read only databases, where the mode 'r' is used). To open a database in read-only mode if the files are not read-only, use ACCESS_MODE_DATA=r. Also supported are 'rws' and 'rwd'. The access mode used for log files is set via ACCESS_MODE_LOG; for data and index files use ACCESS_MODE_DATA. These settings must be specified in the database URL:
@features_1272_p
詳細は <a href="advanced.html#durability_problems">永続性問題</a> をご覧下さい。 多くのオペレーティングシステムでは、アクセスモード "rws" において、データがディスクに書かれていることを保証しません。
......
......@@ -884,7 +884,7 @@ features_1267_p=Some applications (for example OpenOffice.org Base) pass some ad
features_1268_h3=Changing Other Settings when Opening a Connection
features_1269_p=In addition to the settings already described (cipher, file_lock, ifexists, user, password), other database settings can be passed in the database URL. Adding <code>setting\=value</code> at the end of an URL is the same as executing the statement <code>SET setting value</code> just after connecting. For a list of settings supported by this database please see the SQL grammar documentation.
features_1270_h2=Custom File Access Mode
features_1271_p=Usually, the database opens log, data and index files with the access mode 'rw', meaning read-write (except for read only databases, where the mode 'r' is used). Also supported are 'rws' and 'rwd'. The access mode used for log files is set via ACCESS_MODE_LOG; for data and index files use ACCESS_MODE_DATA. These settings must be specified in the database URL\:
features_1271_p=Usually, the database opens log, data and index files with the access mode 'rw', meaning read-write (except for read only databases, where the mode 'r' is used). To open a database in read-only mode if the files are not read-only, use ACCESS_MODE_DATA\=r. Also supported are 'rws' and 'rwd'. The access mode used for log files is set via ACCESS_MODE_LOG; for data and index files use ACCESS_MODE_DATA. These settings must be specified in the database URL\:
features_1272_p=For more information see <a href\="advanced.html\#durability_problems">Durability Problems</a> . On many operating systems the access mode 'rws' does not guarantee that the data is written to the disk.
features_1273_h2=Multiple Connections
features_1274_h3=Opening Multiple Databases at the Same Time
......
......@@ -1007,8 +1007,13 @@ public class Function extends Expression implements FunctionCall {
String fieldSeparatorWrite = v3 == null ? null : v3.getString();
String fieldDelimiter = v4 == null ? null : v4.getString();
String escapeCharacter = v5 == null ? null : v5.getString();
Value v6 = getNullOrValue(session, args, 6);
String lineSeparator = v6 == null ? null : v6.getString();
Csv csv = Csv.getInstance();
setCsvDelimiterEscape(csv, fieldSeparatorWrite, fieldDelimiter, escapeCharacter);
if (lineSeparator != null) {
csv.setLineSeparator(lineSeparator);
}
int rows = csv.write(conn, v0.getString(), v1.getString(), charset);
result = ValueInt.get(rows);
break;
......
......@@ -2664,11 +2664,13 @@ CALL CSVREAD('test.csv')
"
"Functions (System)","CSVWRITE","
CSVWRITE(fileNameString, queryString [, charsetString [, fieldSeparatorString [, fieldDelimiterString [, escapeCharacterString]]]]): int
CSVWRITE(fileNameString, queryString [, charsetString [, fieldSeparatorString
[, fieldDelimiterString [, escapeCharacterString [, lineSeparator]]]]): int
","
Writes a CSV (comma separated values).
The file is overwritten if it exists.
The default charset is the default value for this system, and the default field separator is a comma.
The default line separator is the default value for this system ("line.separator" system property).
The returned value is the number or rows written.
Admin rights are required to execute this command.
","
......
......@@ -55,6 +55,7 @@ public class WebServer implements Service {
{ "in", "Indonesia"},
{ "it", "Italiano"},
{ "ja", "\u65e5\u672c\u8a9e"},
{ "nl", "Nederlands"},
{ "pl", "Polski"},
{ "pt_BR", "Portugu\u00eas (Brasil)"},
{ "pt_PT", "Portugu\u00eas (Europeu)"},
......
.translator=Remco Schoen
a.help=Help
a.language=Nederlands
a.lynxNotSupported=Sorry, Lynx wordt nog niet ondersteund
a.password=Wachtwoord
a.remoteConnectionsDisabled=Sorry, externe verbindingen ('webAllowOthers') zijn niet toegelaten voor deze server.
a.title=H2 Console
a.user=Gebruikersnaam
admin.executing=Uitvoeren
admin.ip=IP
admin.lastAccess=Laatste toegang
admin.lastQuery=Laatste query
admin.url=URL
adminAllow=Toegestane clients
adminConnection=Beveiliging verbinding
adminHttp=Gebruik onversleutelde HTTP verbindingen
adminHttps=Gebruik versleutelde SSL (HTTPS) verbindingen
adminLocal=Sta alleen lokale verbindingen toe
adminLogin=Inloggen instellingen
adminLoginCancel=Annuleren
adminLoginOk=OK
adminLogout=Uitloggen
adminOthers=Sta verbindingen vanaf andere computers toe
adminPort=Poortnummer
adminPortWeb=Webserver poortnummer
adminRestart=Wijzigingen worden doorgevoerd na herstarten server
adminSave=Opslaan
adminSessions=Actieve sessies
adminShutdown=Server stoppen
adminTitle=H2 Console instellingen
helpAction=Gebeurtenis
helpAddAnotherRow=Voeg nogmaals een nieuwe regel toe
helpAddDrivers=Toevoegen drivers voor een database
helpAddDriversOnlyJava=ALleen de Java-versie staat het toevoegen van extra drivers toe (deze mogelijkheid is niet ondersteund door de Native-version)
helpAddDriversText=Extra drivers voor een database kunnen worden geregistreerd door het toevoegen van het Jar-bestand van de driver aan de omgevingsvariabelen H2DRIVERS of CLASSPATH. Voorbeeld (Windows)\: om de driver bibliotheek C\:\\Programs\\hsqldb\\lib\\hsqldb.jar toe te voegen, moet de omgevingsvariabele H2DRIVERS op C\:\\Programs\\hsqldb\\lib\\hsqldb.jar gezet worden.
helpAddRow=Voeg een nieuwe regel toe
helpCommandHistory=Toont de geschiedenis van commando's
helpCreateTable=Maak een nieuwe table aan
helpDeleteRow=Verwijder een regel
helpDisconnect=Verbreekt de verbinding met de database
helpDisplayThis=Toont deze helppagina
helpDropTable=Verwijdert de tabel als deze bestaat
helpExecuteCurrent=Voert het huidige SQL-statement uit
helpIcon=Icoon
helpImportantCommands=Belangrijke commando's
helpOperations=Acties
helpQuery=Vraag gegevens op uit de tabel
helpSampleSQL=Voorbeeld SQL-script
helpStatements=SQL-statements
helpUpdate=Verander de gegevens in een rij
helpWithColumnsIdName=met de kolommen ID en NAME
login.connect=Verbind
login.driverClass=Driver klasse
login.driverNotFound=Driver voor database niet gevonden<br />Kijk in de help hoe je drivers kunt toevoegen
login.goAdmin=Instellingen
login.goTools=\#Tools
login.jdbcUrl=JDBC URL
login.language=Taal
login.login=Inloggen
login.remove=Verwijderen
login.save=Opslaan
login.savedSetting=Opgeslagen instellingen
login.settingName=Instellingsnaam
login.testConnection=Test verbinding
login.testSuccessful=Test succesvol
login.welcome=H2 Console
result.1row=1 rij
result.autoCommitOff=Auto commit is nu UIT
result.autoCommitOn=Auto commit is nu AAN
result.maxrowsSet=Het maximum aantal rijen is ingesteld
result.noRows=geen rijen
result.noRunningStatement=Er wordt momenteel geen statement uitgevoerd
result.rows=rijen
result.statementWasCancelled=Het statement is geannuleerd
result.updateCount=Aantal wijzigingen
resultEdit.add=Toevoegen
resultEdit.cancel=Annuleren
resultEdit.delete=Verwijderen
resultEdit.edit=Wijzigen
resultEdit.editResult=Wijzigen
resultEdit.save=Opslaan
toolbar.all=Alle
toolbar.autoCommit=Auto commit
toolbar.autoComplete=Auto aanvullen
toolbar.autoComplete.full=Volledig
toolbar.autoComplete.normal=Normaal
toolbar.autoComplete.off=Uit
toolbar.cancelStatement=Annuleer het huidige statement
toolbar.clear=Wissen
toolbar.commit=Commit
toolbar.disconnect=Verbinding verbreken
toolbar.history=Geschiedenis commando's
toolbar.maxRows=Max rijen
toolbar.refresh=Verversen
toolbar.rollback=Rollback
toolbar.run=Uitvoeren (Ctrl+Enter)
toolbar.sqlStatement=SQL statement
tree.admin=Beheerder
tree.current=Huidige waarde
tree.hashed=Hashed
tree.increment=Ophogen
tree.indexes=Indices
tree.nonUnique=Niet uniek
tree.sequences=Sequenties
tree.unique=Uniek
tree.users=Gebruikers
......@@ -14,7 +14,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.sql.Connection;
......@@ -25,6 +24,8 @@ import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
import org.h2.constant.SysProperties;
import org.h2.message.Message;
import org.h2.util.FileUtils;
import org.h2.util.IOUtils;
import org.h2.util.JdbcUtils;
......@@ -45,9 +46,10 @@ public class Csv implements SimpleRowSource {
private String rowSeparatorWrite;
private char fieldDelimiter = '\"';
private char escapeCharacter = '\"';
private String lineSeparator = SysProperties.LINE_SEPARATOR;
private String fileName;
private Reader reader;
private PrintWriter writer;
private Writer writer;
private int back;
private boolean endOfLine, endOfFile;
......@@ -78,6 +80,8 @@ public class Csv implements SimpleRowSource {
rows++;
}
return rows;
} catch (IOException e) {
throw Message.convertIOException(e, null);
} finally {
close();
JdbcUtils.closeSilently(rs);
......@@ -96,7 +100,7 @@ public class Csv implements SimpleRowSource {
* IOException
*/
public int write(Writer writer, ResultSet rs) throws SQLException, IOException {
this.writer = new PrintWriter(writer);
this.writer = writer;
return writeResultSet(rs);
}
......@@ -223,7 +227,7 @@ public class Csv implements SimpleRowSource {
try {
OutputStream out = new FileOutputStream(fileName);
out = new BufferedOutputStream(out, bufferSize);
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, charset)));
writer = new BufferedWriter(new OutputStreamWriter(out, charset));
} catch (IOException e) {
close();
throw e;
......@@ -231,32 +235,33 @@ public class Csv implements SimpleRowSource {
}
}
private void writeRow(String[] values) {
private void writeRow(String[] values) throws IOException {
for (int i = 0; i < values.length; i++) {
if (i > 0) {
if (fieldSeparatorWrite != null) {
writer.print(fieldSeparatorWrite);
writer.write(fieldSeparatorWrite);
}
}
String s = values[i];
if (s != null) {
if (escapeCharacter != 0) {
if (fieldDelimiter != 0) {
writer.print(fieldDelimiter);
writer.write(fieldDelimiter);
}
writer.print(escape(s));
writer.write(escape(s));
if (fieldDelimiter != 0) {
writer.print(fieldDelimiter);
writer.write(fieldDelimiter);
}
} else {
writer.print(s);
writer.write(s);
}
}
}
if (rowSeparatorWrite != null) {
writer.print(rowSeparatorWrite);
writer.write(rowSeparatorWrite);
}
writer.println();
writer.write(lineSeparator);
}
private String escape(String data) {
......@@ -608,4 +613,13 @@ public class Csv implements SimpleRowSource {
return escapeCharacter;
}
/**
* Set the line separator.
*
* @param lineSeparator the line separator
*/
public void setLineSeparator(String lineSeparator) {
this.lineSeparator = lineSeparator;
}
}
......@@ -149,15 +149,18 @@ java org.h2.test.TestAll timer
long time = System.currentTimeMillis();
TestAll test = new TestAll();
test.printSystem();
/*
Test space re-use
Extend tests that simulate power off (multiple connections, truncate table, drop table, rename objects,...)
Automate real power off tests
Extend tests that simulate power off
timer test
Test space re-use
enforce javadoc comments for constants
Can sometimes not delete log file? need test case
link to new changelog and roadmap, remove pages from google groups
......@@ -173,6 +176,7 @@ Test Recovery with MAX_LOG_FILE_SIZE=1; test with various log file sizes
History:
Roadmap:
......@@ -410,7 +414,7 @@ DROP TABLE MY_TEST;
int todo;
// new TestLogFile().runTest(this);
new TestMemoryUsage().runTest(this);
new TestMultiConn().runTest(this);
new TestMultiDimension().runTest(this);
......@@ -424,10 +428,10 @@ DROP TABLE MY_TEST;
new TestSQLInjection().runTest(this);
new TestSessionsLocks().runTest(this);
new TestSequence().runTest(this);
int todo2;
// new TestSpaceReuse().runTest(this);
new TestSpeed().runTest(this);
new TestTempTables().runTest(this);
new TestTransaction().runTest(this);
......
......@@ -82,10 +82,9 @@ public class TestCsv extends TestBase {
f.delete();
Connection conn = getConnection("csv");
Statement stat = conn.createStatement();
stat.execute("call csvwrite('"+baseDir+"/test.csv', 'select 1 id, ''Hello'' name', null, '|', '')");
stat.execute("call csvwrite('"+baseDir+"/test.csv', 'select 1 id, ''Hello'' name', null, '|', '', null, chr(10))");
FileReader reader = new FileReader(baseDir + "/test.csv");
String text = IOUtils.readStringAndClose(reader, -1).trim();
text = StringUtils.replaceAll(text, "\r", "");
text = StringUtils.replaceAll(text, "\n", " ");
check("ID|NAME 1|Hello", text);
ResultSet rs = stat.executeQuery("select * from csvread('" + baseDir + "/test.csv', null, null, '|', '')");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论