Skip to content

Commit

Permalink
实现数据库异步化
Browse files Browse the repository at this point in the history
  • Loading branch information
codefollower committed Mar 17, 2016
1 parent ebd5344 commit d294227
Show file tree
Hide file tree
Showing 63 changed files with 2,262 additions and 988 deletions.
2 changes: 1 addition & 1 deletion lealone-client/pom.xml
Expand Up @@ -31,7 +31,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.lealone</groupId> <groupId>org.lealone</groupId>
<artifactId>lealone-common</artifactId> <artifactId>lealone-net</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
Expand Down
Expand Up @@ -25,8 +25,8 @@
import org.lealone.db.Command; import org.lealone.db.Command;
import org.lealone.db.CommandParameter; import org.lealone.db.CommandParameter;
import org.lealone.db.result.Result; import org.lealone.db.result.Result;
import org.lealone.db.value.Transfer;
import org.lealone.db.value.Value; import org.lealone.db.value.Value;
import org.lealone.net.Transfer;


public class ClientBatchCommand implements Command { public class ClientBatchCommand implements Command {
private ClientSession session; private ClientSession session;
Expand Down Expand Up @@ -96,7 +96,7 @@ public int update() {
transfer.writeInt(size); transfer.writeInt(size);
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
transfer.writeString(batchCommands.get(i)); transfer.writeString(batchCommands.get(i));
session.done(transfer); transfer.flush();


for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
result[i] = transfer.readInt(); result[i] = transfer.readInt();
Expand All @@ -114,7 +114,7 @@ public int update() {
for (int m = 0; m < len; m++) for (int m = 0; m < len; m++)
transfer.writeValue(values[m]); transfer.writeValue(values[m]);
} }
session.done(transfer); transfer.flush();


for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
result[i] = transfer.readInt(); result[i] = transfer.readInt();
Expand Down Expand Up @@ -159,4 +159,13 @@ public Result getMetaData() {
public int[] getResult() { public int[] getResult() {
return result; return result;
} }

@Override
public Command prepare() {
return this;
}

@Override
public void setConnectionId(int connectionId) {
}
} }

0 comments on commit d294227

Please sign in to comment.