Skip to content

Commit 5042e0f

Browse files
committed
update basic example
1 parent 272aa45 commit 5042e0f

File tree

4 files changed

+72
-2
lines changed

4 files changed

+72
-2
lines changed

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,49 @@ services:
3737
```
3838
3939
## isql demo
40+
41+
run the docker-compose example: [basic example](./examples/basic/)
42+
43+
1️⃣ Run the demo
44+
```bash
45+
cd examples/basic/
46+
docker compose down --remove-orphans -v --rmi local && docker compose up
47+
```
48+
49+
2️⃣ Run a basic query
50+
```bash
51+
. /opt/sap/SYBASE.sh && echo -e "select top 10 * from TEST_TABLE\ngo" | isql -Usa -P${SA_PASSWORD} -D${DATABASE}
52+
```
53+
54+
3️⃣ Run isql
4055
```bash
41-
. /opt/sap/SYBASE.sh && echo -e "select top 10 * from <YourTable>\ngo" | isql -Usa -P${SA_PASSWORD} -D${DATABASE}
56+
docker compose exec -it database sh
57+
. /opt/sap/SYBASE.sh
58+
isql -Usa
4259
```
60+
61+
### show databases
62+
```sql
63+
sp_helpdb
64+
go
65+
```
66+
67+
### describe database
68+
```sql
69+
sp_helpdb TESTDB
70+
go
71+
```
72+
73+
### show tables
74+
```sql
75+
use TESTDB
76+
go
77+
sp_tables
78+
go
79+
```
80+
81+
### describe table
82+
```sql
83+
sp_help TEST_TABLE
84+
go
85+
```

examples/basic/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
image: superbeeeeeee/docker-sybase
44
pull_policy: always
55
environment:
6-
- DATABASE=hello
6+
- DATABASE=TESTDB
77
- SA_PASSWORD=Sybase1234
88
volumes:
99
- ./init/:/docker-entrypoint-initdb.d/

examples/basic/init/0-table.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use TESTDB
2+
go
3+
CREATE TABLE dbo.TEST_TABLE (
4+
IDROW numeric(18,0) IDENTITY NOT NULL,
5+
TEST_FIELD1 char(10) NOT NULL,
6+
)
7+
LOCK DATAROWS
8+
WITH exp_row_size = 0, reservepagegap = 0, identity_gap = 500, DML_LOGGING = FULL
9+
ON [default]
10+
GO
11+
CREATE NONCLUSTERED INDEX I1_TEST_TABLE
12+
ON dbo.TEST_TABLE(TEST_FIELD1)
13+
ON [default]
14+
GO
15+
CREATE UNIQUE NONCLUSTERED INDEX UI_TEST_TABLE
16+
ON dbo.TEST_TABLE(IDROW)
17+
ON [default]
18+
GO

examples/basic/init/2-data.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use TESTDB
2+
go
3+
4+
set statistics time ON
5+
6+
insert into dbo.TEST_TABLE(TEST_FIELD1) values ('hello')
7+
insert into dbo.TEST_TABLE(TEST_FIELD1) values ('world')
8+
9+
go

0 commit comments

Comments
 (0)