What would be the eqivalent of show tables from MySQL in Kotlin ExposedHow to find all the tables in MySQL with specific column names in them?What is the best collation to use for MySQL with PHP?Duplicating a MySQL table, indices, and dataHow to import CSV file to MySQL tableInsert into a MySQL table or update if existsUpdate one MySQL table with values from anotherHow to get the sizes of the tables of a MySQL database?What is the equivalent of Java static methods in Kotlin?Kotlin - Exposed DAO: Parameter specified as non-null is null [..] (parameter id)How to create an index on foreign keys with kotlin exposed on a PostgreSQL database
Can't remember the name of this game
Employer asking for online access to bank account - Is this a scam?
Why do airplanes use an axial flow jet engine instead of a more compact centrifugal jet engine?
Integrating an absolute function using Mathematica
Employer demanding to see degree after poor code review
Does this degree 12 genus 1 curve have only one point over infinitely many finite fields?
How can people dance around bonfires on Lag Lo'Omer - it's darchei emori?
Command to Search for Filenames Exceeding 143 Characters?
How bitcoin nodes update UTXO set when their latests blocks are replaced?
What are the benefits of cryosleep?
Would the Geas spell work in a dead magic zone once you enter it?
What are these arcade games in Ghostbusters 1984?
Why are C64 games inconsistent with which joystick port they use?
How do I align equations in three columns, justified right, center and left?
When do characters level up?
Where did Wilson state that the US would have to force access to markets with violence?
Apparent Ring of Craters on the Moon
How strong are Wi-Fi signals?
Under what law can the U.S. arrest International Criminal Court (ICC) judges over war crimes probe?
Rests in pickup measure (anacrusis)
Mother abusing my finances
How to convert to standalone document a matrix table
Riley Rebuses that Share a Common Theme
Placing bypass capacitors after VCC reaches the IC
What would be the eqivalent of show tables from MySQL in Kotlin Exposed
How to find all the tables in MySQL with specific column names in them?What is the best collation to use for MySQL with PHP?Duplicating a MySQL table, indices, and dataHow to import CSV file to MySQL tableInsert into a MySQL table or update if existsUpdate one MySQL table with values from anotherHow to get the sizes of the tables of a MySQL database?What is the equivalent of Java static methods in Kotlin?Kotlin - Exposed DAO: Parameter specified as non-null is null [..] (parameter id)How to create an index on foreign keys with kotlin exposed on a PostgreSQL database
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Trying out Kotlin Exposed for the first time. I have been able to learn Kotlin to a reasonable extent now and now I'm trying to learn Kotlin Exposed API for database access. But I'm unable to find an equivalent for SHOW tables;
of MySQL.
It would be nice to be able to list out tables without previously hard coding them into the program.
Is there an equivalent to that query in Exposed? if so how? Thanks in advance
mysql kotlin kotlin-exposed
add a comment |
Trying out Kotlin Exposed for the first time. I have been able to learn Kotlin to a reasonable extent now and now I'm trying to learn Kotlin Exposed API for database access. But I'm unable to find an equivalent for SHOW tables;
of MySQL.
It would be nice to be able to list out tables without previously hard coding them into the program.
Is there an equivalent to that query in Exposed? if so how? Thanks in advance
mysql kotlin kotlin-exposed
if I may ask, why do you want to list the db tables from within the code?
– euniceadu
Mar 24 at 9:14
I want to write extensible code that would automatically create pages for each individual table, and a navbar with the list of tables. so when the application loads I want to populate the list of tables dynamically from the database. the database will change anytime and tables may get added in the future
– Deepan
Mar 24 at 10:52
add a comment |
Trying out Kotlin Exposed for the first time. I have been able to learn Kotlin to a reasonable extent now and now I'm trying to learn Kotlin Exposed API for database access. But I'm unable to find an equivalent for SHOW tables;
of MySQL.
It would be nice to be able to list out tables without previously hard coding them into the program.
Is there an equivalent to that query in Exposed? if so how? Thanks in advance
mysql kotlin kotlin-exposed
Trying out Kotlin Exposed for the first time. I have been able to learn Kotlin to a reasonable extent now and now I'm trying to learn Kotlin Exposed API for database access. But I'm unable to find an equivalent for SHOW tables;
of MySQL.
It would be nice to be able to list out tables without previously hard coding them into the program.
Is there an equivalent to that query in Exposed? if so how? Thanks in advance
mysql kotlin kotlin-exposed
mysql kotlin kotlin-exposed
asked Mar 24 at 7:23
DeepanDeepan
478
478
if I may ask, why do you want to list the db tables from within the code?
– euniceadu
Mar 24 at 9:14
I want to write extensible code that would automatically create pages for each individual table, and a navbar with the list of tables. so when the application loads I want to populate the list of tables dynamically from the database. the database will change anytime and tables may get added in the future
– Deepan
Mar 24 at 10:52
add a comment |
if I may ask, why do you want to list the db tables from within the code?
– euniceadu
Mar 24 at 9:14
I want to write extensible code that would automatically create pages for each individual table, and a navbar with the list of tables. so when the application loads I want to populate the list of tables dynamically from the database. the database will change anytime and tables may get added in the future
– Deepan
Mar 24 at 10:52
if I may ask, why do you want to list the db tables from within the code?
– euniceadu
Mar 24 at 9:14
if I may ask, why do you want to list the db tables from within the code?
– euniceadu
Mar 24 at 9:14
I want to write extensible code that would automatically create pages for each individual table, and a navbar with the list of tables. so when the application loads I want to populate the list of tables dynamically from the database. the database will change anytime and tables may get added in the future
– Deepan
Mar 24 at 10:52
I want to write extensible code that would automatically create pages for each individual table, and a navbar with the list of tables. so when the application loads I want to populate the list of tables dynamically from the database. the database will change anytime and tables may get added in the future
– Deepan
Mar 24 at 10:52
add a comment |
2 Answers
2
active
oldest
votes
There is VendorDialect.allTableNames()
function in Exposed which uses jdbc DatabaseMetadata
to fetch tables.
Database.connect() // your connection string
transaction
val tableNames = TransactionManager.current().db.dialect.allTableNames()
add a comment |
From what I've seen in the documentation and the source code so far, the fetchAllTables method in the SchemaUtils class is private so your best option will be to execute a MySQL query. The code below does what you want:
val connect = Database.Companion.connect(dataSource())
val tableNames = mutableListOf<String>()
transaction
val conn = TransactionManager.current().connection
val statement = conn.createStatement()
val query = "show tables"
statement.execute(query)
val results = statement.resultSet
while (results.next())
tableNames.add(results.getString(1))
tableNames.forEach
println(it)
I understand. I just have to use the normal piece of code instead of Exposed. I hope there's a way to do this in exposed. because I might want to construct the DAO dynamically too usingdescribe;
– Deepan
Mar 24 at 12:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321578%2fwhat-would-be-the-eqivalent-of-show-tables-from-mysql-in-kotlin-exposed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is VendorDialect.allTableNames()
function in Exposed which uses jdbc DatabaseMetadata
to fetch tables.
Database.connect() // your connection string
transaction
val tableNames = TransactionManager.current().db.dialect.allTableNames()
add a comment |
There is VendorDialect.allTableNames()
function in Exposed which uses jdbc DatabaseMetadata
to fetch tables.
Database.connect() // your connection string
transaction
val tableNames = TransactionManager.current().db.dialect.allTableNames()
add a comment |
There is VendorDialect.allTableNames()
function in Exposed which uses jdbc DatabaseMetadata
to fetch tables.
Database.connect() // your connection string
transaction
val tableNames = TransactionManager.current().db.dialect.allTableNames()
There is VendorDialect.allTableNames()
function in Exposed which uses jdbc DatabaseMetadata
to fetch tables.
Database.connect() // your connection string
transaction
val tableNames = TransactionManager.current().db.dialect.allTableNames()
edited Mar 25 at 19:01
answered Mar 24 at 16:18
TapacTapac
24616
24616
add a comment |
add a comment |
From what I've seen in the documentation and the source code so far, the fetchAllTables method in the SchemaUtils class is private so your best option will be to execute a MySQL query. The code below does what you want:
val connect = Database.Companion.connect(dataSource())
val tableNames = mutableListOf<String>()
transaction
val conn = TransactionManager.current().connection
val statement = conn.createStatement()
val query = "show tables"
statement.execute(query)
val results = statement.resultSet
while (results.next())
tableNames.add(results.getString(1))
tableNames.forEach
println(it)
I understand. I just have to use the normal piece of code instead of Exposed. I hope there's a way to do this in exposed. because I might want to construct the DAO dynamically too usingdescribe;
– Deepan
Mar 24 at 12:04
add a comment |
From what I've seen in the documentation and the source code so far, the fetchAllTables method in the SchemaUtils class is private so your best option will be to execute a MySQL query. The code below does what you want:
val connect = Database.Companion.connect(dataSource())
val tableNames = mutableListOf<String>()
transaction
val conn = TransactionManager.current().connection
val statement = conn.createStatement()
val query = "show tables"
statement.execute(query)
val results = statement.resultSet
while (results.next())
tableNames.add(results.getString(1))
tableNames.forEach
println(it)
I understand. I just have to use the normal piece of code instead of Exposed. I hope there's a way to do this in exposed. because I might want to construct the DAO dynamically too usingdescribe;
– Deepan
Mar 24 at 12:04
add a comment |
From what I've seen in the documentation and the source code so far, the fetchAllTables method in the SchemaUtils class is private so your best option will be to execute a MySQL query. The code below does what you want:
val connect = Database.Companion.connect(dataSource())
val tableNames = mutableListOf<String>()
transaction
val conn = TransactionManager.current().connection
val statement = conn.createStatement()
val query = "show tables"
statement.execute(query)
val results = statement.resultSet
while (results.next())
tableNames.add(results.getString(1))
tableNames.forEach
println(it)
From what I've seen in the documentation and the source code so far, the fetchAllTables method in the SchemaUtils class is private so your best option will be to execute a MySQL query. The code below does what you want:
val connect = Database.Companion.connect(dataSource())
val tableNames = mutableListOf<String>()
transaction
val conn = TransactionManager.current().connection
val statement = conn.createStatement()
val query = "show tables"
statement.execute(query)
val results = statement.resultSet
while (results.next())
tableNames.add(results.getString(1))
tableNames.forEach
println(it)
answered Mar 24 at 11:25
euniceadueuniceadu
6831531
6831531
I understand. I just have to use the normal piece of code instead of Exposed. I hope there's a way to do this in exposed. because I might want to construct the DAO dynamically too usingdescribe;
– Deepan
Mar 24 at 12:04
add a comment |
I understand. I just have to use the normal piece of code instead of Exposed. I hope there's a way to do this in exposed. because I might want to construct the DAO dynamically too usingdescribe;
– Deepan
Mar 24 at 12:04
I understand. I just have to use the normal piece of code instead of Exposed. I hope there's a way to do this in exposed. because I might want to construct the DAO dynamically too using
describe;
– Deepan
Mar 24 at 12:04
I understand. I just have to use the normal piece of code instead of Exposed. I hope there's a way to do this in exposed. because I might want to construct the DAO dynamically too using
describe;
– Deepan
Mar 24 at 12:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321578%2fwhat-would-be-the-eqivalent-of-show-tables-from-mysql-in-kotlin-exposed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
if I may ask, why do you want to list the db tables from within the code?
– euniceadu
Mar 24 at 9:14
I want to write extensible code that would automatically create pages for each individual table, and a navbar with the list of tables. so when the application loads I want to populate the list of tables dynamically from the database. the database will change anytime and tables may get added in the future
– Deepan
Mar 24 at 10:52