Add missing .clang-format, and fix some spaces that slipped through.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4856 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -105,7 +105,7 @@ static JSValue _database_get(JSContext* context, JSValueConst this_val, int argc
|
||||
size_t length;
|
||||
const char* keyString = JS_ToCStringLen(context, &length, argv[0]);
|
||||
if (sqlite3_bind_text(statement, 1, database->id, -1, NULL) == SQLITE_OK && sqlite3_bind_text(statement, 2, keyString, length, NULL) == SQLITE_OK &&
|
||||
sqlite3_step(statement) == SQLITE_ROW)
|
||||
sqlite3_step(statement) == SQLITE_ROW)
|
||||
{
|
||||
entry = JS_NewStringLen(context, (const char*)sqlite3_column_text(statement, 0), sqlite3_column_bytes(statement, 0));
|
||||
}
|
||||
@ -132,7 +132,7 @@ static JSValue _database_set(JSContext* context, JSValueConst this_val, int argc
|
||||
size_t valueLength;
|
||||
const char* valueString = JS_ToCStringLen(context, &valueLength, argv[1]);
|
||||
if (sqlite3_bind_text(statement, 1, database->id, -1, NULL) == SQLITE_OK && sqlite3_bind_text(statement, 2, keyString, keyLength, NULL) == SQLITE_OK &&
|
||||
sqlite3_bind_text(statement, 3, valueString, valueLength, NULL) == SQLITE_OK && sqlite3_step(statement) == SQLITE_OK)
|
||||
sqlite3_bind_text(statement, 3, valueString, valueLength, NULL) == SQLITE_OK && sqlite3_step(statement) == SQLITE_OK)
|
||||
{
|
||||
}
|
||||
JS_FreeCString(context, keyString);
|
||||
@ -162,7 +162,7 @@ static JSValue _database_exchange(JSContext* context, JSValueConst this_val, int
|
||||
const char* key = JS_ToCStringLen(context, &key_length, argv[0]);
|
||||
const char* set = JS_ToCStringLen(context, &set_length, argv[2]);
|
||||
if (sqlite3_bind_text(statement, 1, database->id, -1, NULL) == SQLITE_OK && sqlite3_bind_text(statement, 2, key, key_length, NULL) == SQLITE_OK &&
|
||||
sqlite3_bind_text(statement, 3, set, set_length, NULL) == SQLITE_OK && sqlite3_step(statement) == SQLITE_DONE)
|
||||
sqlite3_bind_text(statement, 3, set, set_length, NULL) == SQLITE_OK && sqlite3_step(statement) == SQLITE_DONE)
|
||||
{
|
||||
exchanged = sqlite3_changes(db) != 0 ? JS_TRUE : JS_FALSE;
|
||||
}
|
||||
@ -180,8 +180,8 @@ static JSValue _database_exchange(JSContext* context, JSValueConst this_val, int
|
||||
const char* expected = JS_ToCStringLen(context, &expected_length, argv[1]);
|
||||
const char* set = JS_ToCStringLen(context, &set_length, argv[2]);
|
||||
if (sqlite3_bind_text(statement, 1, set, set_length, NULL) == SQLITE_OK && sqlite3_bind_text(statement, 2, database->id, -1, NULL) == SQLITE_OK &&
|
||||
sqlite3_bind_text(statement, 3, key, key_length, NULL) == SQLITE_OK && sqlite3_bind_text(statement, 4, expected, expected_length, NULL) == SQLITE_OK &&
|
||||
sqlite3_step(statement) == SQLITE_DONE)
|
||||
sqlite3_bind_text(statement, 3, key, key_length, NULL) == SQLITE_OK && sqlite3_bind_text(statement, 4, expected, expected_length, NULL) == SQLITE_OK &&
|
||||
sqlite3_step(statement) == SQLITE_DONE)
|
||||
{
|
||||
exchanged = sqlite3_changes(db) != 0 ? JS_TRUE : JS_FALSE;
|
||||
}
|
||||
@ -208,7 +208,7 @@ static JSValue _database_remove(JSContext* context, JSValueConst this_val, int a
|
||||
size_t keyLength;
|
||||
const char* keyString = JS_ToCStringLen(context, &keyLength, argv[0]);
|
||||
if (sqlite3_bind_text(statement, 1, database->id, -1, NULL) == SQLITE_OK && sqlite3_bind_text(statement, 2, keyString, keyLength, NULL) == SQLITE_OK &&
|
||||
sqlite3_step(statement) == SQLITE_OK)
|
||||
sqlite3_step(statement) == SQLITE_OK)
|
||||
{
|
||||
}
|
||||
JS_FreeCString(context, keyString);
|
||||
@ -236,8 +236,7 @@ static JSValue _database_get_all(JSContext* context, JSValueConst this_val, int
|
||||
uint32_t index = 0;
|
||||
while (sqlite3_step(statement) == SQLITE_ROW)
|
||||
{
|
||||
JS_SetPropertyUint32(
|
||||
context, array, index++, JS_NewStringLen(context, (const char*)sqlite3_column_text(statement, 0), sqlite3_column_bytes(statement, 0)));
|
||||
JS_SetPropertyUint32(context, array, index++, JS_NewStringLen(context, (const char*)sqlite3_column_text(statement, 0), sqlite3_column_bytes(statement, 0)));
|
||||
}
|
||||
}
|
||||
sqlite3_finalize(statement);
|
||||
@ -265,7 +264,7 @@ static JSValue _database_get_like(JSContext* context, JSValueConst this_val, int
|
||||
while (sqlite3_step(statement) == SQLITE_ROW)
|
||||
{
|
||||
JS_SetPropertyStr(context, result, (const char*)sqlite3_column_text(statement, 0),
|
||||
JS_NewStringLen(context, (const char*)sqlite3_column_text(statement, 1), sqlite3_column_bytes(statement, 1)));
|
||||
JS_NewStringLen(context, (const char*)sqlite3_column_text(statement, 1), sqlite3_column_bytes(statement, 1)));
|
||||
}
|
||||
}
|
||||
JS_FreeCString(context, pattern);
|
||||
@ -292,8 +291,7 @@ static JSValue _databases_list(JSContext* context, JSValueConst this_val, int ar
|
||||
uint32_t index = 0;
|
||||
while (sqlite3_step(statement) == SQLITE_ROW)
|
||||
{
|
||||
JS_SetPropertyUint32(
|
||||
context, array, index++, JS_NewStringLen(context, (const char*)sqlite3_column_text(statement, 0), sqlite3_column_bytes(statement, 0)));
|
||||
JS_SetPropertyUint32(context, array, index++, JS_NewStringLen(context, (const char*)sqlite3_column_text(statement, 0), sqlite3_column_bytes(statement, 0)));
|
||||
}
|
||||
}
|
||||
JS_FreeCString(context, pattern);
|
||||
|
Reference in New Issue
Block a user