aboutsummaryrefslogtreecommitdiffstats
path: root/src/hlr_db_tool.c
AgeCommit message (Collapse)AuthorFilesLines
2020-09-23osmo-hlr-db-tool: Make import from osmo-nitb less "lossy"Keith1-5/+98
Include the IMEI and the last seen time in an import from an osmo-nitb database. Change-Id: Ic47e549be3551ae43ab6a84228d47ae03e9652a6
2019-11-20move headers to include/osmocom/hlrNeels Hofmeyr1-3/+3
Apply the same headers structure that we keep in most Osmocom source trees: Keep noinst_HEADERS in include/osmocom/hlr and include them using #include <osmocom/hlr/*.h> The only header kept in src/ is db_bootstrap.h, because it is generated during build time. If it was built in include/osmocom/hlr, we would need db.o to depend on db_bootstrap.h in a different subdir, which automake can't do well. Change-Id: Ic912fe27f545b85443c5fb713d8c3c8aac23c9ad
2019-05-13db_hlr.c: db_subscr_create(): add flags argumentOliver Smith1-1/+1
Allow creating new subscribers without giving them access to CS or PS. This will be used by the create-subscriber-on-demand feature. Related: OS#2542 Change-Id: I1a6dd85387723dab5487c53b33d2d9ec6d05d006
2018-12-07add whitespace around PRId64 constantsStefan Sperling1-1/+1
Avoid string concatenations without interleaving whitespace. Some compilers don't like "foo""bar", they only like "foo" "bar". Requested by: Pau https://gerrit.osmocom.org/c/osmo-hlr/+/12121/5/src/db_hlr.c#637 Change-Id: Ic7a81114f9afbefcbd62d434720854cfdd4a2dd9
2018-12-04add database schema versioning to the HLR databaseStefan Sperling1-2/+9
Make use of pragma user_version to store our database schema version. The present schema is now identitifed as 'version 0', which is also the default value for databases on which we never ran the statement 'pragma user_version' before. Only bootstrap the database if it hasn't been bootstrapped yet. Previously, bootstrap SQL statements ran every time osmo-hlr opened the database, and any errors were being ignored in SQL. Instead, we now first run a query which checks whether tables already exist, and only create them if necessary. This change will allow future schema updates to work properly. Prepare for future schema upgrades by adding a new command-line option which enables upgrades. This option defaults to 'false' in order to avoid accidental upgrades. Change-Id: I8aeaa9a404b622657cbc7138106f38aa6ad8d01b Related: OS#2838
2018-04-17use osmo_init_logging2Pau Espin Pedrol1-1/+1
Change-Id: If4449cce1af46be22cc370abd3a6da8e22a31fa5
2017-11-21db_test: don't verify SQLite issued error messages, they might changeNeels Hofmeyr1-1/+1
A user on openbsc@ complained that with SQLite 3.8.2, the db_test fails with --- expected +++ stderr -DDB (2067) abort at 18 in [INSERT INTO subscriber (imsi) VALUES ($imsi)]: UNIQUE constraint failed: subscriber.imsi +DDB (2067) abort at 35 in [INSERT INTO subscriber (imsi) VALUES ($imsi)]: UNIQUE constraint failed: subscriber.imsi i.e. a trivial difference in the error message issued by SQLite. For db_test, don't output any SQLite error messages: Add argument enable_sqlite_logging, pass as true, except in db_test.c. Remove the SQLite error messages from expected output. (Note that there is a src/db_test.c program that's not of interest here, this is about the tests/db/db_test.c) Change-Id: I2513d71cc0072aef8d08f47d0a1959f311176229
2017-11-12db-tool: error-exit on too many argumentsNeels Hofmeyr1-0/+6
Each arg parsing should increment optind, so if there are any surplus args in the end, that's an error. Change-Id: I9fc0a87d11db8c35061568e3f8b5a5547931a961
2017-11-12db-tool: cosmetic: tweak printf outputNeels Hofmeyr1-2/+1
Say <nitb.db> to indicate a filename. No need to print the cmd and arg count, really. Change-Id: I3be31754db5297b3f6028877068f97ce1be4d74b
2017-11-12db-tool: add command 'create'Neels Hofmeyr1-4/+12
Change-Id: Ic4997d17763e50fb63c36fc0001570230bf64a12
2017-11-08hlr_db_tool: fix error log strerror invocationNeels Hofmeyr1-4/+4
The db API returns negative errno values, need to flip the sign before feeding to strerror. Fixes: coverity CID#178658 Change-Id: Iaab46f565a1112d8a7def8ea90a5cd440c0a3b41
2017-10-28add osmo-hlr-db-tool, program to migrate from osmo-nitb dbNeels Hofmeyr1-0/+426
Move macro copy_sqlite3_text_to_buf() to db.h, so it can be used in hlr_db_tool.c. Add _dbd_decode_binary() from libdbi to avoid depending on the entire libdbi just for KI BLOB decoding. Add it in a separate file, copying its own license, the lGPL. Offer commandline option "import-nitb-db" to read in an old osmo-nitb database and copy subscriber IMSIs and 2G auth data to OsmoHLR db format. Anticipate future command line options like "import-csv", so keep the code generalized. Change-Id: I0dfa6ec033dd93161c1adc2ce1637195fe5b7a63