SQL Using C/C++ and SQLite

Nitya Raut
Updated on 30-Jul-2019 22:30:25

2K+ Views

In this section, you will learn how to use SQLite in C/C++ programs.InstallationBefore you start using SQLite in our C/C++ programs, you need to make sure that you have SQLite library set up on the machine. You can check SQLite Installation chapter to understand the installation process.C/C++ Interface APIsFollowing are important C/C++ SQLite interface routines, which can suffice your requirement to work with SQLite database from your C/C++ program. If you are looking for a more sophisticated application, then you can look into SQLite official documentation.Serial NoAPI & Description1sqlite3_open(const char *filename, sqlite3 **ppDb)This routine opens a connection to an SQLite ... Read More

Change Line Color in EditText

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

4K+ Views

In some situations, we should change edit text bottom line color according to background color. This example demonstrate about how to change line color in EditText.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         In the above code, we have taken edit text, To change line color use the following code for edit text -android:backgroundTint="@android:color/holo_green_light"We can change color as per project requirement. we have taken green color for sample.Step 3 ... Read More

Find If a Column is Auto Increment in MySQL

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

1K+ Views

To find if a column is auto_increment in MySQL, you can use the following syntax −select COLUMN_NAME from information_schema.columns where TABLE_SCHEMA='yourDatabaseName' and TABLE_NAME='yourTableName' and EXTRA like '%auto_increment%';Let us first create a table. Here, ClientId is set AUTO_INCREMENT −mysql> create table autoIncrementTableDemo    -> (    -> ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ClientName varchar(20),    -> ClientAge int,    -> ClientAddress varchar(100),    -> ClientCountryName varchar(100)    -> ); Query OK, 0 rows affected (0.61 sec)Now, let us find whether any of the column is auto_increment −mysql> select COLUMN_NAME from information_schema.columns where TABLE_SCHEMA='test' and TABLE_NAME='autoIncrementTableDemo' and EXTRA ... Read More

Format Date as Apr 19, 2019 1:27 PM in Java

Daniol Thomas
Updated on 30-Jul-2019 22:30:25

199 Views

To format and display datetime, you need to use DateTimeFormatter. The format style is MEDIUM and SHORT:DateTimeFormatter formatter = DateTimeFormatter .ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT);Display the formatted date:formatter.format(LocalDateTime.now()Exampleimport java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; public class Demo {    public static void main(String[] args) {       DateTimeFormatter formatter = DateTimeFormatter .ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT);       System.out.println("Formatted Date = "+formatter.format(LocalDateTime.now()));    } }OutputFormatted Date = Apr 19, 2019, 1:27 PM

Prevent MySQL Double Insert and Duplicate Entry

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

992 Views

To prevent duplicate entry, add constraint UNIQUE. Let us first create a table −mysql> create table DemoTable (    Id int,    Name varchar(100) ); Query OK, 0 rows affected (0.79 sec)Here is the query to prevent MySQL double insert using UNIQUE −mysql> alter table DemoTable add constraint id_NameUnKey UNIQUE(Id, Name); Query OK, 0 rows affected (0.82 sec) Records: 0 Duplicates: 0 Warnings: 0Insert records in the table using insert command. When we will try to the same record again, then the “Duplicate entry” error will be visible −mysql> insert into DemoTable values(11, 'John'); Query OK, 1 row affected (0.18 ... Read More

Asymmetric Digital Subscriber Loop (ADSL)

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

2K+ Views

Asymmetric Digital Subscriber Line (ADSL) is a type of broadband communications technology that transmits digital data at a high bandwidth over existing phone lines to homes and businesses.In order to access ADSL, a Digital Subscriber Line modem (DSL modem) is installed at the client side. The DSL modem sends data bits over the local loop of the telephone network. The local loop is a two – wire connection between the subscriber’s house and the end office of the telephone company. The data bits are accepted at the end office by a device called Digital Subscriber Line Access Multiplexer (DSLAM).Features of ... Read More

Using WHERE Clause in Android SQLite

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

2K+ Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.This example demonstrate about How to where Clause in Android sqlite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create ... Read More

Enable WebView Safe Browsing in Android

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

834 Views

This example demonstrates How to enable webview safe browsing in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. In the above code, we have taken web view to show tutorialspoint.com.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.app.ProgressDialog; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.widget.EditText; public class MainActivity extends AppCompatActivity {    @RequiresApi(api = Build.VERSION_CODES.P) ... Read More

ResultSet Concurrency in JDBC

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

2K+ Views

The concurrency of the ResultSet object determines whether its contents can be updated or not.The Connection interface provides 3 variants of the createStatement() method where one of the method's signature is as follows:Statement createStatement(int resultSetType, int resultSetConcurrency)This method accepts two integer type variables where one represents the type of the ResultSet and the other represents the Concurrency of the ResultSet.The ResultSet interface provides two values to specify the concurrency of the ResultSet.CONCUR_READ_ONLY: If you set this as a value of the concurrency while creating the ResultSet object you cannot update the contents of the ResultSet you can only read/retrieve them.CONCUR_UPDATABLE: ... Read More

LocalDateTime plus Method in Java

Samual Sam
Updated on 30-Jul-2019 22:30:25

349 Views

An immutable copy of a LocalDateTime where the required duration is added to it can be obtained using the plus() method in the LocalDateTime class in Java. This method requires two parameters i.e. the duration to be added and the TemporalUnit of the duration. Also, it returns the LocalDateTime object with the required duration added to it.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.time.temporal.*; public class Demo {    public static void main(String[] args) {       LocalDateTime ldt = LocalDateTime.now();       System.out.println("The LocalDateTime is: " + ldt);       ... Read More

Advertisements