Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Commit fa6726c

Browse files
Init
1 parent fd432f9 commit fa6726c

13 files changed

+1138
-9
lines changed

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/xdev-swing-framework-template/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/xapi-db-firebird/security/advisories/new).

pom.xml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.xdev-software</groupId>
8-
<artifactId>xdev-swing-framework-template</artifactId>
8+
<artifactId>xapi-db-firebird</artifactId>
99
<version>1.0.0-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

12-
<name>xdev-swing-framework-template</name>
13-
<description>xdev-swing-framework-template</description>
14-
<url>https://github.com/xdev-software/xdev-swing-framework-template</url>
12+
<name>SqlEngine Database Adapter Firebird</name>
13+
<description>XAPI SqlEngine Database Adapter for Firebird</description>
14+
<url>https://github.com/xdev-software/xapi-db-firebird</url>
1515

1616
<scm>
17-
<url>https://github.com/xdev-software/xdev-swing-framework-template</url>
18-
<connection>https://github.com/xdev-software/xdev-swing-framework-template.git</connection>
19-
</scm>
17+
<url>https://github.com/xdev-software/xapi-db-firebird</url>
18+
<connection>https://github.com/xdev-software/xapi-db-firebird.git</connection>
19+
</scm>
2020

2121
<inceptionYear>2023</inceptionYear>
2222

@@ -48,6 +48,9 @@
4848

4949
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5050
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
51+
52+
<xdev.xapi.version>6.0.1</xdev.xapi.version>
53+
<firebird.version>2.2.5</firebird.version>
5154
</properties>
5255

5356
<repositories>
@@ -87,7 +90,19 @@
8790
</distributionManagement>
8891

8992
<dependencies>
90-
93+
<dependency>
94+
<groupId>com.xdev-software</groupId>
95+
<artifactId>xapi</artifactId>
96+
<version>${xdev.xapi.version}</version>
97+
</dependency>
98+
99+
<!-- https://mvnrepository.com/artifact/org.firebirdsql.jdbc/jaybird -->
100+
<dependency>
101+
<groupId>org.firebirdsql.jdbc</groupId>
102+
<artifactId>jaybird</artifactId>
103+
<version>${firebird.version}</version>
104+
<type>pom</type>
105+
</dependency>
91106
</dependencies>
92107

93108
<build>

src/main/java/firebird.png

950 Bytes
Loading
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
package xdev.db.firebird.jdbc;
2+
3+
/*-
4+
* #%L
5+
* Firebird
6+
* %%
7+
* Copyright (C) 2003 - 2023 XDEV Software
8+
* %%
9+
* This program is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as
11+
* published by the Free Software Foundation, either version 3 of the
12+
* License, or (at your option) any later version.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU General Lesser Public License for more details.
18+
*
19+
* You should have received a copy of the GNU General Lesser Public
20+
* License along with this program. If not, see
21+
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
22+
* #L%
23+
*/
24+
25+
import com.xdev.jadoth.sqlengine.dbms.DbmsConnectionInformation;
26+
import xdev.db.ConnectionInformation;
27+
28+
29+
public class FirebirdConnectionInformation extends ConnectionInformation<FirebirdDbms>
30+
{
31+
// /////////////////////////////////////////////////////////////////////////
32+
// constructors //
33+
// ///////////////////
34+
35+
/**
36+
* @param user
37+
* the user
38+
* @param password
39+
* the password
40+
* @param database
41+
* the database
42+
* @param urlExtension
43+
* the extended url properties
44+
* @param dbmsAdaptor
45+
* the dbms adaptor
46+
*/
47+
public FirebirdConnectionInformation(final String host, final int port, final String user,
48+
final String password, final String database, final String urlExtension,
49+
final FirebirdDbms dbmsAdaptor)
50+
{
51+
super(host,port,user,password,database,urlExtension,dbmsAdaptor);
52+
}
53+
54+
55+
// /////////////////////////////////////////////////////////////////////////
56+
// getters //
57+
// ///////////////////
58+
/**
59+
* Gets the database.
60+
*
61+
* @return the database
62+
*/
63+
public String getDatabase()
64+
{
65+
return this.getCatalog();
66+
}
67+
68+
69+
// /////////////////////////////////////////////////////////////////////////
70+
// setters //
71+
// ///////////////////
72+
/**
73+
* Sets the database.
74+
*
75+
* @param database
76+
* the database to set
77+
*/
78+
public void setDatabase(final String database)
79+
{
80+
this.setCatalog(database);
81+
}
82+
83+
84+
// /////////////////////////////////////////////////////////////////////////
85+
// override methods //
86+
// ///////////////////
87+
/**
88+
* @see DbmsConnectionInformation#createJdbcConnectionUrl()
89+
*/
90+
@Override
91+
public String createJdbcConnectionUrl()
92+
{
93+
String url = "jdbc:firebirdsql:" + getHost() + "/" + getPort() + ":" + getCatalog();
94+
return appendUrlExtension(url);
95+
}
96+
97+
98+
/**
99+
* @see com.xdev.jadoth.sqlengine.dbms.DbmsConnectionInformation#getJdbcDriverClassName()
100+
*/
101+
@Override
102+
public String getJdbcDriverClassName()
103+
{
104+
return "org.firebirdsql.jdbc.FBDriver";
105+
}
106+
107+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package xdev.db.firebird.jdbc;
2+
3+
/*-
4+
* #%L
5+
* Firebird
6+
* %%
7+
* Copyright (C) 2003 - 2023 XDEV Software
8+
* %%
9+
* This program is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as
11+
* published by the Free Software Foundation, either version 3 of the
12+
* License, or (at your option) any later version.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU General Lesser Public License for more details.
18+
*
19+
* You should have received a copy of the GNU General Lesser Public
20+
* License along with this program. If not, see
21+
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
22+
* #L%
23+
*/
24+
25+
import com.xdev.jadoth.sqlengine.dbms.standard.StandardDDLMapper;
26+
27+
28+
public class FirebirdDDLMapper extends StandardDDLMapper<FirebirdDbms>
29+
{
30+
protected FirebirdDDLMapper(final FirebirdDbms dbmsAdaptor)
31+
{
32+
super(dbmsAdaptor);
33+
}
34+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package xdev.db.firebird.jdbc;
2+
3+
import com.xdev.jadoth.sqlengine.SELECT;
4+
import com.xdev.jadoth.sqlengine.dbms.standard.StandardDMLAssembler;
5+
6+
7+
/*-
8+
* #%L
9+
* Firebird
10+
* %%
11+
* Copyright (C) 2003 - 2023 XDEV Software
12+
* %%
13+
* This program is free software: you can redistribute it and/or modify
14+
* it under the terms of the GNU Lesser General Public License as
15+
* published by the Free Software Foundation, either version 3 of the
16+
* License, or (at your option) any later version.
17+
*
18+
* This program is distributed in the hope that it will be useful,
19+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
* GNU General Lesser Public License for more details.
22+
*
23+
* You should have received a copy of the GNU General Lesser Public
24+
* License along with this program. If not, see
25+
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
26+
* #L%
27+
*/
28+
public class FirebirdDMLAssembler extends StandardDMLAssembler<FirebirdDbms>
29+
{
30+
public FirebirdDMLAssembler(final FirebirdDbms dbms)
31+
{
32+
super(dbms);
33+
}
34+
35+
36+
@Override
37+
protected StringBuilder assembleSelectRowLimit(
38+
SELECT query, StringBuilder sb, int flags,
39+
String clauseSeperator, String newLine, int indentLevel)
40+
{
41+
Integer skip = query.getOffsetSkipCount();
42+
Integer range = query.getFetchFirstRowCount();
43+
44+
if(range != null)
45+
{
46+
if(skip != null)
47+
{
48+
sb.append(newLine).append(clauseSeperator).append("ROWS ").append(skip)
49+
.append(" TO ").append(skip + range - 1);
50+
}
51+
else
52+
{
53+
sb.append(newLine).append(clauseSeperator).append("ROWS 1 TO ").append(range);
54+
}
55+
}
56+
else if(skip != null)
57+
{
58+
sb.append(newLine).append(clauseSeperator).append("ROWS ").append(skip).append(" TO ")
59+
.append(Integer.MAX_VALUE);
60+
}
61+
62+
return sb;
63+
}
64+
}

0 commit comments

Comments
 (0)