RhoMobile initial database - database

Is there a way to setup initial data in a database when using RhoMobile framework?
It is using sqlite database as I see. Is there a way to add a preset sqlite file to the project and make it built in the application bundle?

You can seed the database with a flat file containing the initial data, through the use of the Rho::RhoUtils.load_offline_data method. Full documentation here.

Related

Migrate to wordpress

I have an old website with an old framework on PHP and mysql.
I want to migrate to wordpress.
I want to know if is possible or exist any plugin on wordpress that let me read data from mysql database and put them on page.
Other speaking, can I use the database and create pages dynamically with wordpress.
If yes please provide me a link contains a simple example to learn.
Appreciate in advance.
Shortly, it's possible to migrate website, which used some framework to wordpress cms. But there isn't any tools, which can do it for any framework type. Each website is differ with it's structure, pages, logics and goals.
For some cases there is plugins, extentions, which transfered the whole website from one framework to another.
But you should to know, that it can not be done 100% transfered without any losing.
Main migrate to wordpress is going so:
1.Compare databases and with sql commands insert into wodpress db information of posts/pages/users/products and etc., which will be inserted as it need wordpress to work with theme.
2.The second step is migrate static files to wordpress, such as html/css/js and make them work dinamically using wordpress functions, file structure and etc.
Please note, that if your framework have not many datas, it will be faster to just install new wordpress into server, find some theme, which will suit you, create posts/pages as you want and after it replace some information from old website

SQLite3 in Symfony3 without doctrine

Is there a specific way to use sqlite3 in symfony without using doctrine?
I just want to do basic operations. And tried including the classes in the directory structure but it is not able to find SQLite3 class.
Any suggestions? I am very tight on time constraint.
Doctrine allow to use sqlite if you define path in doctrine dbal in config.
How to use sqlite database on symfony2 project?
but Doctrine is not integral part of Symfony, so you can drop Doctrine from your project and use sqlite like in pure Php.
You can use exaples form docs:
http://php.net/manual/en/book.sqlite3.php
proposed by Jason Roman in comment. It is simple, but I suggest to create your own service for operation on sqlite or simply use PDO.
http://php.net/manual/en/ref.pdo-sqlite.php

How to generate SQL schema from Spring Boot entities?

Spring Boot is a good framework to develop quickly applications. However, when creating an application binded to database, it seems some of the work must be done twice (I'm using Flyway):
create table creation SQL queries scripts
create Spring entites containing corresponding annotations
run application : the flyway script generates the tables
Writing scripts AND entites can be time consuming, and without added value. Is it possible to do it only once?
Thanks
Just set theese properties on your configuration file:
spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata
spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql
The schema file will be generated automatically in the project root. Hope it helps.
You can also use JPA Buddy plugin. It has a "Show DDL" menu where you can visualize the sql script for a selected entity. Really useful when you want to avoid creating everything manually.

Flyway : interest of creating a SQL init file?

Correct me if I'm wrong, but it seems that Flyway's first step to integrate an existing database is to create a SQL init file containing a DDL and reference datas extract from production (See here). But I don't understand the purpose of such a file since it doesn't seem to be used neither by Flyway's maven plugin nor Flyway's API. So, there is no chance to restore database at its initial state using tools provided by Flyway.
Anyone have an idea about the interest of creating an init file ?
The idea behind this is to align all environments with production, so you have a common base you can rely on.
The purpose of this is to ensure migrations that'll run against production will have been tried on databases with identical structures in development and test.

Zend Framework: Getting started using SQLite

Sorry if this is overly simplistic.
I've decided that I want to use an SQLite database instead of a MySQL database. I'm trying to wrap my head around how simple SQLite is and would like a simple, one answer tutorial on how to use SQLite with the Zend Framework, where to put my SQLite database in my directory structure, how to create the database, etc.
#tuinstoel is correct, attaching to an SQLite database implicitly creates it if it does not exist.
SQLite also supports a command-line client that is more or less like MySQL's command shell, allowing you to issue ad hoc commands or run SQL scripts. See documentation here: http://www.sqlite.org/sqlite.html
Of course you need to change the Zend_Db adapter in your ZF application. ZF supports only an adapter to the PDO SQLite extension. SQLite doesn't support user/password credentials. Also since SQLite is an embedded database instead of client/server, the "host" parameter is meaningless.
$db = Zend_Db::factory("pdo_sqlite", array("dbname"=>"/path/to/mydatabase.db"));
One more caveat: when you get query results in associative-array format, some versions of SQLite insist on using "tablename.columnname" as the keys in the array, whereas other brands of database return keys as simply "columnname". There's an outstanding bug in ZF about this, to try to compensate and make SQLite behave consistently with the other adapters, but the bug is unresolved.
If you make a connection to a not existing database, a database is created on the fly. (You can turn this behavour off)
This is now covered in the Zend Framework quickstart tutorial (version 1.9.5 as of this writing). Just make a new project (with zf command line tool. look here for a great tutorial on setting it up), add these lines to your config.ini file and you're good to go:
; application/configs/application.ini
[production]
resources.db.adapter = "PDO_SQLITE"
resources.db.params.dbname = APPLICATION_PATH "/../data/db/databaseName.db"
Now when you ask for your default database adapter, it will use this one. I would also recommend downloading the quickstart tutorial source code and making use of the load.sqlite.php script. You can create a schema and data file and load the database with these tables/columns/values. It's very helpful! Just check out the tutorial. It's all in there.
This answer was moved out of the question into a CW answer to disavow ownership over the content.

Resources